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

Unified Diff: cc/surfaces/surface_manager.h

Issue 553213003: Avoid destroying surface before the parent surface stops referencing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « cc/surfaces/surface_id_allocator.h ('k') | cc/surfaces/surface_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_manager.h
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h
index 7515be51fdaf2d9dac42cc388447428f4fb5bfb8..66db9d90ee38df8e10e604dd75463ab3d6644f97 100644
--- a/cc/surfaces/surface_manager.h
+++ b/cc/surfaces/surface_manager.h
@@ -5,12 +5,17 @@
#ifndef CC_SURFACES_SURFACE_MANAGER_H_
#define CC_SURFACES_SURFACE_MANAGER_H_
+#include <list>
+#include <set>
+#include <vector>
+
#include "base/containers/hash_tables.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
#include "cc/surfaces/surface_damage_observer.h"
#include "cc/surfaces/surface_id.h"
+#include "cc/surfaces/surface_sequence.h"
#include "cc/surfaces/surfaces_export.h"
namespace cc {
@@ -25,6 +30,10 @@ class CC_SURFACES_EXPORT SurfaceManager {
void RegisterSurface(Surface* surface);
void DeregisterSurface(SurfaceId surface_id);
+ // Destroy the Surface once a set of sequence numbers has been satisfied.
+ void DestroyOnSequence(scoped_ptr<Surface> surface,
+ const std::set<SurfaceSequence>& dependency_set);
+
Surface* GetSurfaceForId(SurfaceId surface_id);
void AddObserver(SurfaceDamageObserver* obs) {
@@ -37,12 +46,27 @@ class CC_SURFACES_EXPORT SurfaceManager {
void SurfaceModified(SurfaceId surface_id);
+ // A frame for a surface satisfies a set of sequence numbers.
+ void DidSatisfySequences(SurfaceId id, std::vector<uint32_t>* sequence);
+
private:
+ void SearchForSatisfaction();
+
typedef base::hash_map<SurfaceId, Surface*> SurfaceMap;
SurfaceMap surface_map_;
ObserverList<SurfaceDamageObserver> observer_list_;
base::ThreadChecker thread_checker_;
+ // List of surfaces to be destroyed, along with what sequences they're still
+ // waiting on.
+ typedef std::list<std::pair<Surface*, std::set<SurfaceSequence>>>
+ SurfaceDestroyList;
+ SurfaceDestroyList surfaces_to_destroy_;
+
+ // Set of SurfaceSequences that have been satisfied by a frame but not yet
+ // waited on.
+ std::set<SurfaceSequence> satisfied_sequences_;
+
DISALLOW_COPY_AND_ASSIGN(SurfaceManager);
};
« no previous file with comments | « cc/surfaces/surface_id_allocator.h ('k') | cc/surfaces/surface_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698