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

Unified Diff: cc/surfaces/surface_factory.h

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month 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.cc ('k') | cc/surfaces/surface_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_factory.h
diff --git a/cc/surfaces/surface_factory.h b/cc/surfaces/surface_factory.h
index f392db20f23df6655efe21074abedfe1c446eddb..3a6431596bc9cc470e8ef4fdbae1520988543e14 100644
--- a/cc/surfaces/surface_factory.h
+++ b/cc/surfaces/surface_factory.h
@@ -35,8 +35,7 @@ class SurfaceManager;
// submitted to frames created by a particular factory will be returned to that
// factory's client when they are no longer being used. This is the only class
// most users of surfaces will need to directly interact with.
-class CC_SURFACES_EXPORT SurfaceFactory
- : public base::SupportsWeakPtr<SurfaceFactory> {
+class CC_SURFACES_EXPORT SurfaceFactory {
public:
using DrawCallback = base::Callback<void()>;
@@ -49,8 +48,14 @@ class CC_SURFACES_EXPORT SurfaceFactory
void Create(const LocalFrameId& local_frame_id);
void Destroy(const LocalFrameId& local_frame_id);
+
+ // Destroys all surfaces.
void DestroyAll();
+ // Destroys and disown all surfaces, and reset all resource references. This
+ // is useful when resources are invalid (e.g. lost context).
+ void Reset();
+
// Set that the current frame on new_id is to be treated as the successor to
// the current frame on old_id for the purposes of calculating damage.
void SetPreviousFrameSurface(const LocalFrameId& new_id,
@@ -98,6 +103,8 @@ class CC_SURFACES_EXPORT SurfaceFactory
unordered_map<LocalFrameId, std::unique_ptr<Surface>, LocalFrameIdHash>;
OwningSurfaceMap surface_map_;
+ base::WeakPtrFactory<SurfaceFactory> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SurfaceFactory);
};
« no previous file with comments | « cc/surfaces/surface.cc ('k') | cc/surfaces/surface_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698