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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/surface_manager.cc
diff --git a/cc/surfaces/surface_manager.cc b/cc/surfaces/surface_manager.cc
index 94bdac6aceaf9382966fc5dedcc45262303c0837..8d924c2189b723b0491879a7a4b6e76e6ed0e872 100644
--- a/cc/surfaces/surface_manager.cc
+++ b/cc/surfaces/surface_manager.cc
@@ -224,6 +224,26 @@ void SurfaceManager::RemoveSurfaceReference(const SurfaceId& parent_id,
GarbageCollectSurfaces();
}
+void SurfaceManager::AddSurfaceReferences(
+ const std::vector<SurfaceReference>& references) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ for (const auto& reference : references) {
kylechar 2017/01/25 15:54:33 Get rid of {} since the loop body is only one line
+ AddSurfaceReference(reference.parent_id(), reference.child_id());
+ }
+}
+
+void SurfaceManager::RemoveSurfaceReferences(
+ const std::vector<SurfaceReference>& references) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ // 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
+ // we GC only once if removing multiple references.
+ for (const auto& reference : references) {
kylechar 2017/01/25 15:54:33 Get rid of {} since the loop body is only one line
+ RemoveSurfaceReference(reference.parent_id(), reference.child_id());
+ }
+}
+
size_t SurfaceManager::GetSurfaceReferenceCount(
const SurfaceId& surface_id) const {
auto iter = child_to_parent_refs_.find(surface_id);

Powered by Google App Engine
This is Rietveld 408576698