| 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
|
|
|