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

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

Issue 2938833002: Add SurfaceWillDraw notification (Closed)
Patch Set: add unit test to verify that OnSurfaceWillDraw is called only for surfaces added to the CompositorF… Created 3 years, 6 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_observer.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 <algorithm> 10 #include <algorithm>
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 void SurfaceManager::DestroySurface(std::unique_ptr<Surface> surface) { 121 void SurfaceManager::DestroySurface(std::unique_ptr<Surface> surface) {
122 DCHECK(thread_checker_.CalledOnValidThread()); 122 DCHECK(thread_checker_.CalledOnValidThread());
123 surface->set_destroyed(true); 123 surface->set_destroyed(true);
124 for (auto& observer : observer_list_) 124 for (auto& observer : observer_list_)
125 observer.OnSurfaceDestroyed(surface->surface_id()); 125 observer.OnSurfaceDestroyed(surface->surface_id());
126 surfaces_to_destroy_.push_back(std::move(surface)); 126 surfaces_to_destroy_.push_back(std::move(surface));
127 GarbageCollectSurfaces(); 127 GarbageCollectSurfaces();
128 } 128 }
129 129
130 void SurfaceManager::SurfaceWillDraw(const SurfaceId& surface_id) {
131 DCHECK(thread_checker_.CalledOnValidThread());
132 for (auto& observer : observer_list_)
133 observer.OnSurfaceWillDraw(surface_id);
134 }
135
130 void SurfaceManager::RequireSequence(const SurfaceId& surface_id, 136 void SurfaceManager::RequireSequence(const SurfaceId& surface_id,
131 const SurfaceSequence& sequence) { 137 const SurfaceSequence& sequence) {
132 auto* surface = GetSurfaceForId(surface_id); 138 auto* surface = GetSurfaceForId(surface_id);
133 if (!surface) { 139 if (!surface) {
134 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; 140 DLOG(ERROR) << "Attempting to require callback on nonexistent surface";
135 return; 141 return;
136 } 142 }
137 surface->AddDestructionDependency(sequence); 143 surface->AddDestructionDependency(sequence);
138 } 144 }
139 145
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 *str << "\n"; 565 *str << "\n";
560 566
561 // If the current surface has references to children, sort children and print 567 // If the current surface has references to children, sort children and print
562 // references for each child. 568 // references for each child.
563 for (const SurfaceId& child_id : GetSurfacesReferencedByParent(surface_id)) 569 for (const SurfaceId& child_id : GetSurfacesReferencedByParent(surface_id))
564 SurfaceReferencesToStringImpl(child_id, indent + " ", str); 570 SurfaceReferencesToStringImpl(child_id, indent + " ", str);
565 } 571 }
566 #endif // DCHECK_IS_ON() 572 #endif // DCHECK_IS_ON()
567 573
568 } // namespace cc 574 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_manager.h ('k') | cc/surfaces/surface_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698