Title: [163466] trunk/Source
Revision
163466
Author
[email protected]
Date
2014-02-05 12:42:37 -0800 (Wed, 05 Feb 2014)

Log Message

FrameLoader::stateMachine() should return a reference.
<https://webkit.org/b/128263>

There is always a FrameLoaderStateMatchine, so return it by
reference since it can never be null.

Reviewed by Anders Carlsson.

* history/PageCache.cpp:
(WebCore::logCanCachePageDecision):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::finishedLoading):
(WebCore::DocumentLoader::commitData):
(WebCore::DocumentLoader::maybeLoadEmpty):
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::createDocument):
(WebCore::DocumentWriter::begin):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::prepareForHistoryNavigation):
* loader/FrameLoader.h:
(WebCore::FrameLoader::stateMachine):
* loader/HistoryController.cpp:
(WebCore::HistoryController::restoreScrollPositionAndViewState):
(WebCore::HistoryController::saveDocumentState):
* loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::scheduleLocationChange):
(WebCore::NavigationScheduler::scheduleFormSubmission):
* loader/ProgressTracker.cpp:
(WebCore::ProgressTracker::incrementProgress):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::storeResourceTimingInitiatorInformation):
* page/Frame.cpp:
(WebCore::Frame::injectUserScripts):
* page/FrameView.cpp:
(WebCore::FrameView::qualifiesAsVisuallyNonEmpty):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (163465 => 163466)


--- trunk/Source/WebCore/ChangeLog	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/ChangeLog	2014-02-05 20:42:37 UTC (rev 163466)
@@ -1,3 +1,41 @@
+2014-02-05  Andreas Kling  <[email protected]>
+
+        FrameLoader::stateMachine() should return a reference.
+        <https://webkit.org/b/128263>
+
+        There is always a FrameLoaderStateMatchine, so return it by
+        reference since it can never be null.
+
+        Reviewed by Anders Carlsson.
+
+        * history/PageCache.cpp:
+        (WebCore::logCanCachePageDecision):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::finishedLoading):
+        (WebCore::DocumentLoader::commitData):
+        (WebCore::DocumentLoader::maybeLoadEmpty):
+        * loader/DocumentWriter.cpp:
+        (WebCore::DocumentWriter::createDocument):
+        (WebCore::DocumentWriter::begin):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::prepareForHistoryNavigation):
+        * loader/FrameLoader.h:
+        (WebCore::FrameLoader::stateMachine):
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::restoreScrollPositionAndViewState):
+        (WebCore::HistoryController::saveDocumentState):
+        * loader/NavigationScheduler.cpp:
+        (WebCore::NavigationScheduler::scheduleLocationChange):
+        (WebCore::NavigationScheduler::scheduleFormSubmission):
+        * loader/ProgressTracker.cpp:
+        (WebCore::ProgressTracker::incrementProgress):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::storeResourceTimingInitiatorInformation):
+        * page/Frame.cpp:
+        (WebCore::Frame::injectUserScripts):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::qualifiesAsVisuallyNonEmpty):
+
 2014-02-04  Myles C. Maxfield  <[email protected]>
 
         Move characterAt index checks from InlineIterator to RenderText

Modified: trunk/Source/WebCore/history/PageCache.cpp (163465 => 163466)


--- trunk/Source/WebCore/history/PageCache.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/history/PageCache.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -217,7 +217,7 @@
 static void logCanCachePageDecision(Page* page)
 {
     // Only bother logging for main frames that have actually loaded and have content.
-    if (page->mainFrame().loader().stateMachine()->creatingInitialEmptyDocument())
+    if (page->mainFrame().loader().stateMachine().creatingInitialEmptyDocument())
         return;
     URL currentURL = page->mainFrame().loader().documentLoader() ? page->mainFrame().loader().documentLoader()->url() : URL();
     if (currentURL.isEmpty())

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (163465 => 163466)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -440,7 +440,7 @@
     if (!m_mainDocumentError.isNull())
         return;
     clearMainResourceLoader();
-    if (!frameLoader()->stateMachine()->creatingInitialEmptyDocument())
+    if (!frameLoader()->stateMachine().creatingInitialEmptyDocument())
         frameLoader()->checkLoadComplete();
 
     // If the document specified an application cache manifest, it violates the author's intent if we store it in the memory cache
@@ -800,7 +800,7 @@
             m_frame->document()->securityOrigin()->grantLoadLocalResources();
         }
 
-        if (frameLoader()->stateMachine()->creatingInitialEmptyDocument())
+        if (frameLoader()->stateMachine().creatingInitialEmptyDocument())
             return;
         
 #if ENABLE(MHTML)
@@ -1382,7 +1382,7 @@
     if (!shouldLoadEmpty && !frameLoader()->client().representationExistsForURLScheme(m_request.url().protocol()))
         return false;
 
