Make ActiveDOMObject overrides private
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Aug 2013 00:21:33 +0000 (00:21 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Aug 2013 00:21:33 +0000 (00:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119352

Reviewed by Sam Weinig.

There is no need to call these through derived classes. And it's quite harmful for
anyone except for ScriptExecutionContext to call suspend/resume in particular -
ScriptExecutionContext won't know, and it will try to manage the state on its own.

* Modules/filesystem/DOMFileSystem.h:
* Modules/filesystem/FileWriter.h:
* Modules/geolocation/Geolocation.h:
* Modules/indexeddb/IDBDatabase.h:
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/IDBTransaction.h:
* Modules/mediasource/MediaSource.h:
* Modules/notifications/Notification.h:
* Modules/notifications/NotificationCenter.h:
* Modules/websockets/WebSocket.h:
* fileapi/FileReader.h:
* html/HTMLMediaElement.h:
* html/canvas/WebGLRenderingContext.h:
* page/DOMTimer.h:
* page/EventSource.h:
* page/SuspendableTimer.h:
* workers/AbstractWorker.h:
* xml/XMLHttpRequest.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153551 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/filesystem/DOMFileSystem.h
Source/WebCore/Modules/filesystem/FileWriter.h
Source/WebCore/Modules/geolocation/Geolocation.h
Source/WebCore/Modules/indexeddb/IDBDatabase.h
Source/WebCore/Modules/indexeddb/IDBRequest.h
Source/WebCore/Modules/indexeddb/IDBTransaction.h
Source/WebCore/Modules/mediasource/MediaSource.h
Source/WebCore/Modules/notifications/Notification.h
Source/WebCore/Modules/notifications/NotificationCenter.h
Source/WebCore/Modules/websockets/WebSocket.h
Source/WebCore/fileapi/FileReader.h
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/canvas/WebGLRenderingContext.h
Source/WebCore/page/DOMTimer.h
Source/WebCore/page/EventSource.h
Source/WebCore/page/SuspendableTimer.h
Source/WebCore/workers/AbstractWorker.h
Source/WebCore/xml/XMLHttpRequest.h

index 80b9f8c..074e48e 100644 (file)
@@ -1,3 +1,33 @@
+2013-07-31  Alexey Proskuryakov  <ap@apple.com>
+
+        Make ActiveDOMObject overrides private
+        https://bugs.webkit.org/show_bug.cgi?id=119352
+
+        Reviewed by Sam Weinig.
+
+        There is no need to call these through derived classes. And it's quite harmful for
+        anyone except for ScriptExecutionContext to call suspend/resume in particular -
+        ScriptExecutionContext won't know, and it will try to manage the state on its own.
+
+        * Modules/filesystem/DOMFileSystem.h:
+        * Modules/filesystem/FileWriter.h:
+        * Modules/geolocation/Geolocation.h:
+        * Modules/indexeddb/IDBDatabase.h:
+        * Modules/indexeddb/IDBRequest.h:
+        * Modules/indexeddb/IDBTransaction.h:
+        * Modules/mediasource/MediaSource.h:
+        * Modules/notifications/Notification.h:
+        * Modules/notifications/NotificationCenter.h:
+        * Modules/websockets/WebSocket.h:
+        * fileapi/FileReader.h:
+        * html/HTMLMediaElement.h:
+        * html/canvas/WebGLRenderingContext.h:
+        * page/DOMTimer.h:
+        * page/EventSource.h:
+        * page/SuspendableTimer.h:
+        * workers/AbstractWorker.h:
+        * xml/XMLHttpRequest.h:
+
 2013-07-31  Tim Horton  <timothy_horton@apple.com>
 
         Remove didFinishLoad order quirk
index 3b4ee10..ae8113f 100644 (file)
@@ -55,9 +55,7 @@ public:
     PassRefPtr<DirectoryEntry> root();
 
     // ActiveDOMObject methods.
-    virtual void stop();
-    virtual bool hasPendingActivity() const;
-    virtual void contextDestroyed();
+    virtual bool hasPendingActivity() const OVERRIDE;
 
     void createWriter(const FileEntry*, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>);
     void createFile(const FileEntry*, PassRefPtr<FileCallback>, PassRefPtr<ErrorCallback>);
@@ -76,6 +74,10 @@ public:
 private:
     DOMFileSystem(ScriptExecutionContext*, const String& name, FileSystemType, const KURL& rootURL, PassOwnPtr<AsyncFileSystem>);
 
+    // ActiveDOMObject methods.
+    virtual void stop() OVERRIDE;
+    virtual void contextDestroyed() OVERRIDE;
+
     // A helper template to schedule a callback task.
     template <typename CB, typename CBArg>
     class DispatchCallbackTask : public ScriptExecutionContext::Task {
index 0834f51..3b82027 100644 (file)
@@ -68,10 +68,6 @@ public:
     void didTruncate();
     void didFail(FileError::ErrorCode);
 
-    // ActiveDOMObject
-    virtual bool canSuspend() const;
-    virtual void stop();
-
     // EventTarget
     virtual const AtomicString& interfaceName() const;
     virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
@@ -98,6 +94,10 @@ private:
 
     virtual ~FileWriter();
 
+    // ActiveDOMObject
+    virtual bool canSuspend() const OVERRIDE;
+    virtual void stop() OVERRIDE;
+
     // EventTarget
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }
index a1bd9eb..03af449 100644 (file)
@@ -54,7 +54,6 @@ public:
     static PassRefPtr<Geolocation> create(ScriptExecutionContext*);
     ~Geolocation();
 
-    virtual void stop() OVERRIDE;
     Document* document() const;
     Frame* frame() const;
 
@@ -69,11 +68,14 @@ public:
     void setError(GeolocationError*);
 
 private:
+    explicit Geolocation(ScriptExecutionContext*);
+
     Geoposition* lastPosition();
 
-    bool isDenied() const { return m_allowGeolocation == No; }
+    // ActiveDOMObject
+    virtual void stop() OVERRIDE;
 
-    explicit Geolocation(ScriptExecutionContext*);
+    bool isDenied() const { return m_allowGeolocation == No; }
 
     Page* page() const;
 
index 6abce87..20d28d6 100644 (file)
@@ -82,7 +82,6 @@ public:
 
     // ActiveDOMObject
     virtual bool hasPendingActivity() const OVERRIDE;
-    virtual void stop() OVERRIDE;
 
     // EventTarget
     virtual const AtomicString& interfaceName() const;
@@ -112,6 +111,9 @@ public:
 private:
     IDBDatabase(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendInterface>, PassRefPtr<IDBDatabaseCallbacks>);
 
+    // ActiveDOMObject
+    virtual void stop() OVERRIDE;
+
     // EventTarget
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }
index b830640..78a4cc2 100644 (file)
@@ -96,7 +96,6 @@ public:
 
     // ActiveDOMObject
     virtual bool hasPendingActivity() const OVERRIDE;
-    virtual void stop() OVERRIDE;
 
     // EventTarget
     virtual const AtomicString& interfaceName() const;
@@ -132,6 +131,9 @@ protected:
     bool m_requestAborted; // May be aborted by transaction then receive async onsuccess; ignore vs. assert.
 
 private:
+    // ActiveDOMObject
+    virtual void stop() OVERRIDE;
+
     // EventTarget
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }
index 64ba9ee..6df077c 100644 (file)
@@ -114,8 +114,6 @@ public:
 
     // ActiveDOMObject
     virtual bool hasPendingActivity() const OVERRIDE;
