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

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

Issue 2890913002: Add CompositorFrameSinkClientBinding To Be Used By FrameGenerator (Closed)
Patch Set: FrameGenerator::SetNeedsBeginFrame 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..4867dab850cb27fb2b44d60ad0b30f4a0e573887
--- /dev/null
+++ b/services/ui/ws/compositor_frame_sink_client_binding.cc
@@ -0,0 +1,53 @@
+// 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::SetNeedsBeginFrame(
+ bool needs_begin_frame) {
+ compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frame);
+}
+
+void DefaultCompositorFrameSinkClientBinding::SubmitCompositorFrame(
+ const cc::LocalSurfaceId& local_surface_id,
+ cc::CompositorFrame frame) {
+ if (local_surface_id != local_surface_id_) {
+ local_surface_id_ = local_surface_id;
+ gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
+ 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);
+}
+
+void DefaultCompositorFrameSinkClientBinding::BeginFrameDidNotSwap(
+ const cc::BeginFrameAck& ack) {
+ compositor_frame_sink_->BeginFrameDidNotSwap(ack);
+}
+
+void DefaultCompositorFrameSinkClientBinding::EvictCurrentSurface() {
+ compositor_frame_sink_->EvictCurrentSurface();
+}
+
+} // namespace ws
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698