-    if (m_request.url().isEmpty() && !frameLoader()->stateMachine()->creatingInitialEmptyDocument())
+    if (m_request.url().isEmpty() && !frameLoader()->stateMachine().creatingInitialEmptyDocument())
         m_request.setURL(blankURL());
     String mimeType = shouldLoadEmpty ? "text/html" : frameLoader()->client().generatedMIMETypeForURLScheme(m_request.url().protocol());
     m_response = ResourceResponse(m_request.url(), mimeType, 0, String(), String());

Modified: trunk/Source/WebCore/loader/DocumentWriter.cpp (163465 => 163466)


--- trunk/Source/WebCore/loader/DocumentWriter.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/loader/DocumentWriter.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -104,7 +104,7 @@
 
 PassRefPtr<Document> DocumentWriter::createDocument(const URL& url)
 {
-    if (!m_frame->loader().stateMachine()->isDisplayingInitialEmptyDocument() && m_frame->loader().client().shouldAlwaysUsePluginDocument(m_mimeType))
+    if (!m_frame->loader().stateMachine().isDisplayingInitialEmptyDocument() && m_frame->loader().client().shouldAlwaysUsePluginDocument(m_mimeType))
         return PluginDocument::create(m_frame, url);
 #if PLATFORM(IOS)
     if (equalIgnoringCase(m_mimeType, "application/pdf"))
@@ -133,7 +133,7 @@
 
     // FIXME: Do we need to consult the content security policy here about blocked plug-ins?
 
-    bool shouldReuseDefaultView = m_frame->loader().stateMachine()->isDisplayingInitialEmptyDocument() && m_frame->document()->isSecureTransitionTo(url);
+    bool shouldReuseDefaultView = m_frame->loader().stateMachine().isDisplayingInitialEmptyDocument() && m_frame->document()->isSecureTransitionTo(url);
     if (shouldReuseDefaultView)
         document->takeDOMWindowFrom(m_frame->document());
     else

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (163465 => 163466)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -1161,9 +1161,9 @@
         history().setCurrentItem(currentItem.get());
         m_frame.page()->backForward().setCurrentItem(currentItem.get());
 
-        ASSERT(stateMachine()->isDisplayingInitialEmptyDocument());
-        stateMachine()->advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
-        stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
+        ASSERT(stateMachine().isDisplayingInitialEmptyDocument());
+        stateMachine().advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
+        stateMachine().advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
     }
 }
 

Modified: trunk/Source/WebCore/loader/FrameLoader.h (163465 => 163466)


--- trunk/Source/WebCore/loader/FrameLoader.h	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2014-02-05 20:42:37 UTC (rev 163466)
@@ -245,7 +245,7 @@
     void setLoadsSynchronously(bool loadsSynchronously) { m_loadsSynchronously = loadsSynchronously; }
     bool loadsSynchronously() const { return m_loadsSynchronously; }
 
-    FrameLoaderStateMachine* stateMachine() const { return &m_stateMachine; }
+    FrameLoaderStateMachine& stateMachine() { return m_stateMachine; }
 
     Frame* findFrameForNavigation(const AtomicString& name, Document* activeDocument = 0);
 

Modified: trunk/Source/WebCore/loader/HistoryController.cpp (163465 => 163466)


