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

Side by Side Diff: services/ui/surfaces/gpu_compositor_frame_sink.cc

Issue 2541683004: Add/remove surface references via MojoCompositorFrameSink. (Closed)
Patch Set: WIP Created 4 years 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
« no previous file with comments | « services/ui/surfaces/gpu_compositor_frame_sink.h ('k') | services/ui/ws/frame_generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "services/ui/surfaces/gpu_compositor_frame_sink.h" 5 #include "services/ui/surfaces/gpu_compositor_frame_sink.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 surface_factory_.SubmitCompositorFrame( 90 surface_factory_.SubmitCompositorFrame(
91 local_frame_id_, std::move(frame), 91 local_frame_id_, std::move(frame),
92 base::Bind(&GpuCompositorFrameSink::DidReceiveCompositorFrameAck, 92 base::Bind(&GpuCompositorFrameSink::DidReceiveCompositorFrameAck,
93 weak_factory_.GetWeakPtr())); 93 weak_factory_.GetWeakPtr()));
94 if (display_) { 94 if (display_) {
95 display_->SetLocalFrameId(local_frame_id_, 95 display_->SetLocalFrameId(local_frame_id_,
96 frame.metadata.device_scale_factor); 96 frame.metadata.device_scale_factor);
97 } 97 }
98 } 98 }
99 99
100 void GpuCompositorFrameSink::AddSurfaceReferences(
101 const std::vector<cc::SurfaceReference>& references) {
102 for (auto& ref : references)
103 display_compositor_->AddSurfaceReference(ref);
Fady Samuel 2016/12/04 23:30:12 I'd love to see this added to CompositorFrameSinkS
kylechar 2016/12/05 20:26:45 CompositorFrameSinkSupport doesn't have access to
104 }
105
106 void GpuCompositorFrameSink::RemoveSurfaceReferences(
107 const std::vector<cc::SurfaceReference>& references) {
108 for (auto& ref : references)
109 display_compositor_->RemoveSurfaceReference(ref);
110 }
111
100 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() { 112 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() {
101 if (!client_) 113 if (!client_)
102 return; 114 return;
103 client_->DidReceiveCompositorFrameAck(); 115 client_->DidReceiveCompositorFrameAck();
104 DCHECK_GT(ack_pending_count_, 0); 116 DCHECK_GT(ack_pending_count_, 0);
105 if (!surface_returned_resources_.empty()) { 117 if (!surface_returned_resources_.empty()) {
106 client_->ReclaimResources(surface_returned_resources_); 118 client_->ReclaimResources(surface_returned_resources_);
107 surface_returned_resources_.clear(); 119 surface_returned_resources_.clear();
108 } 120 }
109 ack_pending_count_--; 121 ack_pending_count_--;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 248 }
237 249
238 void GpuCompositorFrameSink::OnPrivateConnectionLost() { 250 void GpuCompositorFrameSink::OnPrivateConnectionLost() {
239 private_connection_lost_ = true; 251 private_connection_lost_ = true;
240 // Request destruction of |this| only if both connections are lost. 252 // Request destruction of |this| only if both connections are lost.
241 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( 253 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost(
242 frame_sink_id_, client_connection_lost_); 254 frame_sink_id_, client_connection_lost_);
243 } 255 }
244 256
245 } // namespace ui 257 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/gpu_compositor_frame_sink.h ('k') | services/ui/ws/frame_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698