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..8fb5655e5d413949ee3b66e868c27fde441e098b |
| --- /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( |
| + const cc::TextureMailbox& input) { |
| + return input.mailbox_holder_; |
| + } |
| + |
| + static const gfx::Size& size_in_pixels(const cc::TextureMailbox& input) { |
| + 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) |
|
vmpstr
2017/01/27 21:08:05
I assume the android compiler is OK with
return a
Saman Sami
2017/01/27 21:24:53
It doesn't seem to mind, but to avoid possible pro
|
| + 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) { |
| + 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_ |