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

Unified Diff: gpu/ipc/common/mailbox_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 | « gpu/ipc/common/mailbox_holder_struct_traits.h ('k') | gpu/ipc/common/mailbox_struct_traits.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/common/mailbox_struct_traits.h
diff --git a/gpu/ipc/common/mailbox_struct_traits.h b/gpu/ipc/common/mailbox_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..5eedd6ca2fdd39d015690955e9e0f2d9ec0e18aa
--- /dev/null
+++ b/gpu/ipc/common/mailbox_struct_traits.h
@@ -0,0 +1,42 @@
+// 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 GPU_IPC_COMMON_MAILBOX_STRUCT_TRAITS_H_
+#define GPU_IPC_COMMON_MAILBOX_STRUCT_TRAITS_H_
+
+#include "gpu/command_buffer/common/mailbox.h"
+#include "gpu/ipc/common/mailbox.mojom.h"
+#include "mojo/public/cpp/bindings/array_traits.h"
+
+namespace mojo {
+
+// A buffer used to read bytes directly from MailboxDataView to gpu::Mailbox
+// name.
+struct MailboxName {
+ int8_t* data;
+};
+
+// ArrayTraits needed for ReadName use with MailboxName.
+template <>
+struct ArrayTraits<MailboxName> {
+ using Element = int8_t;
+ static bool IsNull(const MailboxName& b);
+ static void SetToNull(MailboxName* b);
+ static size_t GetSize(const MailboxName& b);
+ static int8_t* GetData(MailboxName& b);
+ static const int8_t* GetData(const MailboxName& b);
+ static int8_t& GetAt(MailboxName& b, size_t i);
+ static const int8_t& GetAt(const MailboxName& b, size_t i);
+ static void Resize(MailboxName& b, size_t size);
+};
+
+template <>
+struct StructTraits<gpu::mojom::Mailbox, gpu::Mailbox> {
+ static MailboxName name(const gpu::Mailbox& mailbox);
+ static bool Read(gpu::mojom::MailboxDataView data, gpu::Mailbox* out);
+};
+
+} // namespace mojo
+
+#endif // GPU_IPC_COMMON_MAILBOX_STRUCT_TRAITS_H_
« no previous file with comments | « gpu/ipc/common/mailbox_holder_struct_traits.h ('k') | gpu/ipc/common/mailbox_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698