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

Unified Diff: cc/ipc/surface_reference_struct_traits.h

Issue 2541683004: Add/remove surface references via MojoCompositorFrameSink. (Closed)
Patch Set: Created 4 years 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
Index: cc/ipc/surface_reference_struct_traits.h
diff --git a/cc/ipc/surface_reference_struct_traits.h b/cc/ipc/surface_reference_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..65b33dfc578611cced75f4939c01b72e78a36a04
--- /dev/null
+++ b/cc/ipc/surface_reference_struct_traits.h
@@ -0,0 +1,39 @@
+// Copyright 2016 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_SURFACE_REFERENCE_STRUCT_TRAITS_H_
+#define CC_IPC_SURFACE_REFERENCE_STRUCT_TRAITS_H_
+
+#include "cc/ipc/surface_id_struct_traits.h"
+#include "cc/ipc/surface_reference.mojom-shared.h"
+#include "cc/surfaces/surface_id.h"
+#include "cc/surfaces/surface_reference.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<cc::mojom::SurfaceReferenceDataView, cc::SurfaceReference> {
+ static const cc::SurfaceId& parent_id(const cc::SurfaceReference& ref) {
+ return ref.parent_id();
+ }
+
+ static const cc::SurfaceId& child_id(const cc::SurfaceReference& ref) {
+ return ref.child_id();
+ }
+
+ static bool Read(cc::mojom::SurfaceReferenceDataView data,
+ cc::SurfaceReference* out) {
+ if (!data.ReadChildId(&out->child_id_))
+ return false;
+
+ if (!data.ReadParentId(&out->parent_id_))
+ return false;
+
+ return true;
+ }
+};
+
+} // namespace mojo
+
+#endif // CC_IPC_SURFACE_REFERENCE_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698