OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ | 5 #ifndef CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ |
6 #define CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ | 6 #define CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "cc/ipc/texture_mailbox.mojom-shared.h" | 8 #include "cc/ipc/texture_mailbox.mojom-shared.h" |
9 #include "cc/resources/texture_mailbox.h" | 9 #include "cc/resources/texture_mailbox.h" |
10 #include "gpu/ipc/common/mailbox_holder_struct_traits.h" | 10 #include "gpu/ipc/common/mailbox_holder_struct_traits.h" |
11 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" | 11 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" |
12 #include "ui/gfx/ipc/color/gfx_param_traits.h" | 12 #include "ui/gfx/ipc/color/gfx_param_traits.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 | 15 |
16 template <> | 16 template <> |
17 struct StructTraits<cc::mojom::TextureMailboxDataView, cc::TextureMailbox> { | 17 struct StructTraits<cc::mojom::TextureMailboxDataView, cc::TextureMailbox> { |
18 static bool IsNull(const cc::TextureMailbox& input) { | |
19 return !input.IsTexture(); | |
danakj
2017/02/14 23:49:34
Uh.. so. This is where this nullable thing gets re
| |
20 } | |
21 | |
22 static void SetToNull(cc::TextureMailbox* output) { | |
23 *output = cc::TextureMailbox(); | |
24 } | |
25 | |
18 static const gpu::MailboxHolder& mailbox_holder( | 26 static const gpu::MailboxHolder& mailbox_holder( |
19 const cc::TextureMailbox& input) { | 27 const cc::TextureMailbox& input) { |
20 return input.mailbox_holder_; | 28 return input.mailbox_holder_; |
21 } | 29 } |
22 | 30 |
23 static const gfx::Size& size_in_pixels(const cc::TextureMailbox& input) { | 31 static const gfx::Size& size_in_pixels(const cc::TextureMailbox& input) { |
24 return input.size_in_pixels_; | 32 return input.size_in_pixels_; |
25 } | 33 } |
26 | 34 |
27 static bool is_overlay_candidate(const cc::TextureMailbox& input) { | 35 static bool is_overlay_candidate(const cc::TextureMailbox& input) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 | 76 |
69 return data.ReadMailboxHolder(&out->mailbox_holder_) && | 77 return data.ReadMailboxHolder(&out->mailbox_holder_) && |
70 data.ReadSizeInPixels(&out->size_in_pixels_) && | 78 data.ReadSizeInPixels(&out->size_in_pixels_) && |
71 data.ReadColorSpace(&out->color_space_); | 79 data.ReadColorSpace(&out->color_space_); |
72 } | 80 } |
73 }; | 81 }; |
74 | 82 |
75 } // namespace mojo | 83 } // namespace mojo |
76 | 84 |
77 #endif // CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ | 85 #endif // CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ |
OLD | NEW |