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

Side by Side Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2551083003: Add Satisfy() and Require() to MojoCompositorFrameSink (Closed)
Patch Set: Rebase; changed LOG to DLOG 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "cc/surfaces/compositor_frame_sink_support.h" 5 #include "cc/surfaces/compositor_frame_sink_support.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/scheduler/begin_frame_source.h" 8 #include "cc/scheduler/begin_frame_source.h"
9 #include "cc/surfaces/compositor_frame_sink_support_client.h" 9 #include "cc/surfaces/compositor_frame_sink_support_client.h"
10 #include "cc/surfaces/display.h" 10 #include "cc/surfaces/display.h"
11 #include "cc/surfaces/surface.h"
11 #include "cc/surfaces/surface_manager.h" 12 #include "cc/surfaces/surface_manager.h"
12 13
13 namespace cc { 14 namespace cc {
14 15
15 CompositorFrameSinkSupport::CompositorFrameSinkSupport( 16 CompositorFrameSinkSupport::CompositorFrameSinkSupport(
16 CompositorFrameSinkSupportClient* client, 17 CompositorFrameSinkSupportClient* client,
17 SurfaceManager* surface_manager, 18 SurfaceManager* surface_manager,
18 const FrameSinkId& frame_sink_id, 19 const FrameSinkId& frame_sink_id,
19 std::unique_ptr<Display> display) 20 std::unique_ptr<Display> display)
20 : client_(client), 21 : client_(client),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 surface_factory_.SubmitCompositorFrame( 77 surface_factory_.SubmitCompositorFrame(
77 local_frame_id_, std::move(frame), 78 local_frame_id_, std::move(frame),
78 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, 79 base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck,
79 weak_factory_.GetWeakPtr())); 80 weak_factory_.GetWeakPtr()));
80 if (display_) { 81 if (display_) {
81 display_->SetLocalFrameId(local_frame_id_, 82 display_->SetLocalFrameId(local_frame_id_,
82 frame.metadata.device_scale_factor); 83 frame.metadata.device_scale_factor);
83 } 84 }
84 } 85 }
85 86
87 void CompositorFrameSinkSupport::Require(const LocalFrameId& local_frame_id,
88 const SurfaceSequence& sequence) {
89 Surface* surface = surface_manager_->GetSurfaceForId(
90 SurfaceId(frame_sink_id_, local_frame_id));
91 if (!surface) {
92 DLOG(ERROR) << "Attempting to require callback on nonexistent surface";
93 return;
94 }
95 surface->AddDestructionDependency(sequence);
96 }
97
98 void CompositorFrameSinkSupport::Satisfy(const SurfaceSequence& sequence) {
99 std::vector<uint32_t> sequences = {sequence.sequence};
100 surface_manager_->DidSatisfySequences(sequence.frame_sink_id, &sequences);
101 }
102
86 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() { 103 void CompositorFrameSinkSupport::DidReceiveCompositorFrameAck() {
87 DCHECK_GT(ack_pending_count_, 0); 104 DCHECK_GT(ack_pending_count_, 0);
88 ack_pending_count_--; 105 ack_pending_count_--;
89 106
90 if (!client_) 107 if (!client_)
91 return; 108 return;
92 client_->DidReceiveCompositorFrameAck(); 109 client_->DidReceiveCompositorFrameAck();
93 if (!surface_returned_resources_.empty()) { 110 if (!surface_returned_resources_.empty()) {
94 client_->ReclaimResources(surface_returned_resources_); 111 client_->ReclaimResources(surface_returned_resources_);
95 surface_returned_resources_.clear(); 112 surface_returned_resources_.clear();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return; 191 return;
175 192
176 added_frame_observer_ = needs_begin_frame_; 193 added_frame_observer_ = needs_begin_frame_;
177 if (needs_begin_frame_) 194 if (needs_begin_frame_)
178 begin_frame_source_->AddObserver(this); 195 begin_frame_source_->AddObserver(this);
179 else 196 else
180 begin_frame_source_->RemoveObserver(this); 197 begin_frame_source_->RemoveObserver(this);
181 } 198 }
182 199
183 } // namespace cc 200 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.h ('k') | content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698