-    virtual bool canSuspend() const OVERRIDE;
-    virtual void stop() OVERRIDE;
 
     using RefCounted<IDBTransaction>::ref;
     using RefCounted<IDBTransaction>::deref;
@@ -129,6 +127,10 @@ private:
     void registerOpenCursor(IDBCursor*);
     void unregisterOpenCursor(IDBCursor*);
 
+    // ActiveDOMObject
+    virtual bool canSuspend() const OVERRIDE;
+    virtual void stop() OVERRIDE;
+
     // EventTarget
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }
index 1dbcd0e..bcf935c 100644 (file)
@@ -71,7 +71,6 @@ public:
 
     // ActiveDOMObject interface
     virtual bool hasPendingActivity() const OVERRIDE;
-    virtual void stop() OVERRIDE;
 
     using RefCounted<MediaSource>::ref;
     using RefCounted<MediaSource>::deref;
@@ -79,6 +78,9 @@ public:
 private:
     explicit MediaSource(ScriptExecutionContext*);
 
+    // ActiveDOMObject interface
+    virtual void stop() OVERRIDE;
+
     virtual EventTargetData* eventTargetData() OVERRIDE;
     virtual EventTargetData* ensureEventTargetData() OVERRIDE;
 
index 01b7a4c..23bd691 100644 (file)
@@ -125,9 +125,6 @@ public:
     virtual const AtomicString& interfaceName() const;
     virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
 
