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

Unified Diff: ui/compositor/compositor.h

Issue 2083853002: exo: Recreate Surface resources on context lost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix browser test Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/compositor/compositor.h
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index a6245dae5afdc34756adb3b416c6415d3503bd12..a703d61cac1ff24a264aef01f0ec043e4535807f 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -69,11 +69,25 @@ class Texture;
const int kCompositorLockTimeoutMs = 67;
+class COMPOSITOR_EXPORT ContextFactoryObserver {
+ public:
+ virtual ~ContextFactoryObserver() {}
+
+ // Notifies that the ContextProvider returned from
+ // ui::ContextFactory::SharedMainThreadContextProvider was lost. When this
+ // is called, the old resources (e.g. shared context, GL helper) still
+ // exist, but are about to be destroyed. Getting a reference to those
+ // resources from the ContextFactory (e.g. through
+ // SharedMainThreadContextProvider()) will return newly recreated, valid
+ // resources.
+ virtual void OnLostResources() = 0;
+};
+
// This class abstracts the creation of the 3D context for the compositor. It is
// a global object.
class COMPOSITOR_EXPORT ContextFactory {
public:
- virtual ~ContextFactory() {}
+ virtual ~ContextFactory();
// Creates an output surface for the given compositor. The factory may keep
// per-compositor data (e.g. a shared context), that needs to be cleaned up
@@ -128,6 +142,14 @@ class COMPOSITOR_EXPORT ContextFactory {
base::TimeDelta interval) = 0;
virtual void SetOutputIsSecure(Compositor* compositor, bool secure) = 0;
+
+ void AddObserver(ContextFactoryObserver* observer);
+
+ void RemoveObserver(ContextFactoryObserver* observer);
+
+ protected:
+ ContextFactory();
+ base::ObserverList<ContextFactoryObserver> observer_list_;
piman 2016/06/21 01:14:13 Can we keep this class pure virtual? I realize you
};
// This class represents a lock on the compositor, that can be used to prevent

Powered by Google App Engine
This is Rietveld 408576698