Title: [237029] trunk/Source/WebCore
Revision
237029
Author
[email protected]
Date
2018-10-10 21:27:08 -0700 (Wed, 10 Oct 2018)

Log Message

Rename a couple of DOMWindowProperty virtual functions
https://bugs.webkit.org/show_bug.cgi?id=190458

Reviewed by Geoffrey Garen.

Rename a couple of DOMWindowProperty virtual functions as the current naming no longer makes
sense after recent refactoring.

disconnectFrameForDocumentSuspension() was renamed to suspendForPageCache(), and
reconnectFrameFromDocumentSuspension(Frame*) was renamed to resumeFromPageCache().
DOMWindowProperty objects no longer need to disconnect / reconnect from their
frame since they now get their frame from their associated Window. However, some
DOMWindowProperty subclasses do have some page cache suspension / resuming logic
implemented of overrides of these functions.

Also drop the disconnectDOMWindowProperties() / reconnectDOMWindowProperties()
methods in DOMWindow. The naming made little sense as it does not really
disconnect those properties in any way. Instead, inline them in
DOMWindow's suspendForPageCache() / resumeFromPageCache() since these are
the only callers.

* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
(WebCore::DOMWindowIndexedDatabase::suspendForPageCache):
(WebCore::DOMWindowIndexedDatabase::resumeFromPageCache):
(WebCore::DOMWindowIndexedDatabase::disconnectFrameForDocumentSuspension): Deleted.
(WebCore::DOMWindowIndexedDatabase::reconnectFrameFromDocumentSuspension): Deleted.
* Modules/indexeddb/DOMWindowIndexedDatabase.h:
* history/CachedFrame.cpp:
(WebCore::CachedFrame::CachedFrame):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::open):
* loader/appcache/DOMApplicationCache.cpp:
(WebCore::DOMApplicationCache::suspendForPageCache):
(WebCore::DOMApplicationCache::resumeFromPageCache):
(WebCore::DOMApplicationCache::disconnectFrameForDocumentSuspension): Deleted.
(WebCore::DOMApplicationCache::reconnectFrameFromDocumentSuspension): Deleted.
* loader/appcache/DOMApplicationCache.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::suspendForPageCache):
(WebCore::DOMWindow::resumeFromPageCache):
(WebCore::DOMWindow::suspendForDocumentSuspension): Deleted.
(WebCore::DOMWindow::resumeFromDocumentSuspension): Deleted.
(WebCore::DOMWindow::disconnectDOMWindowProperties): Deleted.
(WebCore::DOMWindow::reconnectDOMWindowProperties): Deleted.
* page/DOMWindow.h:
* page/DOMWindowExtension.cpp:
(WebCore::DOMWindowExtension::suspendForPageCache):
(WebCore::DOMWindowExtension::resumeFromPageCache):
(WebCore::DOMWindowExtension::disconnectFrameForDocumentSuspension): Deleted.
(WebCore::DOMWindowExtension::reconnectFrameFromDocumentSuspension): Deleted.
* page/DOMWindowExtension.h:
* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::suspendForPageCache):
(WebCore::DOMWindowProperty::resumeFromPageCache):
(WebCore::DOMWindowProperty::disconnectFrameForDocumentSuspension): Deleted.
(WebCore::DOMWindowProperty::reconnectFrameFromDocumentSuspension): Deleted.
* page/DOMWindowProperty.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237028 => 237029)


