Title: [153551] trunk/Source/WebCore
Revision
153551
Author
[email protected]
Date
2013-07-31 17:21:33 -0700 (Wed, 31 Jul 2013)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (153550 => 153551)


--- trunk/Source/WebCore/ChangeLog	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/ChangeLog	2013-08-01 00:21:33 UTC (rev 153551)
@@ -1,3 +1,33 @@
+2013-07-31  Alexey Proskuryakov  <[email protected]>
+
+        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  <[email protected]>
 
         Remove didFinishLoad order quirk

Modified: trunk/Source/WebCore/Modules/filesystem/DOMFileSystem.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/filesystem/DOMFileSystem.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/filesystem/DOMFileSystem.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -55,9 +55,7 @@
     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 @@
 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 {

Modified: trunk/Source/WebCore/Modules/filesystem/FileWriter.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/filesystem/FileWriter.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/filesystem/FileWriter.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -68,10 +68,6 @@
     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 @@
 
     virtual ~FileWriter();
 
+    // ActiveDOMObject
+    virtual bool canSuspend() const OVERRIDE;
+    virtual void stop() OVERRIDE;
+
     // EventTarget
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }

Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/geolocation/Geolocation.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -54,7 +54,6 @@
     static PassRefPtr<Geolocation> create(ScriptExecutionContext*);
     ~Geolocation();
 
-    virtual void stop() OVERRIDE;
     Document* document() const;
     Frame* frame() const;
 
@@ -69,12 +68,15 @@
     void setError(GeolocationError*);
 
 private:
+    explicit Geolocation(ScriptExecutionContext*);
+
     Geoposition* lastPosition();
 
+    // ActiveDOMObject
+    virtual void stop() OVERRIDE;
+
     bool isDenied() const { return m_allowGeolocation == No; }
 
-    explicit Geolocation(ScriptExecutionContext*);
-
     Page* page() const;
 
     class GeoNotifier : public RefCounted<GeoNotifier> {

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -82,7 +82,6 @@
 
     // ActiveDOMObject
     virtual bool hasPendingActivity() const OVERRIDE;
-    virtual void stop() OVERRIDE;
 
     // EventTarget
     virtual const AtomicString& interfaceName() const;
@@ -112,6 +111,9 @@
 private:
     IDBDatabase(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendInterface>, PassRefPtr<IDBDatabaseCallbacks>);
 
+    // ActiveDOMObject
+    virtual void stop() OVERRIDE;
+
     // EventTarget
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -96,7 +96,6 @@
 
     // ActiveDOMObject
     virtual bool hasPendingActivity() const OVERRIDE;
-    virtual void stop() OVERRIDE;
 
     // EventTarget
     virtual const AtomicString& interfaceName() const;
@@ -132,6 +131,9 @@
     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(); }

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -114,8 +114,6 @@
 
     // 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 @@
     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(); }

Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/mediasource/MediaSource.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -71,7 +71,6 @@
 
     // ActiveDOMObject interface
     virtual bool hasPendingActivity() const OVERRIDE;
-    virtual void stop() OVERRIDE;
 
     using RefCounted<MediaSource>::ref;
     using RefCounted<MediaSource>::deref;
@@ -79,6 +78,9 @@
 private:
     explicit MediaSource(ScriptExecutionContext*);
 
+    // ActiveDOMObject interface
+    virtual void stop() OVERRIDE;
+
     virtual EventTargetData* eventTargetData() OVERRIDE;
     virtual EventTargetData* ensureEventTargetData() OVERRIDE;
 

Modified: trunk/Source/WebCore/Modules/notifications/Notification.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/notifications/Notification.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/notifications/Notification.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -125,9 +125,6 @@
     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 @@
 
     void setBody(const String& body) { m_body = body; }
 
+    // ActiveDOMObject interface
+    virtual void contextDestroyed() OVERRIDE;
+
     // EventTarget interface
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }

