Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: cc/ipc/returned_resource_struct_traits.h

Issue 2019833002: Implement StructTraits for various cc and gpu types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mailbox_name by ref to make windows happy Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/ipc/returned_resource.typemap ('k') | cc/ipc/struct_traits_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/ipc/returned_resource_struct_traits.h
diff --git a/cc/ipc/returned_resource_struct_traits.h b/cc/ipc/returned_resource_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..38e02fda9c5323659544ffe55954700683395bbd
--- /dev/null
+++ b/cc/ipc/returned_resource_struct_traits.h
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_IPC_RETURNED_RESOURCE_STRUCT_TRAITS_H_
+#define CC_IPC_RETURNED_RESOURCE_STRUCT_TRAITS_H_
+
+#include "cc/ipc/returned_resource.mojom.h"
+#include "cc/resources/returned_resource.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<cc::mojom::ReturnedResource, cc::ReturnedResource> {
+ static uint32_t id(const cc::ReturnedResource& resource) {
+ return resource.id;
+ }
+
+ static gpu::SyncToken sync_token(const cc::ReturnedResource& resource) {
+ return resource.sync_token;
+ }
+
+ static int32_t count(const cc::ReturnedResource& resource) {
+ return resource.count;
+ }
+
+ static bool lost(const cc::ReturnedResource& resource) {
+ return resource.lost;
+ }
+
+ static bool Read(cc::mojom::ReturnedResourceDataView data,
+ cc::ReturnedResource* out) {
+ if (!data.ReadSyncToken(&out->sync_token))
+ return false;
+ out->id = data.id();
+ out->count = data.count();
+ out->lost = data.lost();
+ return true;
+ }
+};
+
+} // namespace mojo
+
+#endif // CC_IPC_RETURNED_RESOURCE_STRUCT_TRAITS_H_
« no previous file with comments | « cc/ipc/returned_resource.typemap ('k') | cc/ipc/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698