--- trunk/Source/WebCore/ChangeLog	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/ChangeLog	2018-10-11 04:27:08 UTC (rev 237029)
@@ -1,3 +1,63 @@
+2018-10-10  Chris Dumez  <[email protected]>
+
+        Rename a couple of DOMWindowProperty virtual functions
+        https://bugs.webkit.org/show_bug.cgi?id=190458
+
+        Reviewed by Geoffrey Garen.
+
+        Rename a couple of DOMWindowProperty virtual functions as the current naming no longer makes
+        sense after recent refactoring.
+
+        disconnectFrameForDocumentSuspension() was renamed to suspendForPageCache(), and
+        reconnectFrameFromDocumentSuspension(Frame*) was renamed to resumeFromPageCache().
+        DOMWindowProperty objects no longer need to disconnect / reconnect from their
+        frame since they now get their frame from their associated Window. However, some
+        DOMWindowProperty subclasses do have some page cache suspension / resuming logic
+        implemented of overrides of these functions.
+
+        Also drop the disconnectDOMWindowProperties() / reconnectDOMWindowProperties()
+        methods in DOMWindow. The naming made little sense as it does not really
+        disconnect those properties in any way. Instead, inline them in
+        DOMWindow's suspendForPageCache() / resumeFromPageCache() since these are
+        the only callers.
+
+        * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
+        (WebCore::DOMWindowIndexedDatabase::suspendForPageCache):
+        (WebCore::DOMWindowIndexedDatabase::resumeFromPageCache):
+        (WebCore::DOMWindowIndexedDatabase::disconnectFrameForDocumentSuspension): Deleted.
+        (WebCore::DOMWindowIndexedDatabase::reconnectFrameFromDocumentSuspension): Deleted.
+        * Modules/indexeddb/DOMWindowIndexedDatabase.h:
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrame::CachedFrame):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::open):
+        * loader/appcache/DOMApplicationCache.cpp:
+        (WebCore::DOMApplicationCache::suspendForPageCache):
+        (WebCore::DOMApplicationCache::resumeFromPageCache):
+        (WebCore::DOMApplicationCache::disconnectFrameForDocumentSuspension): Deleted.
+        (WebCore::DOMApplicationCache::reconnectFrameFromDocumentSuspension): Deleted.
+        * loader/appcache/DOMApplicationCache.h:
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::suspendForPageCache):
+        (WebCore::DOMWindow::resumeFromPageCache):
+        (WebCore::DOMWindow::suspendForDocumentSuspension): Deleted.
+        (WebCore::DOMWindow::resumeFromDocumentSuspension): Deleted.
+        (WebCore::DOMWindow::disconnectDOMWindowProperties): Deleted.
+        (WebCore::DOMWindow::reconnectDOMWindowProperties): Deleted.
+        * page/DOMWindow.h:
+        * page/DOMWindowExtension.cpp:
+        (WebCore::DOMWindowExtension::suspendForPageCache):
+        (WebCore::DOMWindowExtension::resumeFromPageCache):
+        (WebCore::DOMWindowExtension::disconnectFrameForDocumentSuspension): Deleted.
+        (WebCore::DOMWindowExtension::reconnectFrameFromDocumentSuspension): Deleted.
+        * page/DOMWindowExtension.h:
+        * page/DOMWindowProperty.cpp:
+        (WebCore::DOMWindowProperty::suspendForPageCache):
+        (WebCore::DOMWindowProperty::resumeFromPageCache):
+        (WebCore::DOMWindowProperty::disconnectFrameForDocumentSuspension): Deleted.
+        (WebCore::DOMWindowProperty::reconnectFrameFromDocumentSuspension): Deleted.
+        * page/DOMWindowProperty.h:
+
 2018-10-10  Devin Rousso  <[email protected]>
 
         Web Inspector: create special Network waterfall for media events

Modified: trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp (237028 => 237029)


--- trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp	2018-10-11 04:27:08 UTC (rev 237029)
@@ -60,15 +60,15 @@
     return supplement;
 }
 
-void DOMWindowIndexedDatabase::disconnectFrameForDocumentSuspension()
+void DOMWindowIndexedDatabase::suspendForPageCache()
 {
     m_suspendedIDBFactory = WTFMove(m_idbFactory);
-    DOMWindowProperty::disconnectFrameForDocumentSuspension();
+    DOMWindowProperty::suspendForPageCache();
 }
 
-void DOMWindowIndexedDatabase::reconnectFrameFromDocumentSuspension(Frame* frame)
+void DOMWindowIndexedDatabase::resumeFromPageCache()
 {
-    DOMWindowProperty::reconnectFrameFromDocumentSuspension(frame);
+    DOMWindowProperty::resumeFromPageCache();
     m_idbFactory = WTFMove(m_suspendedIDBFactory);
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h (237028 => 237029)


--- trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h	2018-10-11 04:27:08 UTC (rev 237029)
@@ -45,8 +45,8 @@
 
     WEBCORE_EXPORT static IDBFactory* indexedDB(DOMWindow&);
 
-    void disconnectFrameForDocumentSuspension() override;
-    void reconnectFrameFromDocumentSuspension(Frame*) override;
+    void suspendForPageCache() override;
+    void resumeFromPageCache() override;
     void willDestroyGlobalObjectInCachedFrame() override;
     void willDestroyGlobalObjectInFrame() override;
     void willDetachGlobalObjectFromFrame() override;

Modified: trunk/Source/WebCore/history/CachedFrame.cpp (237028 => 237029)


--- trunk/Source/WebCore/history/CachedFrame.cpp	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/history/CachedFrame.cpp	2018-10-11 04:27:08 UTC (rev 237029)
@@ -152,7 +152,7 @@
 
     m_cachedFrameScriptData = std::make_unique<ScriptCachedFrameData>(frame);
 
-    m_document->domWindow()->suspendForDocumentSuspension();
+    m_document->domWindow()->suspendForPageCache();
 
     // Clear FrameView to reset flags such as 'firstVisuallyNonEmptyLayoutCallbackPending' so that the
     // 'DidFirstVisuallyNonEmptyLayout' callback gets called against when restoring from PageCache.

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (237028 => 237029)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2018-10-11 04:27:08 UTC (rev 237029)
@@ -2277,7 +2277,7 @@
         m_frame.setDocument(document);
     }
 
