dawn/wire: Move all the members of `WriteHandle` to private This patch moves all the members of `WriteHandle` to private after the land of the related changes in Chromium. Because `mTargetData` and `mDataLength` may not be set together, we cannot put them into one `std::span`. bug: 42240963 Change-Id: I13b0c46c09040820fbf19e92ef57d81624ceeece Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/256814 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
diff --git a/include/dawn/wire/WireServer.h b/include/dawn/wire/WireServer.h index 19a269f..b6c0097 100644 --- a/include/dawn/wire/WireServer.h +++ b/include/dawn/wire/WireServer.h
@@ -139,15 +139,12 @@ size_t size) = 0; std::span<uint8_t> GetTarget() const; - protected: - // TODO(42240963): Move them into a std::span and put it to private after landing the - // related changes in Chromium. - void* mTargetData = nullptr; - size_t mDataLength = 0; - private: WriteHandle(const WriteHandle&) = delete; WriteHandle& operator=(const WriteHandle&) = delete; + + uint8_t* mTargetData = nullptr; + size_t mDataLength = 0; }; private:
diff --git a/src/dawn/wire/WireServer.cpp b/src/dawn/wire/WireServer.cpp index 3244a18..cf8b4eb 100644 --- a/src/dawn/wire/WireServer.cpp +++ b/src/dawn/wire/WireServer.cpp
@@ -85,14 +85,14 @@ MemoryTransferService::WriteHandle::~WriteHandle() = default; void MemoryTransferService::WriteHandle::SetTarget(void* data) { - mTargetData = data; + mTargetData = static_cast<uint8_t*>(data); } void MemoryTransferService::WriteHandle::SetDataLength(size_t dataLength) { mDataLength = dataLength; } std::span<uint8_t> MemoryTransferService::WriteHandle::GetTarget() const { DAWN_ASSERT(mTargetData != nullptr); - return std::span<uint8_t>(static_cast<uint8_t*>(mTargetData), mDataLength); + return std::span<uint8_t>(mTargetData, mDataLength); } } // namespace server