Move more state tracking to FrameLoadState
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Nov 2013 23:55:18 +0000 (23:55 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Nov 2013 23:55:18 +0000 (23:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=124316

Reviewed by Simon Fraser.

* UIProcess/FrameLoadState.cpp:
(WebKit::FrameLoadState::didStartProvisionalLoad):
(WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad):
(WebKit::FrameLoadState::didFailProvisionalLoad):
(WebKit::FrameLoadState::didCommitLoad):
(WebKit::FrameLoadState::didFinishLoad):
(WebKit::FrameLoadState::didFailLoad):
(WebKit::FrameLoadState::didSameDocumentNotification):
(WebKit::FrameLoadState::setUnreachableURL):
* UIProcess/FrameLoadState.h:
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didCommitLoad):
(WebKit::WebFrameProxy::didFinishLoad):
(WebKit::WebFrameProxy::didFailLoad):
(WebKit::WebFrameProxy::didSameDocumentNavigation):
(WebKit::WebFrameProxy::setUnreachableURL):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/FrameLoadState.cpp
Source/WebKit2/UIProcess/FrameLoadState.h
Source/WebKit2/UIProcess/WebFrameProxy.cpp

index c04def0..0c91eef 100644 (file)
@@ -1,3 +1,27 @@
+2013-11-13  Anders Carlsson  <andersca@apple.com>
+
+        Move more state tracking to FrameLoadState
+        https://bugs.webkit.org/show_bug.cgi?id=124316
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/FrameLoadState.cpp:
+        (WebKit::FrameLoadState::didStartProvisionalLoad):
+        (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad):
+        (WebKit::FrameLoadState::didFailProvisionalLoad):
+        (WebKit::FrameLoadState::didCommitLoad):
+        (WebKit::FrameLoadState::didFinishLoad):
+        (WebKit::FrameLoadState::didFailLoad):
+        (WebKit::FrameLoadState::didSameDocumentNotification):
+        (WebKit::FrameLoadState::setUnreachableURL):
+        * UIProcess/FrameLoadState.h:
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::didCommitLoad):
+        (WebKit::WebFrameProxy::didFinishLoad):
+        (WebKit::WebFrameProxy::didFailLoad):
+        (WebKit::WebFrameProxy::didSameDocumentNavigation):
+        (WebKit::WebFrameProxy::setUnreachableURL):
+
 2013-11-13  Simon Fraser  <simon.fraser@apple.com>
 
         Expose a private flag on WKView to indicate whether it's using a remote layer tree drawing area
index 345c90c..ed34c33 100644 (file)
@@ -40,6 +40,7 @@ FrameLoadState::~FrameLoadState()
 void FrameLoadState::didStartProvisionalLoad(const String& url)
 {
     ASSERT(m_provisionalURL.isEmpty());
+
     m_loadState = LoadStateProvisional;
     m_provisionalURL = url;
 }
@@ -47,15 +48,53 @@ void FrameLoadState::didStartProvisionalLoad(const String& url)
 void FrameLoadState::didReceiveServerRedirectForProvisionalLoad(const String& url)
 {
     ASSERT(m_loadState == LoadStateProvisional);
+
     m_provisionalURL = url;
 }
 
 void FrameLoadState::didFailProvisionalLoad()
 {
     ASSERT(m_loadState == LoadStateProvisional);
+
     m_loadState = LoadStateFinished;
     m_provisionalURL = String();
     m_unreachableURL = m_lastUnreachableURL;
 }
 
+void FrameLoadState::didCommitLoad()
+{
+    ASSERT(m_loadState == LoadStateProvisional);
+
+    m_loadState = LoadStateCommitted;
+    m_url = m_provisionalURL;
+    m_provisionalURL = String();
+}
+
+void FrameLoadState::didFinishLoad()
+{
+    ASSERT(m_loadState == LoadStateCommitted);
+    ASSERT(m_provisionalURL.isEmpty());
+
+    m_loadState = LoadStateFinished;
+}
+
+void FrameLoadState::didFailLoad()
+{
+    ASSERT(m_loadState == LoadStateCommitted);
+    ASSERT(m_provisionalURL.isEmpty());
+
+    m_loadState = LoadStateFinished;
+}
+
+void FrameLoadState::didSameDocumentNotification(const String& url)
+{
+    m_url = url;
+}
+
+void FrameLoadState::setUnreachableURL(const String& unreachableURL)
+{
+    m_lastUnreachableURL = m_unreachableURL;
+    m_unreachableURL = unreachableURL;
+}
+
 } // namespace WebKit
index 1fcac76..c4f1412 100644 (file)
@@ -45,6 +45,14 @@ public:
     void didReceiveServerRedirectForProvisionalLoad(const String& url);
     void didFailProvisionalLoad();
 
+    void didCommitLoad();
+    void didFinishLoad();
+    void didFailLoad();
+
+    void didSameDocumentNotification(const String&);
+
+    void setUnreachableURL(const String&);
+
     // FIXME: These should all be private, and FrameLoadState should
     // provide state transition member functions.
     LoadState m_loadState;
index 883713c..47266e5 100644 (file)
@@ -133,10 +133,8 @@ void WebFrameProxy::didFailProvisionalLoad()
 
 void WebFrameProxy::didCommitLoad(const String& contentType, const PlatformCertificateInfo& certificateInfo)
 {
-    ASSERT(m_frameLoadState.m_loadState == FrameLoadState::LoadStateProvisional);
-    m_frameLoadState.m_loadState = FrameLoadState::LoadStateCommitted;
-    m_frameLoadState.m_url = m_frameLoadState.m_provisionalURL;
-    m_frameLoadState.m_provisionalURL = String();
+    m_frameLoadState.didCommitLoad();
+
     m_title = String();
     m_MIMEType = contentType;
     m_isFrameSet = false;
@@ -145,21 +143,17 @@ void WebFrameProxy::didCommitLoad(const String& contentType, const PlatformCerti
 
 void WebFrameProxy::didFinishLoad()
 {
-    ASSERT(m_frameLoadState.m_loadState == FrameLoadState::LoadStateCommitted);
-    ASSERT(m_frameLoadState.m_provisionalURL.isEmpty());
-    m_frameLoadState.m_loadState = FrameLoadState::LoadStateFinished;
+    m_frameLoadState.didFinishLoad();
 }
 
 void WebFrameProxy::didFailLoad()
 {
-    ASSERT(m_frameLoadState.m_loadState == FrameLoadState::LoadStateCommitted);
-    ASSERT(m_frameLoadState.m_provisionalURL.isEmpty());
-    m_frameLoadState.m_loadState = FrameLoadState::LoadStateFinished;
+    m_frameLoadState.didFailLoad();
 }
 
 void WebFrameProxy::didSameDocumentNavigation(const String& url)
 {
-    m_frameLoadState.m_url = url;
+    m_frameLoadState.didSameDocumentNotification(url);
 }
 
 void WebFrameProxy::didChangeTitle(const String& title)
@@ -225,8 +219,7 @@ void WebFrameProxy::getResourceData(WebURL* resourceURL, PassRefPtr<DataCallback
 
 void WebFrameProxy::setUnreachableURL(const String& unreachableURL)
 {
-    m_frameLoadState.m_lastUnreachableURL = m_frameLoadState.m_unreachableURL;
-    m_frameLoadState.m_unreachableURL = unreachableURL;
+    m_frameLoadState.setUnreachableURL(unreachableURL);
 }
 
 } // namespace WebKit