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

Side by Side Diff: components/viz/frame_sinks/gpu_compositor_frame_sink.cc

Issue 2878113002: mus: Embedder can request and observe BeginFrame for embedded client. (Closed)
Patch Set: . 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/viz/frame_sinks/gpu_compositor_frame_sink.h" 5 #include "components/viz/frame_sinks/gpu_compositor_frame_sink.h"
6 6
7 namespace viz { 7 namespace viz {
8 8
9 GpuCompositorFrameSink::GpuCompositorFrameSink( 9 GpuCompositorFrameSink::GpuCompositorFrameSink(
10 GpuCompositorFrameSinkDelegate* delegate, 10 GpuCompositorFrameSinkDelegate* delegate,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 void GpuCompositorFrameSink::ClaimTemporaryReference( 64 void GpuCompositorFrameSink::ClaimTemporaryReference(
65 const cc::SurfaceId& surface_id) { 65 const cc::SurfaceId& surface_id) {
66 support_->ClaimTemporaryReference(surface_id); 66 support_->ClaimTemporaryReference(surface_id);
67 } 67 }
68 68
69 void GpuCompositorFrameSink::RequestCopyOfSurface( 69 void GpuCompositorFrameSink::RequestCopyOfSurface(
70 std::unique_ptr<cc::CopyOutputRequest> request) { 70 std::unique_ptr<cc::CopyOutputRequest> request) {
71 support_->RequestCopyOfSurface(std::move(request)); 71 support_->RequestCopyOfSurface(std::move(request));
72 } 72 }
73 73
74 void GpuCompositorFrameSink::RequestBeginFrames(
75 cc::mojom::FrameSinkObserverPtr observer) {
76 observer_ = std::move(observer);
77 }
78
74 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { 79 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) {
75 if (client_) 80 if (client_)
76 client_->OnBeginFrame(args); 81 client_->OnBeginFrame(args);
82 if (observer_.is_bound())
83 observer_->OnBeginFrame();
77 } 84 }
78 85
79 void GpuCompositorFrameSink::ReclaimResources( 86 void GpuCompositorFrameSink::ReclaimResources(
80 const cc::ReturnedResourceArray& resources) { 87 const cc::ReturnedResourceArray& resources) {
81 if (client_) 88 if (client_)
82 client_->ReclaimResources(resources); 89 client_->ReclaimResources(resources);
83 } 90 }
84 91
85 void GpuCompositorFrameSink::WillDrawSurface( 92 void GpuCompositorFrameSink::WillDrawSurface(
86 const cc::LocalSurfaceId& local_surface_id, 93 const cc::LocalSurfaceId& local_surface_id,
87 const gfx::Rect& damage_rect) {} 94 const gfx::Rect& damage_rect) {}
88 95
89 void GpuCompositorFrameSink::OnClientConnectionLost() { 96 void GpuCompositorFrameSink::OnClientConnectionLost() {
90 client_connection_lost_ = true; 97 client_connection_lost_ = true;
91 // Request destruction of |this| only if both connections are lost. 98 // Request destruction of |this| only if both connections are lost.
92 delegate_->OnClientConnectionLost(support_->frame_sink_id(), 99 delegate_->OnClientConnectionLost(support_->frame_sink_id(),
93 private_connection_lost_); 100 private_connection_lost_);
94 } 101 }
95 102
96 void GpuCompositorFrameSink::OnPrivateConnectionLost() { 103 void GpuCompositorFrameSink::OnPrivateConnectionLost() {
97 private_connection_lost_ = true; 104 private_connection_lost_ = true;
98 // Request destruction of |this| only if both connections are lost. 105 // Request destruction of |this| only if both connections are lost.
99 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(), 106 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(),
100 client_connection_lost_); 107 client_connection_lost_);
101 } 108 }
102 109
103 } // namespace viz 110 } // namespace viz
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698