Modified: trunk/Source/WebCore/Modules/notifications/NotificationCenter.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/notifications/NotificationCenter.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/notifications/NotificationCenter.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -71,11 +71,12 @@
     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>);

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.h (153550 => 153551)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -100,13 +100,6 @@
     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 @@
 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();

Modified: trunk/Source/WebCore/fileapi/FileReader.h (153550 => 153551)


--- trunk/Source/WebCore/fileapi/FileReader.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/fileapi/FileReader.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -76,10 +76,6 @@
     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 @@
 private:
     FileReader(ScriptExecutionContext*);
 
+    // ActiveDOMObject
+    virtual bool canSuspend() const OVERRIDE;
+    virtual void stop() OVERRIDE;
+
     // EventTarget
     virtual void refEventTarget() { ref(); }
     virtual void derefEventTarget() { deref(); }

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (153550 => 153551)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -444,10 +444,10 @@
     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();
 

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h (153550 => 153551)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -321,11 +321,7 @@
     
     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 @@
     void initializeNewContext();
     void setupFlags();
 
+    // ActiveDOMObject
+    virtual bool hasPendingActivity() const OVERRIDE;
+    virtual void stop() OVERRIDE;
+
     void addSharedObject(WebGLSharedObject*);
     void addContextObject(WebGLContextObject*);
     void detachAndRemoveAllObjects();

Modified: trunk/Source/WebCore/page/DOMTimer.h (153550 => 153551)


--- trunk/Source/WebCore/page/DOMTimer.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/page/DOMTimer.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -43,9 +43,6 @@
         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 @@
         DOMTimer(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int interval, bool singleShot);
         virtual void fired() OVERRIDE;
 
+        // ActiveDOMObject
+        virtual void contextDestroyed() OVERRIDE;
+
         // SuspendableTimer
         virtual void didStop() OVERRIDE;
 

Modified: trunk/Source/WebCore/page/EventSource.h (153550 => 153551)


--- trunk/Source/WebCore/page/EventSource.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/page/EventSource.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -78,8 +78,6 @@
     virtual const AtomicString& interfaceName() const;
     virtual ScriptExecutionContext* scriptExecutionContext() const;
 
-    virtual void stop();
-
 private:
     EventSource(ScriptExecutionContext*, const KURL&, const Dictionary&);
 
@@ -95,6 +93,8 @@
     virtual void didFailAccessControlCheck(const ResourceError&);
     virtual void didFailRedirectCheck();
 
+    virtual void stop() OVERRIDE;
+
     void connect();
     void networkRequestEnded();
     void scheduleInitialConnect();

Modified: trunk/Source/WebCore/page/SuspendableTimer.h (153550 => 153551)


--- trunk/Source/WebCore/page/SuspendableTimer.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/page/SuspendableTimer.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -37,13 +37,6 @@
     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 @@
 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;

Modified: trunk/Source/WebCore/workers/AbstractWorker.h (153550 => 153551)


--- trunk/Source/WebCore/workers/AbstractWorker.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/workers/AbstractWorker.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -57,7 +57,6 @@
         using RefCounted<AbstractWorker>::ref;
         using RefCounted<AbstractWorker>::deref;
 
-        virtual void contextDestroyed() OVERRIDE;
         AbstractWorker(ScriptExecutionContext*);
         virtual ~AbstractWorker();
 
@@ -72,6 +71,8 @@
         virtual EventTargetData* eventTargetData() OVERRIDE;
         virtual EventTargetData* ensureEventTargetData() OVERRIDE;
         
+        virtual void contextDestroyed() OVERRIDE;
+
         EventTargetData m_eventTargetData;
     };
 

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (153550 => 153551)


--- trunk/Source/WebCore/xml/XMLHttpRequest.h	2013-08-01 00:10:20 UTC (rev 153550)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h	2013-08-01 00:21:33 UTC (rev 153551)
@@ -69,14 +69,9 @@
         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 @@
 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();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to