-    // ActiveDOMObject interface
-    virtual void contextDestroyed();
-
     void stopLoadingIcon();
 
     // Deprecated. Use functions from NotificationCenter.
@@ -151,6 +148,9 @@ private:
 
     void setBody(const String& body) { m_body = body; }
 
+    // ActiveDOMObject interface
+    virtual void contextDestroyed() OVERRIDE;
+
     // EventTarget interface
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }
index 0aa69c3..58d0832 100644 (file)
@@ -71,11 +71,12 @@ public:
     void requestPermission(PassRefPtr<VoidCallback> = 0);
 #endif
 
-    virtual void stop() OVERRIDE;
-
 private:
     NotificationCenter(ScriptExecutionContext*, NotificationClient*);
 
+    // ActiveDOMObject
+    virtual void stop() OVERRIDE;
+
     class NotificationRequestCallback : public RefCounted<NotificationRequestCallback> {
     public:
         static PassRefPtr<NotificationRequestCallback> createAndStartTimer(NotificationCenter*, PassRefPtr<VoidCallback>);
index a7aea71..e647903 100644 (file)
@@ -100,13 +100,6 @@ public:
     virtual const AtomicString& interfaceName() const OVERRIDE;
     virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
 
-    // ActiveDOMObject functions.
-    virtual void contextDestroyed() OVERRIDE;
-    virtual bool canSuspend() const OVERRIDE;
-    virtual void suspend(ReasonForSuspension) OVERRIDE;
-    virtual void resume() OVERRIDE;
-    virtual void stop() OVERRIDE;
-
     using RefCounted<WebSocket>::ref;
     using RefCounted<WebSocket>::deref;
 
@@ -122,6 +115,13 @@ public:
 private:
     explicit WebSocket(ScriptExecutionContext*);
 
+    // ActiveDOMObject functions.
+    virtual void contextDestroyed() OVERRIDE;
+    virtual bool canSuspend() const OVERRIDE;
+    virtual void suspend(ReasonForSuspension) OVERRIDE;
+    virtual void resume() OVERRIDE;
+    virtual void stop() OVERRIDE;
+
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }
     virtual EventTargetData* eventTargetData();
index 165c892..7f2133d 100644 (file)
@@ -76,10 +76,6 @@ public:
     PassRefPtr<ArrayBuffer> arrayBufferResult() const;
     String stringResult();
 
-    // ActiveDOMObject
-    virtual bool canSuspend() const;
-    virtual void stop();
-
     // EventTarget
     virtual const AtomicString& interfaceName() const;
     virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
@@ -103,6 +99,10 @@ public:
 private:
     FileReader(ScriptExecutionContext*);
 
+    // ActiveDOMObject
+    virtual bool canSuspend() const OVERRIDE;
+    virtual void stop() OVERRIDE;
+
     // EventTarget
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }
index fa6888b..0c7b14c 100644 (file)
@@ -444,10 +444,10 @@ private:
     virtual void willStopBeingFullscreenElement();
 
     // ActiveDOMObject functions.
-    virtual bool canSuspend() const;
-    virtual void suspend(ReasonForSuspension);
-    virtual void resume();
-    virtual void stop();
+    virtual bool canSuspend() const OVERRIDE;
+    virtual void suspend(ReasonForSuspension) OVERRIDE;
+    virtual void resume() OVERRIDE;
+    virtual void stop() OVERRIDE;
     
     virtual void mediaVolumeDidChange();
 
index 78ba071..9723ca7 100644 (file)
@@ -321,11 +321,7 @@ public:
     
     unsigned getMaxVertexAttribs() const { return m_maxVertexAttribs; }
 
-    // ActiveDOMObject notifications
-    virtual bool hasPendingActivity() const;
-    virtual void stop();
-
-  private:
+private:
     friend class EXTDrawBuffers;
     friend class WebGLFramebuffer;
     friend class WebGLObject;
@@ -341,6 +337,10 @@ public:
     void initializeNewContext();
     void setupFlags();
 
+    // ActiveDOMObject
+    virtual bool hasPendingActivity() const OVERRIDE;
+    virtual void stop() OVERRIDE;
+
     void addSharedObject(WebGLSharedObject*);
     void addContextObject(WebGLContextObject*);
     void detachAndRemoveAllObjects();
