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

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

Issue 2651213004: Revert of Decouple GpuCompositorFrameSink from DisplayCompositor (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « cc/surfaces/surface_manager.h ('k') | cc/surfaces/surface_reference_manager.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 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_manager.h" 5 #include "cc/surfaces/surface_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 parent_to_child_refs_[parent_id].count(child_id) == 0) { 217 parent_to_child_refs_[parent_id].count(child_id) == 0) {
218 DLOG(ERROR) << "No reference from " << parent_id.ToString() << " to " 218 DLOG(ERROR) << "No reference from " << parent_id.ToString() << " to "
219 << child_id.ToString(); 219 << child_id.ToString();
220 return; 220 return;
221 } 221 }
222 222
223 RemoveSurfaceReferenceImpl(parent_id, child_id); 223 RemoveSurfaceReferenceImpl(parent_id, child_id);
224 GarbageCollectSurfaces(); 224 GarbageCollectSurfaces();
225 } 225 }
226 226
227 void SurfaceManager::AddSurfaceReferences(
228 const std::vector<SurfaceReference>& references) {
229 DCHECK(thread_checker_.CalledOnValidThread());
230
231 for (const auto& reference : references)
232 AddSurfaceReference(reference.parent_id(), reference.child_id());
233 }
234
235 void SurfaceManager::RemoveSurfaceReferences(
236 const std::vector<SurfaceReference>& references) {
237 DCHECK(thread_checker_.CalledOnValidThread());
238
239 // TODO(kylechar): Each remove reference can trigger GC, it would be better if
240 // we GC only once if removing multiple references.
241 for (const auto& reference : references)
242 RemoveSurfaceReference(reference.parent_id(), reference.child_id());
243 }
244
245 size_t SurfaceManager::GetSurfaceReferenceCount( 227 size_t SurfaceManager::GetSurfaceReferenceCount(
246 const SurfaceId& surface_id) const { 228 const SurfaceId& surface_id) const {
247 auto iter = child_to_parent_refs_.find(surface_id); 229 auto iter = child_to_parent_refs_.find(surface_id);
248 if (iter == child_to_parent_refs_.end()) 230 if (iter == child_to_parent_refs_.end())
249 return 0; 231 return 0;
250 return iter->second.size(); 232 return iter->second.size();
251 } 233 }
252 234
253 size_t SurfaceManager::GetReferencedSurfaceCount( 235 size_t SurfaceManager::GetReferencedSurfaceCount(
254 const SurfaceId& surface_id) const { 236 const SurfaceId& surface_id) const {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); 626 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end());
645 std::sort(children.begin(), children.end()); 627 std::sort(children.begin(), children.end());
646 628
647 for (const SurfaceId& child_id : children) 629 for (const SurfaceId& child_id : children)
648 SurfaceReferencesToStringImpl(child_id, indent + " ", str); 630 SurfaceReferencesToStringImpl(child_id, indent + " ", str);
649 } 631 }
650 } 632 }
651 #endif // DCHECK_IS_ON() 633 #endif // DCHECK_IS_ON()
652 634
653 } // namespace cc 635 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_manager.h ('k') | cc/surfaces/surface_reference_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698