Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ | |
| 6 #define CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ | |
| 7 | |
| 8 #include "cc/ipc/texture_mailbox.mojom-shared.h" | |
| 9 #include "cc/resources/texture_mailbox.h" | |
| 10 | |
| 11 namespace mojo { | |
| 12 | |
| 13 template <> | |
| 14 struct StructTraits<cc::mojom::TextureMailboxDataView, cc::TextureMailbox> { | |
| 15 static const gpu::MailboxHolder mailbox_holder( | |
|
Fady Samuel
2017/01/25 22:03:47
pass by const ref instead.
const gpu::MailboxHold
Saman Sami
2017/01/25 23:04:00
Done.
| |
| 16 const cc::TextureMailbox& input) { | |
| 17 return input.mailbox_holder_; | |
| 18 } | |
| 19 | |
| 20 static const gfx::Size size_in_pixels(const cc::TextureMailbox& input) { | |
|
Fady Samuel
2017/01/25 22:03:47
const gfx::Size&
Saman Sami
2017/01/25 23:04:00
Done.
| |
| 21 return input.size_in_pixels_; | |
| 22 } | |
| 23 | |
| 24 static bool is_overlay_candidate(const cc::TextureMailbox& input) { | |
| 25 return input.is_overlay_candidate_; | |
| 26 } | |
| 27 | |
| 28 static bool is_backed_by_surface_texture(const cc::TextureMailbox& input) { | |
| 29 #if defined(OS_ANDROID) | |
| 30 return input.is_backed_by_surface_texture_; | |
| 31 #endif | |
| 32 return false; | |
| 33 } | |
| 34 | |
| 35 static bool wants_promotion_hint(const cc::TextureMailbox& input) { | |
| 36 #if defined(OS_ANDROID) | |
| 37 return input.wants_promotion_hint_; | |
| 38 #endif | |
| 39 return false; | |
| 40 } | |
| 41 | |
| 42 static bool secure_output_only(const cc::TextureMailbox& input) { | |
| 43 return input.secure_output_only_; | |
| 44 } | |
| 45 | |
| 46 static bool nearest_neighbor(const cc::TextureMailbox& input) { | |
| 47 return input.nearest_neighbor_; | |
| 48 } | |
| 49 | |
| 50 static const gfx::ColorSpace color_space(const cc::TextureMailbox& input) { | |
|
Fady Samuel
2017/01/25 22:03:47
gfx::ColorSpace. No need for const
Saman Sami
2017/01/25 23:04:00
const gfx::ColorSpace&
| |
| 51 return input.color_space_; | |
| 52 } | |
| 53 | |
| 54 static bool Read(cc::mojom::TextureMailboxDataView data, | |
| 55 cc::TextureMailbox* out) { | |
| 56 #if defined(OS_ANDROID) | |
| 57 out->is_backed_by_surface_texture_ = data.is_backed_by_surface_texture(); | |
| 58 out->wants_promotion_hint_ = data.wants_promotion_hint(); | |
| 59 #endif | |
| 60 out->is_overlay_candidate_ = data.is_overlay_candidate(); | |
| 61 out->secure_output_only_ = data.secure_output_only(); | |
| 62 out->nearest_neighbor_ = data.nearest_neighbor(); | |
| 63 | |
| 64 return data.ReadMailboxHolder(&out->mailbox_holder_) && | |
| 65 data.ReadSizeInPixels(&out->size_in_pixels_) && | |
| 66 data.ReadColorSpace(&out->color_space_); | |
| 67 } | |
| 68 }; | |
| 69 | |
| 70 } // namespace mojo | |
| 71 | |
| 72 #endif // CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ | |
| OLD | NEW |