index fc48cd9..46c4eca 100644 (file)
@@ -43,9 +43,6 @@ namespace WebCore {
         static int install(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int timeout, bool singleShot);
         static void removeById(ScriptExecutionContext*, int timeoutId);
 
-        // ActiveDOMObject
-        virtual void contextDestroyed() OVERRIDE;
-
         // Adjust to a change in the ScriptExecutionContext's minimum timer interval.
         // This allows the minimum allowable interval time to be changed in response
         // to events like moving a tab to the background.
@@ -55,6 +52,9 @@ namespace WebCore {
         DOMTimer(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int interval, bool singleShot);
         virtual void fired() OVERRIDE;
 
+        // ActiveDOMObject
+        virtual void contextDestroyed() OVERRIDE;
+
         // SuspendableTimer
         virtual void didStop() OVERRIDE;
 
index 7f91e7b..988b40e 100644 (file)
@@ -78,8 +78,6 @@ public:
     virtual const AtomicString& interfaceName() const;
     virtual ScriptExecutionContext* scriptExecutionContext() const;
 
-    virtual void stop();
-
 private:
     EventSource(ScriptExecutionContext*, const KURL&, const Dictionary&);
 
@@ -95,6 +93,8 @@ private:
     virtual void didFailAccessControlCheck(const ResourceError&);
     virtual void didFailRedirectCheck();
 
+    virtual void stop() OVERRIDE;
+
     void connect();
     void networkRequestEnded();
     void scheduleInitialConnect();
index dfac4a9..e0e5141 100644 (file)
@@ -37,13 +37,6 @@ public:
     explicit SuspendableTimer(ScriptExecutionContext*);
     virtual ~SuspendableTimer();
 
-    // ActiveDOMObject
-    virtual bool hasPendingActivity() const FINAL OVERRIDE;
-    virtual void stop() FINAL OVERRIDE;
-    virtual bool canSuspend() const FINAL OVERRIDE;
-    virtual void suspend(ReasonForSuspension) FINAL OVERRIDE;
-    virtual void resume() FINAL OVERRIDE;
-
     // A hook for derived classes to perform cleanup.
     virtual void didStop();
 
@@ -64,6 +57,13 @@ public:
 private:
     virtual void fired() = 0;
 
+    // ActiveDOMObject
+    virtual bool hasPendingActivity() const FINAL OVERRIDE;
+    virtual void stop() FINAL OVERRIDE;
+    virtual bool canSuspend() const FINAL OVERRIDE;
+    virtual void suspend(ReasonForSuspension) FINAL OVERRIDE;
+    virtual void resume() FINAL OVERRIDE;
+
     bool m_suspended;
 
     double m_savedNextFireInterval;
index 7d2d930..f93fce7 100644 (file)
@@ -57,7 +57,6 @@ namespace WebCore {
         using RefCounted<AbstractWorker>::ref;
         using RefCounted<AbstractWorker>::deref;
 
-        virtual void contextDestroyed() OVERRIDE;
         AbstractWorker(ScriptExecutionContext*);
         virtual ~AbstractWorker();
 
@@ -72,6 +71,8 @@ namespace WebCore {
         virtual EventTargetData* eventTargetData() OVERRIDE;
         virtual EventTargetData* ensureEventTargetData() OVERRIDE;
         
+        virtual void contextDestroyed() OVERRIDE;
+
         EventTargetData m_eventTargetData;
     };
 
index cb07917..1cd76bc 100644 (file)
@@ -69,14 +69,9 @@ public:
         ResponseTypeArrayBuffer
     };
 
-    virtual void contextDestroyed();
 #if ENABLE(XHR_TIMEOUT)
     virtual void didTimeout();
 #endif
-    virtual bool canSuspend() const;
-    virtual void suspend(ReasonForSuspension);
-    virtual void resume();
-    virtual void stop();
 
     virtual const AtomicString& interfaceName() const;
     virtual ScriptExecutionContext* scriptExecutionContext() const;
@@ -151,6 +146,13 @@ public:
 private:
     XMLHttpRequest(ScriptExecutionContext*);
 
+    // ActiveDOMObject
+    virtual void contextDestroyed() OVERRIDE;
+    virtual bool canSuspend() const OVERRIDE;
+    virtual void suspend(ReasonForSuspension) OVERRIDE;
+    virtual void resume() OVERRIDE;
+    virtual void stop() OVERRIDE;
+
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }
     virtual EventTargetData* eventTargetData();