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

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

Issue 2654693003: Decouple GpuCompositorFrameSink from DisplayCompositor (Closed)
Patch Set: Fix msvs c4275 warning with NON_EXPORTED_BASE Created 3 years, 10 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_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) {
kylechar 2017/01/25 15:54:33 Get rid of {} since the loop body is only one line
232 AddSurfaceReference(reference.parent_id(), reference.child_id());
233 }
234 }
235
236 void SurfaceManager::RemoveSurfaceReferences(
237 const std::vector<SurfaceReference>& references) {
238 DCHECK(thread_checker_.CalledOnValidThread());
239
240 // TODO(kylechar): Each remove reference can trigger GC, it would be better if
kylechar 2017/01/25 15:54:33 We can easily make this comment a reality now. Run
241 // we GC only once if removing multiple references.
242 for (const auto& reference : references) {
kylechar 2017/01/25 15:54:33 Get rid of {} since the loop body is only one line
243 RemoveSurfaceReference(reference.parent_id(), reference.child_id());
244 }
245 }
246
227 size_t SurfaceManager::GetSurfaceReferenceCount( 247 size_t SurfaceManager::GetSurfaceReferenceCount(
228 const SurfaceId& surface_id) const { 248 const SurfaceId& surface_id) const {
229 auto iter = child_to_parent_refs_.find(surface_id); 249 auto iter = child_to_parent_refs_.find(surface_id);
230 if (iter == child_to_parent_refs_.end()) 250 if (iter == child_to_parent_refs_.end())
231 return 0; 251 return 0;
232 return iter->second.size(); 252 return iter->second.size();
233 } 253 }
234 254
235 size_t SurfaceManager::GetReferencedSurfaceCount( 255 size_t SurfaceManager::GetReferencedSurfaceCount(
236 const SurfaceId& surface_id) const { 256 const SurfaceId& surface_id) const {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); 646 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end());
627 std::sort(children.begin(), children.end()); 647 std::sort(children.begin(), children.end());
628 648
629 for (const SurfaceId& child_id : children) 649 for (const SurfaceId& child_id : children)
630 SurfaceReferencesToStringImpl(child_id, indent + " ", str); 650 SurfaceReferencesToStringImpl(child_id, indent + " ", str);
631 } 651 }
632 } 652 }
633 #endif // DCHECK_IS_ON() 653 #endif // DCHECK_IS_ON()
634 654
635 } // namespace cc 655 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698