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

Unified Diff: Source/core/dom/SimpleLifecycleContext.h

Issue 18777003: Extract simpler classes for observing context lifecycle and observe Page lifecycle inNavigatorVibra… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use SimpleLifecycleObserver in addObserver / removeObserver. Created 7 years, 5 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: Source/core/dom/SimpleLifecycleContext.h
diff --git a/Source/core/html/canvas/WebGLContextObject.h b/Source/core/dom/SimpleLifecycleContext.h
similarity index 59%
copy from Source/core/html/canvas/WebGLContextObject.h
copy to Source/core/dom/SimpleLifecycleContext.h
index 1e4d29657542e6edad0615290fffeb2f6e308a98..6557ec746f93264cfffefd7388e8a3ea7965ff47 100644
--- a/Source/core/html/canvas/WebGLContextObject.h
+++ b/Source/core/dom/SimpleLifecycleContext.h
@@ -1,5 +1,6 @@
+
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -21,47 +22,44 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
*/
-#ifndef WebGLContextObject_h
-#define WebGLContextObject_h
+#ifndef SimpleLifecycleContext_h
+#define SimpleLifecycleContext_h
-#include "core/html/canvas/WebGLObject.h"
+#include "core/dom/SimpleLifecycleObserver.h"
+#include "wtf/HashSet.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
namespace WebCore {
-class GraphicsContext3D;
-class WebGLRenderingContext;
+class SimpleLifecycleNotifier;
+class SimpleLifecycleObserver;
-// WebGLContextObject the base class for objects that are owned by a specific
-// WebGLRenderingContext.
-class WebGLContextObject : public WebGLObject {
+class SimpleLifecycleContext {
public:
- virtual ~WebGLContextObject();
+ SimpleLifecycleContext();
+ virtual ~SimpleLifecycleContext();
- WebGLRenderingContext* context() const { return m_context; }
+ virtual bool isContextThread() const { return true; }
- virtual bool validate(const WebGLContextGroup*, const WebGLRenderingContext* context) const
- {
- return context == m_context;
- }
+ // Called from the constructor of observers.
+ void wasObservedBy(SimpleLifecycleObserver*, SimpleLifecycleObserver::Type);
- void detachContext();
+ // Called from the destructor of observers.
+ void wasUnobservedBy(SimpleLifecycleObserver*, SimpleLifecycleObserver::Type);
protected:
- WebGLContextObject(WebGLRenderingContext*);
-
- virtual bool hasGroupOrContext() const
- {
- return m_context;
- }
-
- virtual GraphicsContext3D* getAGraphicsContext3D() const;
+ SimpleLifecycleNotifier* lifecycleNotifier();
private:
- WebGLRenderingContext* m_context;
+ virtual PassOwnPtr<SimpleLifecycleNotifier> createLifecycleNotifier();
+
+ OwnPtr<SimpleLifecycleNotifier> m_lifecycleNotifier;
};
} // namespace WebCore
-#endif // WebGLContextObject_h
+#endif // SimpleLifecycleContext_h

Powered by Google App Engine
This is Rietveld 408576698