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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "services/ui/ws/compositor_frame_sink_client_binding.h"
6
7 namespace ui {
8 namespace ws {
9
10 DefaultCompositorFrameSinkClientBinding::
11 DefaultCompositorFrameSinkClientBinding(
12 cc::mojom::MojoCompositorFrameSinkClient* sink_client,
13 cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request,
14 cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink,
15 cc::mojom::DisplayPrivateAssociatedPtr display_private)
16 : binding_(sink_client, std::move(sink_client_request)),
17 display_private_(std::move(display_private)),
18 compositor_frame_sink_(std::move(compositor_frame_sink)) {}
19
20 DefaultCompositorFrameSinkClientBinding::
21 ~DefaultCompositorFrameSinkClientBinding() = default;
22
23 void DefaultCompositorFrameSinkClientBinding::SetNeedsBeginFrame(
24 bool needs_begin_frame) {
25 compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frame);
26 }
27
28 void DefaultCompositorFrameSinkClientBinding::SubmitCompositorFrame(
29 const cc::LocalSurfaceId& local_surface_id,
30 cc::CompositorFrame frame) {
31 if (local_surface_id != local_surface_id_) {
32 local_surface_id_ = local_surface_id;
33 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
34 display_private_->ResizeDisplay(frame_size);
35 display_private_->SetLocalSurfaceId(local_surface_id_,
36 frame.metadata.device_scale_factor);
37 }
38 compositor_frame_sink_->SubmitCompositorFrame(local_surface_id_,
39 std::move(frame));
40 compositor_frame_sink_->SetNeedsBeginFrame(false);
41 }
42
43 void DefaultCompositorFrameSinkClientBinding::BeginFrameDidNotSwap(
44 const cc::BeginFrameAck& ack) {
45 compositor_frame_sink_->BeginFrameDidNotSwap(ack);
46 }
47
48 void DefaultCompositorFrameSinkClientBinding::EvictCurrentSurface() {
49 compositor_frame_sink_->EvictCurrentSurface();
50 }
51
52 } // namespace ws
53 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698