Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / ActiveDOMObject.h
index 67b5e82..4690c91 100644 (file)
@@ -29,9 +29,8 @@
 
 #include "core/dom/ContextLifecycleObserver.h"
 #include "wtf/Assertions.h"
-#include "wtf/Forward.h"
 
-namespace WebCore {
+namespace blink {
 
 class ActiveDOMObject : public ContextLifecycleObserver {
 public:
@@ -40,40 +39,31 @@ public:
     // suspendIfNeeded() should be called exactly once after object construction to synchronize
     // the suspend state with that in ExecutionContext.
     void suspendIfNeeded();
-#if !ASSERT_DISABLED
+#if ENABLE(ASSERT)
     bool suspendIfNeededCalled() const { return m_suspendIfNeededCalled; }
 #endif
 
+    // Should return true if there's any pending asynchronous activity, and so
+    // this object must not be garbage collected.
     virtual bool hasPendingActivity() const;
 
+    // These methods have an empty default implementation so that subclasses
+    // which don't need special treatment can skip implementation.
     virtual void suspend();
     virtual void resume();
     virtual void stop();
 
-    template<class T> void setPendingActivity(T* thisObject)
-    {
-        ASSERT(thisObject == this);
-        thisObject->ref();
-        m_pendingActivityCount++;
-    }
-
-    template<class T> void unsetPendingActivity(T* thisObject)
-    {
-        ASSERT(m_pendingActivityCount > 0);
-        --m_pendingActivityCount;
-        thisObject->deref();
-    }
+    void didMoveToNewExecutionContext(ExecutionContext*);
 
 protected:
     virtual ~ActiveDOMObject();
 
 private:
-    unsigned m_pendingActivityCount;
-#if !ASSERT_DISABLED
+#if ENABLE(ASSERT)
     bool m_suspendIfNeededCalled;
 #endif
 };
 
-} // namespace WebCore
+} // namespace blink
 
 #endif // ActiveDOMObject_h