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

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

Issue 2811813004: Surface Synchronization: Distinguish between dependencies and references (Closed)
Patch Set: Addressed Vlad's comments Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surface.h" 5 #include "cc/surfaces/surface.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Receive and track the resources referenced from the CompositorFrame 67 // Receive and track the resources referenced from the CompositorFrame
68 // regardless of whether it's pending or active. 68 // regardless of whether it's pending or active.
69 factory_->ReceiveFromChild(frame.resource_list); 69 factory_->ReceiveFromChild(frame.resource_list);
70 70
71 if (!blocking_surfaces_.empty()) { 71 if (!blocking_surfaces_.empty()) {
72 pending_frame_ = std::move(frame); 72 pending_frame_ = std::move(frame);
73 // Ask the surface manager to inform |this| when its dependencies are 73 // Ask the surface manager to inform |this| when its dependencies are
74 // resolved. 74 // resolved.
75 factory_->manager()->RequestSurfaceResolution(this); 75 factory_->manager()->RequestSurfaceResolution(this);
76
77 // We do not have to notify observers that referenced surfaces have changed
78 // in the else case because ActivateFrame will notify observers.
79 for (auto& observer : observers_) {
80 observer.OnReferencedSurfacesChanged(this, active_referenced_surfaces(),
81 pending_referenced_surfaces());
82 }
83 } else { 76 } else {
84 // If there are no blockers, then immediately activate the frame. 77 // If there are no blockers, then immediately activate the frame.
85 ActivateFrame(std::move(frame)); 78 ActivateFrame(std::move(frame));
86 } 79 }
87 80
88 // Returns resources for the previous pending frame. 81 // Returns resources for the previous pending frame.
89 if (previous_pending_frame) 82 if (previous_pending_frame)
90 UnrefFrameResources(*previous_pending_frame); 83 UnrefFrameResources(*previous_pending_frame);
91 84
92 if (!draw_callback_.is_null()) 85 if (!draw_callback_.is_null())
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (!active_frame_->render_pass_list.empty()) 183 if (!active_frame_->render_pass_list.empty())
191 ++frame_index_; 184 ++frame_index_;
192 185
193 previous_frame_surface_id_ = surface_id(); 186 previous_frame_surface_id_ = surface_id();
194 187
195 if (previous_frame) 188 if (previous_frame)
196 UnrefFrameResources(*previous_frame); 189 UnrefFrameResources(*previous_frame);
197 190
198 for (auto& observer : observers_) 191 for (auto& observer : observers_)
199 observer.OnSurfaceActivated(this); 192 observer.OnSurfaceActivated(this);
200
201 for (auto& observer : observers_) {
202 observer.OnReferencedSurfacesChanged(this, active_referenced_surfaces(),
203 pending_referenced_surfaces());
204 }
205 } 193 }
206 194
207 void Surface::UpdateBlockingSurfaces( 195 void Surface::UpdateBlockingSurfaces(
208 const base::Optional<CompositorFrame>& previous_pending_frame, 196 const base::Optional<CompositorFrame>& previous_pending_frame,
209 const CompositorFrame& current_frame) { 197 const CompositorFrame& current_frame) {
210 // If there is no SurfaceDependencyTracker installed then the |current_frame| 198 // If there is no SurfaceDependencyTracker installed then the |current_frame|
211 // does not block on anything. 199 // does not block on anything.
212 if (!factory_->manager()->dependency_tracker()) { 200 if (!factory_->manager()->dependency_tracker()) {
213 blocking_surfaces_.clear(); 201 blocking_surfaces_.clear();
214 return; 202 return;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 frame->metadata.latency_info.swap(*latency_info); 326 frame->metadata.latency_info.swap(*latency_info);
339 return; 327 return;
340 } 328 }
341 std::copy(frame->metadata.latency_info.begin(), 329 std::copy(frame->metadata.latency_info.begin(),
342 frame->metadata.latency_info.end(), 330 frame->metadata.latency_info.end(),
343 std::back_inserter(*latency_info)); 331 std::back_inserter(*latency_info));
344 frame->metadata.latency_info.clear(); 332 frame->metadata.latency_info.clear();
345 } 333 }
346 334
347 } // namespace cc 335 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698