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

Unified Diff: cc/ipc/compositor_frame_metadata_struct_traits.h

Issue 2965103003: Test
Patch Set: c Created 3 years, 5 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/compositor_frame_metadata.mojom ('k') | cc/ipc/compositor_frame_metadata_struct_traits.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/ipc/compositor_frame_metadata_struct_traits.h
diff --git a/cc/ipc/compositor_frame_metadata_struct_traits.h b/cc/ipc/compositor_frame_metadata_struct_traits.h
index 2959ababfe84768bb6c13f21ca7a30e7778e25f6..653f110f7b89f97144b82efcf4965f8ba54a8575 100644
--- a/cc/ipc/compositor_frame_metadata_struct_traits.h
+++ b/cc/ipc/compositor_frame_metadata_struct_traits.h
@@ -5,8 +5,9 @@
#ifndef CC_IPC_COMPOSITOR_FRAME_METADATA_STRUCT_TRAITS_H_
#define CC_IPC_COMPOSITOR_FRAME_METADATA_STRUCT_TRAITS_H_
-#include "cc/ipc/compositor_frame_metadata.mojom-shared.h"
+#include "cc/ipc/compositor_frame_metadata.mojom.h"
#include "cc/output/compositor_frame_metadata.h"
+#include "mojo/public/cpp/system/platform_handle.h"
namespace mojo {
@@ -130,6 +131,32 @@ struct StructTraits<cc::mojom::CompositorFrameMetadataDataView,
return metadata.frame_token;
}
+ static std::vector<cc::mojom::SharedBitmapInfoPtr>& shared_bitmaps_to_register(
+ const cc::CompositorFrameMetadata& metadata, void* context) {
+ static std::vector<cc::mojom::SharedBitmapInfoPtr> empty_vector;
+ if (!context)
+ return empty_vector;
+ return *static_cast<std::vector<cc::mojom::SharedBitmapInfoPtr>*>(context);
+ }
+
+ static void* SetUpContext(const cc::CompositorFrameMetadata& metadata) {
+ if (metadata.shared_bitmaps_to_register.empty())
+ return nullptr;
+ auto* result = new std::vector<cc::mojom::SharedBitmapInfoPtr>();
+ for (const auto& info : metadata.shared_bitmaps_to_register) {
+ mojo::ScopedSharedBufferHandle buffer_handle = mojo::WrapSharedMemoryHandle(
+ info.handle, info.size, true /* read_only */);
+ DCHECK(buffer_handle.is_valid());
+ result->push_back(cc::mojom::SharedBitmapInfo::New(std::move(buffer_handle), info.id));
+ }
+ return result;
+ }
+ static void TearDownContext(const cc::CompositorFrameMetadata& metadata,
+ void* context) {
+ if (context)
+ delete static_cast<std::vector<cc::mojom::SharedBitmapInfoPtr>*>(context);
+ }
+
static bool Read(cc::mojom::CompositorFrameMetadataDataView data,
cc::CompositorFrameMetadata* out);
};
« no previous file with comments | « cc/ipc/compositor_frame_metadata.mojom ('k') | cc/ipc/compositor_frame_metadata_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698