Commit 421c79e4 authored by ap@apple.com's avatar 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:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153551 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent df442c93
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
......@@ -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 {
......
......@@ -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(); }
......
......@@ -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;
......
......@@ -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(); }
......
......@@ -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(); }
......
......@@ -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(); }
......
......@@ -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;
......
......@@ -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(); }
......
......@@ -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>);
......
......@@ -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();
......
......@@ -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(); }
......
......@@ -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();
......
......@@ -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();
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -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;
};
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment