Chromium Code Reviews| Index: cc/ipc/texture_mailbox_struct_traits.h |
| diff --git a/cc/ipc/texture_mailbox_struct_traits.h b/cc/ipc/texture_mailbox_struct_traits.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e05556b3d3bbd2d8980548039cb0cd275b7b7740 |
| --- /dev/null |
| +++ b/cc/ipc/texture_mailbox_struct_traits.h |
| @@ -0,0 +1,72 @@ |
| +// Copyright 2017 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_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ |
| +#define CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ |
| + |
| +#include "cc/ipc/texture_mailbox.mojom-shared.h" |
| +#include "cc/resources/texture_mailbox.h" |
| + |
| +namespace mojo { |
| + |
| +template <> |
| +struct StructTraits<cc::mojom::TextureMailboxDataView, cc::TextureMailbox> { |
| + 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.
|
| + const cc::TextureMailbox& input) { |
| + return input.mailbox_holder_; |
| + } |
| + |
| + 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.
|
| + return input.size_in_pixels_; |
| + } |
| + |
| + static bool is_overlay_candidate(const cc::TextureMailbox& input) { |
| + return input.is_overlay_candidate_; |
| + } |
| + |
| + static bool is_backed_by_surface_texture(const cc::TextureMailbox& input) { |
| +#if defined(OS_ANDROID) |
| + return input.is_backed_by_surface_texture_; |
| +#endif |
| + return false; |
| + } |
| + |
| + static bool wants_promotion_hint(const cc::TextureMailbox& input) { |
| +#if defined(OS_ANDROID) |
| + return input.wants_promotion_hint_; |
| +#endif |
| + return false; |
| + } |
| + |
| + static bool secure_output_only(const cc::TextureMailbox& input) { |
| + return input.secure_output_only_; |
| + } |
| + |
| + static bool nearest_neighbor(const cc::TextureMailbox& input) { |
| + return input.nearest_neighbor_; |
| + } |
| + |
| + 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&
|
| + return input.color_space_; |
| + } |
| + |
| + static bool Read(cc::mojom::TextureMailboxDataView data, |
| + cc::TextureMailbox* out) { |
| +#if defined(OS_ANDROID) |
| + out->is_backed_by_surface_texture_ = data.is_backed_by_surface_texture(); |
| + out->wants_promotion_hint_ = data.wants_promotion_hint(); |
| +#endif |
| + out->is_overlay_candidate_ = data.is_overlay_candidate(); |
| + out->secure_output_only_ = data.secure_output_only(); |
| + out->nearest_neighbor_ = data.nearest_neighbor(); |
| + |
| + return data.ReadMailboxHolder(&out->mailbox_holder_) && |
| + data.ReadSizeInPixels(&out->size_in_pixels_) && |
| + data.ReadColorSpace(&out->color_space_); |
| + } |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // CC_IPC_TEXTURE_MAILBOX_STRUCT_TRAITS_H_ |