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

Unified Diff: services/ui/ws/compositor_frame_sink_client_binding.cc

Issue 2890913002: Add CompositorFrameSinkClientBinding To Be Used By FrameGenerator (Closed)
Patch Set: Address comments Created 3 years, 7 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
Index: services/ui/ws/compositor_frame_sink_client_binding.cc
diff --git a/services/ui/ws/compositor_frame_sink_client_binding.cc b/services/ui/ws/compositor_frame_sink_client_binding.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f17082907c054ac5e2f673760791e711469b6671
--- /dev/null
+++ b/services/ui/ws/compositor_frame_sink_client_binding.cc
@@ -0,0 +1,49 @@
+// 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.
+
+#include "services/ui/ws/compositor_frame_sink_client_binding.h"
+
+namespace ui {
+namespace ws {
+
+DefaultCompositorFrameSinkClientBinding::
+ DefaultCompositorFrameSinkClientBinding(
+ cc::mojom::MojoCompositorFrameSinkClient* sink_client,
+ cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request,
+ cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink,
+ cc::mojom::DisplayPrivateAssociatedPtr display_private)
+ : binding_(sink_client, std::move(sink_client_request)),
+ display_private_(std::move(display_private)),
+ compositor_frame_sink_(std::move(compositor_frame_sink)) {}
+
+DefaultCompositorFrameSinkClientBinding::
+ ~DefaultCompositorFrameSinkClientBinding() = default;
+
+void DefaultCompositorFrameSinkClientBinding::SubmitCompositorFrame(
+ cc::CompositorFrame frame) {
+ gfx::Size frame_size = last_submitted_frame_size_;
+ if (!frame.render_pass_list.empty())
+ frame_size = frame.render_pass_list.back()->output_rect.size();
+
+ if (!local_surface_id_.is_valid() ||
+ frame_size != last_submitted_frame_size_) {
+ local_surface_id_ = id_allocator_.GenerateId();
+ display_private_->ResizeDisplay(frame_size);
+ display_private_->SetLocalSurfaceId(local_surface_id_,
+ frame.metadata.device_scale_factor);
+ }
+
+ compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_,
+ std::move(frame));
+ compositor_frame_sink_->SetNeedsBeginFrame(false);
+ last_submitted_frame_size_ = frame_size;
+}
+
+void DefaultCompositorFrameSinkClientBinding::SetNeedsBeginFrame(
+ bool needs_begin_frame) {
+ compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frame);
+}
+
+} // namespace ws
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698