--- trunk/Source/WebCore/loader/HistoryController.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/loader/HistoryController.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -110,7 +110,7 @@
 */
 void HistoryController::restoreScrollPositionAndViewState()
 {
-    if (!m_frame.loader().stateMachine()->committedFirstRealDocumentLoad())
+    if (!m_frame.loader().stateMachine().committedFirstRealDocumentLoad())
         return;
 
     ASSERT(m_currentItem);
@@ -160,7 +160,7 @@
 {
     // FIXME: Reading this bit of FrameLoader state here is unfortunate.  I need to study
     // this more to see if we can remove this dependency.
-    if (m_frame.loader().stateMachine()->creatingInitialEmptyDocument())
+    if (m_frame.loader().stateMachine().creatingInitialEmptyDocument())
         return;
 
     // For a standard page load, we will have a previous item set, which will be used to

Modified: trunk/Source/WebCore/loader/NavigationScheduler.cpp (163465 => 163466)


--- trunk/Source/WebCore/loader/NavigationScheduler.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/loader/NavigationScheduler.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -362,7 +362,7 @@
 
     // Handle a location change of a page with no document as a special case.
     // This may happen when a frame changes the location of another frame.
-    bool duringLoad = !loader.stateMachine()->committedFirstRealDocumentLoad();
+    bool duringLoad = !loader.stateMachine().committedFirstRealDocumentLoad();
 
     schedule(std::make_unique<ScheduledLocationChange>(securityOrigin, url, referrer, lockHistory, lockBackForwardList, duringLoad));
 }
@@ -376,7 +376,7 @@
 
     // Handle a location change of a page with no document as a special case.
     // This may happen when a frame changes the location of another frame.
-    bool duringLoad = !m_frame.loader().stateMachine()->committedFirstRealDocumentLoad();
+    bool duringLoad = !m_frame.loader().stateMachine().committedFirstRealDocumentLoad();
 
     // If this is a child frame and the form submission was triggered by a script, lock the back/forward list
     // to match IE and Opera.

Modified: trunk/Source/WebCore/loader/ProgressTracker.cpp (163465 => 163466)


--- trunk/Source/WebCore/loader/ProgressTracker.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/loader/ProgressTracker.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -246,7 +246,7 @@
     // For documents that use WebCore's layout system, treat first layout as the half-way point.
     // FIXME: The hasHTMLView function is a sort of roundabout way of asking "do you use WebCore's layout system".
     bool useClampedMaxProgress = frame->loader().client().hasHTMLView()
-        && !frame->loader().stateMachine()->firstLayoutDone();
+        && !frame->loader().stateMachine().firstLayoutDone();
     double maxProgressValue = useClampedMaxProgress ? 0.5 : finalProgressValue;
     increment = (maxProgressValue - m_progressValue) * percentOfRemainingBytes;
     m_progressValue += increment;

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (163465 => 163466)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -518,7 +518,7 @@
 {
     if (resource->type() == CachedResource::MainResource) {
         // <iframe>s should report the initial navigation requested by the parent document, but not subsequent navigations.
-        if (frame()->ownerElement() && m_documentLoader->frameLoader()->stateMachine()->committingFirstRealLoad()) {
+        if (frame()->ownerElement() && m_documentLoader->frameLoader()->stateMachine().committingFirstRealLoad()) {
             InitiatorInfo info = { frame()->ownerElement()->localName(), monotonicallyIncreasingTime() };
             m_initiatorMap.add(resource.get(), info);
         }

Modified: trunk/Source/WebCore/page/Frame.cpp (163465 => 163466)


--- trunk/Source/WebCore/page/Frame.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/page/Frame.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -696,7 +696,7 @@
     if (!m_page)
         return;
 
-    if (loader().stateMachine()->creatingInitialEmptyDocument() && !settings().shouldInjectUserScriptsInInitialEmptyDocument())
+    if (loader().stateMachine().creatingInitialEmptyDocument() && !settings().shouldInjectUserScriptsInInitialEmptyDocument())
         return;
 
     const auto* userContentController = m_page->userContentController();

Modified: trunk/Source/WebCore/page/FrameView.cpp (163465 => 163466)


--- trunk/Source/WebCore/page/FrameView.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebCore/page/FrameView.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -3670,7 +3670,7 @@
         return false;
 
     // Ensure that we always get marked visually non-empty eventually.
-    if (!frame().document()->parsing() && frame().loader().stateMachine()->committedFirstRealDocumentLoad())
+    if (!frame().document()->parsing() && frame().loader().stateMachine().committedFirstRealDocumentLoad())
         return true;
 
     // Require the document to grow a bit.

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (163465 => 163466)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2014-02-05 20:42:37 UTC (rev 163466)
@@ -1458,7 +1458,7 @@
     // FIXME (Viewless): I assume we want the equivalent of this optimization for viewless mode too.
     bool willProduceHTMLView = [m_webFrame->_private->webFrameView _viewClassForMIMEType:[dataSource _responseMIMEType]] == [WebHTMLView class];
 #endif
-    bool canSkipCreation = core(m_webFrame.get())->loader().stateMachine()->committingFirstRealLoad() && willProduceHTMLView;
+    bool canSkipCreation = core(m_webFrame.get())->loader().stateMachine().committingFirstRealLoad() && willProduceHTMLView;
     if (canSkipCreation) {
         [[m_webFrame->_private->webFrameView documentView] setDataSource:dataSource];
         return;

Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (163465 => 163466)


--- trunk/Source/WebKit/mac/WebView/WebFrame.mm	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm	2014-02-05 20:42:37 UTC (rev 163466)
@@ -1053,7 +1053,7 @@
 
 - (BOOL)_firstLayoutDone
 {
-    return _private->coreFrame->loader().stateMachine()->firstLayoutDone();
+    return _private->coreFrame->loader().stateMachine().firstLayoutDone();
 }
 
 - (BOOL)_isVisuallyNonEmpty

Modified: trunk/Source/WebKit/win/WebFrame.cpp (163465 => 163466)


--- trunk/Source/WebKit/win/WebFrame.cpp	2014-02-05 20:04:59 UTC (rev 163465)
+++ trunk/Source/WebKit/win/WebFrame.cpp	2014-02-05 20:42:37 UTC (rev 163466)
@@ -946,7 +946,7 @@
     if (!coreFrame)
         return E_FAIL;
 
-    *result = coreFrame->loader().stateMachine()->firstLayoutDone();
+    *result = coreFrame->loader().stateMachine().firstLayoutDone();
     return S_OK;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to