-    document->domWindow()->resumeFromDocumentSuspension();
+    document->domWindow()->resumeFromPageCache();
 
     updateFirstPartyForCookies();
 

Modified: trunk/Source/WebCore/loader/appcache/DOMApplicationCache.cpp (237028 => 237029)


--- trunk/Source/WebCore/loader/appcache/DOMApplicationCache.cpp	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/loader/appcache/DOMApplicationCache.cpp	2018-10-11 04:27:08 UTC (rev 237029)
@@ -41,16 +41,16 @@
         host->setDOMApplicationCache(this);
 }
 
-void DOMApplicationCache::disconnectFrameForDocumentSuspension()
+void DOMApplicationCache::suspendForPageCache()
 {
     if (auto* host = applicationCacheHost())
         host->setDOMApplicationCache(nullptr);
-    DOMWindowProperty::disconnectFrameForDocumentSuspension();
+    DOMWindowProperty::suspendForPageCache();
 }
 
-void DOMApplicationCache::reconnectFrameFromDocumentSuspension(Frame* frame)
+void DOMApplicationCache::resumeFromPageCache()
 {
-    DOMWindowProperty::reconnectFrameFromDocumentSuspension(frame);
+    DOMWindowProperty::resumeFromPageCache();
     if (auto* host = applicationCacheHost())
         host->setDOMApplicationCache(this);
 }

Modified: trunk/Source/WebCore/loader/appcache/DOMApplicationCache.h (237028 => 237029)


--- trunk/Source/WebCore/loader/appcache/DOMApplicationCache.h	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/loader/appcache/DOMApplicationCache.h	2018-10-11 04:27:08 UTC (rev 237029)
@@ -55,8 +55,8 @@
     EventTargetInterface eventTargetInterface() const final { return DOMApplicationCacheEventTargetInterfaceType; }
     ScriptExecutionContext* scriptExecutionContext() const final;
 
-    void disconnectFrameForDocumentSuspension() final;
-    void reconnectFrameFromDocumentSuspension(Frame*) final;
+    void suspendForPageCache() final;
+    void resumeFromPageCache() final;
     void willDestroyGlobalObjectInFrame() final;
 
     ApplicationCacheHost* applicationCacheHost() const;

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (237028 => 237029)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2018-10-11 04:27:08 UTC (rev 237029)
@@ -545,33 +545,20 @@
     resetDOMWindowProperties();
 }
 
-void DOMWindow::suspendForDocumentSuspension()
+void DOMWindow::suspendForPageCache()
 {
-    disconnectDOMWindowProperties();
+    for (auto& property : copyToVector(m_properties))
+        property->suspendForPageCache();
+
     m_suspendedForDocumentSuspension = true;
 }
 
-void DOMWindow::resumeFromDocumentSuspension()
+void DOMWindow::resumeFromPageCache()
 {
-    reconnectDOMWindowProperties();
-    m_suspendedForDocumentSuspension = false;
-}
-
-void DOMWindow::disconnectDOMWindowProperties()
-{
-    // It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
-    // unregister themselves from the DOMWindow as a result of the call to disconnectFrameForDocumentSuspension.
     for (auto& property : copyToVector(m_properties))
-        property->disconnectFrameForDocumentSuspension();
-}
+        property->resumeFromPageCache();
 
-void DOMWindow::reconnectDOMWindowProperties()
-{
-    ASSERT(m_suspendedForDocumentSuspension);
-    // It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
-    // unregister themselves from the DOMWindow as a result of the call to reconnectFromPageCache.
-    for (auto& property : copyToVector(m_properties))
-        property->reconnectFrameFromDocumentSuspension(frame());
+    m_suspendedForDocumentSuspension = false;
 }
 
 void DOMWindow::resetDOMWindowProperties()

Modified: trunk/Source/WebCore/page/DOMWindow.h (237028 => 237029)


--- trunk/Source/WebCore/page/DOMWindow.h	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/page/DOMWindow.h	2018-10-11 04:27:08 UTC (rev 237029)
@@ -112,8 +112,8 @@
     void unregisterProperty(DOMWindowProperty&);
 
     void resetUnlessSuspendedForDocumentSuspension();
-    void suspendForDocumentSuspension();
-    void resumeFromDocumentSuspension();
+    void suspendForPageCache();
+    void resumeFromPageCache();
 
     WEBCORE_EXPORT Frame* frame() const final;
 
@@ -351,8 +351,6 @@
     bool isInsecureScriptAccess(DOMWindow& activeWindow, const String& urlString);
 
     void resetDOMWindowProperties();
-    void disconnectDOMWindowProperties();
-    void reconnectDOMWindowProperties();
     void willDestroyDocumentInFrame();
 
     bool isSameSecurityOriginAsMainFrame() const;

Modified: trunk/Source/WebCore/page/DOMWindowExtension.cpp (237028 => 237029)


--- trunk/Source/WebCore/page/DOMWindowExtension.cpp	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/page/DOMWindowExtension.cpp	2018-10-11 04:27:08 UTC (rev 237029)
@@ -43,7 +43,7 @@
     ASSERT(this->frame());
 }
 
-void DOMWindowExtension::disconnectFrameForDocumentSuspension()
+void DOMWindowExtension::suspendForPageCache()
 {
     // Calling out to the client might result in this DOMWindowExtension being destroyed
     // while there is still work to do.
@@ -54,17 +54,17 @@
 
     m_disconnectedFrame = frame;
 
-    DOMWindowProperty::disconnectFrameForDocumentSuspension();
+    DOMWindowProperty::suspendForPageCache();
 }
 
-void DOMWindowExtension::reconnectFrameFromDocumentSuspension(Frame* frame)
+void DOMWindowExtension::resumeFromPageCache()
 {
-    ASSERT(m_disconnectedFrame == frame);
+    ASSERT(m_disconnectedFrame == frame());
     
-    DOMWindowProperty::reconnectFrameFromDocumentSuspension(frame);
+    DOMWindowProperty::resumeFromPageCache();
     m_disconnectedFrame = nullptr;
 
-    this->frame()->loader().client().dispatchDidReconnectDOMWindowExtensionToGlobalObject(this);
+    frame()->loader().client().dispatchDidReconnectDOMWindowExtensionToGlobalObject(this);
 }
 
 void DOMWindowExtension::willDestroyGlobalObjectInCachedFrame()

Modified: trunk/Source/WebCore/page/DOMWindowExtension.h (237028 => 237029)


--- trunk/Source/WebCore/page/DOMWindowExtension.h	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/page/DOMWindowExtension.h	2018-10-11 04:27:08 UTC (rev 237029)
@@ -42,8 +42,8 @@
         return adoptRef(*new DOMWindowExtension(window, world));
     }
 
-    void disconnectFrameForDocumentSuspension() override;
-    void reconnectFrameFromDocumentSuspension(Frame*) override;
+    void suspendForPageCache() override;
+    void resumeFromPageCache() override;
     void willDestroyGlobalObjectInCachedFrame() override;
     void willDestroyGlobalObjectInFrame() override;
     void willDetachGlobalObjectFromFrame() override;

Modified: trunk/Source/WebCore/page/DOMWindowProperty.cpp (237028 => 237029)


--- trunk/Source/WebCore/page/DOMWindowProperty.cpp	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/page/DOMWindowProperty.cpp	2018-10-11 04:27:08 UTC (rev 237029)
@@ -48,17 +48,17 @@
     m_window = nullptr;
 }
 
-void DOMWindowProperty::disconnectFrameForDocumentSuspension()
+void DOMWindowProperty::suspendForPageCache()
 {
     ASSERT(m_window);
 }
 
-void DOMWindowProperty::reconnectFrameFromDocumentSuspension(Frame* frame)
+void DOMWindowProperty::resumeFromPageCache()
 {
     // If this property is being reconnected to its Frame to enter the PageCache, it must have
     // been disconnected from its Frame in the first place and it should still have an associated DOMWindow.
-    ASSERT_UNUSED(frame, frame);
-    ASSERT(frame->document()->domWindow() == m_window);
+    ASSERT(frame());
+    ASSERT(frame()->document()->domWindow() == m_window);
 }
 
 void DOMWindowProperty::willDestroyGlobalObjectInCachedFrame()

Modified: trunk/Source/WebCore/page/DOMWindowProperty.h (237028 => 237029)


--- trunk/Source/WebCore/page/DOMWindowProperty.h	2018-10-11 04:13:17 UTC (rev 237028)
+++ trunk/Source/WebCore/page/DOMWindowProperty.h	2018-10-11 04:27:08 UTC (rev 237029)
@@ -34,8 +34,8 @@
 public:
     explicit DOMWindowProperty(DOMWindow*);
 
-    virtual void disconnectFrameForDocumentSuspension();
-    virtual void reconnectFrameFromDocumentSuspension(Frame*);
+    virtual void suspendForPageCache();
+    virtual void resumeFromPageCache();
     virtual void willDestroyGlobalObjectInCachedFrame();
     virtual void willDestroyGlobalObjectInFrame();
     virtual void willDetachGlobalObjectFromFrame();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to