dawn_wire: Move BufferConsumer to it's own file. Unify WIRE_TRY

Bug: dawn:680
Change-Id: I6d57280ab11381649deef51ee7babf5ca73f359b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42340
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Austin Eng
2021-02-25 20:21:25 +00:00
committed by Commit Bot service account
parent 12827fb805
commit bd3f58612f
13 changed files with 311 additions and 227 deletions

View File

@@ -13,6 +13,7 @@
// limitations under the License.
#include "common/Assert.h"
#include "dawn_wire/BufferConsumer_impl.h"
#include "dawn_wire/WireCmd_autogen.h"
#include "dawn_wire/server/Server.h"
@@ -251,12 +252,12 @@ namespace dawn_wire { namespace server {
SerializeCommand(cmd, cmd.readInitialDataInfoLength, [&](SerializeBuffer* serializeBuffer) {
if (isSuccess) {
if (isRead) {
if (serializeBuffer->AvailableSize() != cmd.readInitialDataInfoLength) {
return false;
}
char* readHandleBuffer;
WIRE_TRY(
serializeBuffer->NextN(cmd.readInitialDataInfoLength, &readHandleBuffer));
// Serialize the initialization message into the space after the command.
data->readHandle->SerializeInitialData(readData, data->size,
serializeBuffer->Buffer());
data->readHandle->SerializeInitialData(readData, data->size, readHandleBuffer);
// The in-flight map request returned successfully.
// Move the ReadHandle so it is owned by the buffer.
bufferData->readHandle = std::move(data->readHandle);
@@ -271,7 +272,7 @@ namespace dawn_wire { namespace server {
data->size);
}
}
return true;
return WireResult::Success;
});
}