MapAsync update: keep read/write handle through lifetime of mappable buffers

Change dawn read/write handle for buffer mapping to be created at buffer
creation time instead of at mapAsync time. Update related buffer mapping
tests and wire tests.

Bug: dawn:773
Change-Id: I7dd423c94e1bc15cfe561ea33ec9e348ddf2bfe0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51164
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
This commit is contained in:
shrekshao
2021-07-08 22:48:57 +00:00
committed by Dawn LUCI CQ
parent 15838b98af
commit 6e680fc56f
20 changed files with 936 additions and 772 deletions

View File

@@ -121,6 +121,7 @@ namespace dawn_wire {
// deserialize the data update and apply
// it to the range (offset, offset + size) of allocation
// There could be nothing to be deserialized (if using shared memory)
// Needs to check potential offset/size OOB and overflow
// TODO(dawn:773): change to pure virtual after update on chromium side.
virtual bool DeserializeDataUpdate(const void* deserializePointer,
size_t deserializeSize,

View File

@@ -132,8 +132,9 @@ namespace dawn_wire {
// Set the target for writes from the client. DeserializeFlush should copy data
// into the target.
// TODO(dawn:773): only set backing buffer pointer data
void SetTarget(void* data, size_t dataLength);
void SetTarget(void* data);
// Set Staging data length for OOB check
void SetDataLength(size_t dataLength);
// TODO(dawn:773): remove after update on chromium side.
virtual bool DeserializeFlush(const void* deserializePointer,
@@ -143,6 +144,7 @@ namespace dawn_wire {
// This function takes in the serialized result of
// client::MemoryTransferService::WriteHandle::SerializeDataUpdate.
// Needs to check potential offset/size OOB and overflow
virtual bool DeserializeDataUpdate(const void* deserializePointer,
size_t deserializeSize,
size_t offset,
@@ -152,7 +154,6 @@ namespace dawn_wire {
protected:
void* mTargetData = nullptr;
// TODO(dawn:773): only set backing buffer pointer data
size_t mDataLength = 0;
private: