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

Side by Side 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, 6 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef GPU_IPC_COMMON_MAILBOX_STRUCT_TRAITS_H_
6 #define GPU_IPC_COMMON_MAILBOX_STRUCT_TRAITS_H_
7
8 #include "gpu/command_buffer/common/mailbox.h"
9 #include "gpu/ipc/common/mailbox.mojom.h"
10 #include "mojo/public/cpp/bindings/array_traits.h"
11
12 namespace mojo {
13
14 // A buffer used to read bytes directly from MailboxDataView to gpu::Mailbox
15 // name.
16 struct MailboxName {
17 int8_t* data;
18 };
19
20 // ArrayTraits needed for ReadName use with MailboxName.
21 template <>
22 struct ArrayTraits<MailboxName> {
23 using Element = int8_t;
24 static bool IsNull(const MailboxName& b);
25 static void SetToNull(MailboxName* b);
26 static size_t GetSize(const MailboxName& b);
27 static int8_t* GetData(MailboxName& b);
28 static const int8_t* GetData(const MailboxName& b);
29 static int8_t& GetAt(MailboxName& b, size_t i);
30 static const int8_t& GetAt(const MailboxName& b, size_t i);
31 static void Resize(MailboxName& b, size_t size);
32 };
33
34 template <>
35 struct StructTraits<gpu::mojom::Mailbox, gpu::Mailbox> {
36 static MailboxName name(const gpu::Mailbox& mailbox);
37 static bool Read(gpu::mojom::MailboxDataView data, gpu::Mailbox* out);
38 };
39
40 } // namespace mojo
41
42 #endif // GPU_IPC_COMMON_MAILBOX_STRUCT_TRAITS_H_
OLDNEW
« 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