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

Unified Diff: cc/ipc/texture_mailbox_struct_traits.h

Issue 2651793007: Implemented StructTraits for cc::TextureMailbox (Closed)
Patch Set: c Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/ipc/texture_mailbox.typemap ('k') | cc/ipc/traits_test_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3a7232889627839f1540a2481615bd545ba5cd29
--- /dev/null
+++ b/cc/ipc/texture_mailbox_struct_traits.h
@@ -0,0 +1,74 @@
+// 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)
+ return input.is_backed_by_surface_texture_;
+#else
+ return false;
+#endif
+ }
+
+ static bool wants_promotion_hint(const cc::TextureMailbox& input) {
+#if defined(OS_ANDROID)
+ return input.wants_promotion_hint_;
+#else
+ return false;
+#endif
+ }
+
+ 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_
« no previous file with comments | « cc/ipc/texture_mailbox.typemap ('k') | cc/ipc/traits_test_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698