Commit 016f6b4c authored by andersca@apple.com's avatar andersca@apple.com

Add a FrameLoadState object and begin moving loading related members from WebFrameProxy

https://bugs.webkit.org/show_bug.cgi?id=124163

Reviewed by Beth Dakin.

* UIProcess/API/C/WKFrame.cpp:
(WKFrameGetFrameLoadState):
* UIProcess/FrameLoadState.cpp: Added.
(WebKit::FrameLoadState::FrameLoadState):
(WebKit::FrameLoadState::~FrameLoadState):
* UIProcess/FrameLoadState.h: Added.
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::WebFrameProxy):
(WebKit::WebFrameProxy::didStartProvisionalLoad):
(WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad):
(WebKit::WebFrameProxy::didFailProvisionalLoad):
(WebKit::WebFrameProxy::didCommitLoad):
(WebKit::WebFrameProxy::didFinishLoad):
(WebKit::WebFrameProxy::didFailLoad):
(WebKit::WebFrameProxy::didSameDocumentNavigation):
(WebKit::WebFrameProxy::setUnreachableURL):
* UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::frameLoadState):
(WebKit::WebFrameProxy::loadState):
(WebKit::WebFrameProxy::url):
(WebKit::WebFrameProxy::provisionalURL):
(WebKit::WebFrameProxy::unreachableURL):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::activeURL):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::loadStateAtProcessExit):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 52659d14
2013-11-11 Anders Carlsson <andersca@apple.com>
Add a FrameLoadState object and begin moving loading related members from WebFrameProxy
https://bugs.webkit.org/show_bug.cgi?id=124163
Reviewed by Beth Dakin.
* UIProcess/API/C/WKFrame.cpp:
(WKFrameGetFrameLoadState):
* UIProcess/FrameLoadState.cpp: Added.
(WebKit::FrameLoadState::FrameLoadState):
(WebKit::FrameLoadState::~FrameLoadState):
* UIProcess/FrameLoadState.h: Added.
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::WebFrameProxy):
(WebKit::WebFrameProxy::didStartProvisionalLoad):
(WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad):
(WebKit::WebFrameProxy::didFailProvisionalLoad):
(WebKit::WebFrameProxy::didCommitLoad):
(WebKit::WebFrameProxy::didFinishLoad):
(WebKit::WebFrameProxy::didFailLoad):
(WebKit::WebFrameProxy::didSameDocumentNavigation):
(WebKit::WebFrameProxy::setUnreachableURL):
* UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::frameLoadState):
(WebKit::WebFrameProxy::loadState):
(WebKit::WebFrameProxy::url):
(WebKit::WebFrameProxy::provisionalURL):
(WebKit::WebFrameProxy::unreachableURL):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::activeURL):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::loadStateAtProcessExit):
* WebKit2.xcodeproj/project.pbxproj:
2013-11-11 Gergo Balogh <geryxyz@inf.u-szeged.hu>
Remove #include from test input of the *Messages.in processing scripts.
......
......@@ -44,13 +44,13 @@ bool WKFrameIsMainFrame(WKFrameRef frameRef)
WKFrameLoadState WKFrameGetFrameLoadState(WKFrameRef frameRef)
{
WebFrameProxy* frame = toImpl(frameRef);
switch (frame->loadState()) {
case WebFrameProxy::LoadStateProvisional:
return kWKFrameLoadStateProvisional;
case WebFrameProxy::LoadStateCommitted:
return kWKFrameLoadStateCommitted;
case WebFrameProxy::LoadStateFinished:
return kWKFrameLoadStateFinished;
switch (frame->frameLoadState().m_loadState) {
case FrameLoadState::LoadStateProvisional:
return kWKFrameLoadStateProvisional;
case FrameLoadState::LoadStateCommitted:
return kWKFrameLoadStateCommitted;
case FrameLoadState::LoadStateFinished:
return kWKFrameLoadStateFinished;
}
ASSERT_NOT_REACHED();
......
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "FrameLoadState.h"
namespace WebKit {
FrameLoadState::FrameLoadState()
: m_loadState(LoadStateFinished)
{
}
FrameLoadState::~FrameLoadState()
{
}
} // namespace WebKit
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FrameLoadState_h
#define FrameLoadState_h
#include <wtf/text/WTFString.h>
namespace WebKit {
class FrameLoadState {
public:
FrameLoadState();
~FrameLoadState();
enum LoadState {
LoadStateProvisional,
LoadStateCommitted,
LoadStateFinished
};
// FIXME: These should all be private, and FrameLoadState should
// provide state transition member functions.
LoadState m_loadState;
String m_url;
String m_provisionalURL;
String m_unreachableURL;
String m_lastUnreachableURL;
};
} // namespace WebKit
#endif // FrameLoadState_h
......@@ -44,7 +44,6 @@ namespace WebKit {
WebFrameProxy::WebFrameProxy(WebPageProxy* page, uint64_t frameID)
: m_page(page)
, m_loadState(LoadStateFinished)
, m_isFrameSet(false)
, m_frameID(frameID)
{
......@@ -119,31 +118,31 @@ bool WebFrameProxy::isDisplayingPDFDocument() const
void WebFrameProxy::didStartProvisionalLoad(const String& url)
{
ASSERT(m_provisionalURL.isEmpty());
m_loadState = LoadStateProvisional;
m_provisionalURL = url;
ASSERT(m_frameLoadState.m_provisionalURL.isEmpty());
m_frameLoadState.m_loadState = FrameLoadState::LoadStateProvisional;
m_frameLoadState.m_provisionalURL = url;
}
void WebFrameProxy::didReceiveServerRedirectForProvisionalLoad(const String& url)
{
ASSERT(m_loadState == LoadStateProvisional);
m_provisionalURL = url;
ASSERT(m_frameLoadState.m_loadState == FrameLoadState::LoadStateProvisional);
m_frameLoadState.m_provisionalURL = url;
}
void WebFrameProxy::didFailProvisionalLoad()
{
ASSERT(m_loadState == LoadStateProvisional);
m_loadState = LoadStateFinished;
m_provisionalURL = String();
m_unreachableURL = m_lastUnreachableURL;
ASSERT(m_frameLoadState.m_loadState == FrameLoadState::LoadStateProvisional);
m_frameLoadState.m_loadState = FrameLoadState::LoadStateFinished;
m_frameLoadState.m_provisionalURL = String();
m_frameLoadState.m_unreachableURL = m_frameLoadState.m_lastUnreachableURL;
}
void WebFrameProxy::didCommitLoad(const String& contentType, const PlatformCertificateInfo& certificateInfo)
{
ASSERT(m_loadState == LoadStateProvisional);
m_loadState = LoadStateCommitted;
m_url = m_provisionalURL;
m_provisionalURL = String();
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_title = String();
m_MIMEType = contentType;
m_isFrameSet = false;
......@@ -152,21 +151,21 @@ void WebFrameProxy::didCommitLoad(const String& contentType, const PlatformCerti
void WebFrameProxy::didFinishLoad()
{
ASSERT(m_loadState == LoadStateCommitted);
ASSERT(m_provisionalURL.isEmpty());
m_loadState = LoadStateFinished;
ASSERT(m_frameLoadState.m_loadState == FrameLoadState::LoadStateCommitted);
ASSERT(m_frameLoadState.m_provisionalURL.isEmpty());
m_frameLoadState.m_loadState = FrameLoadState::LoadStateFinished;
}
void WebFrameProxy::didFailLoad()
{
ASSERT(m_loadState == LoadStateCommitted);
ASSERT(m_provisionalURL.isEmpty());
m_loadState = LoadStateFinished;
ASSERT(m_frameLoadState.m_loadState == FrameLoadState::LoadStateCommitted);
ASSERT(m_frameLoadState.m_provisionalURL.isEmpty());
m_frameLoadState.m_loadState = FrameLoadState::LoadStateFinished;
}
void WebFrameProxy::didSameDocumentNavigation(const String& url)
{
m_url = url;
m_frameLoadState.m_url = url;
}
void WebFrameProxy::didChangeTitle(const String& title)
......@@ -232,8 +231,8 @@ void WebFrameProxy::getResourceData(WebURL* resourceURL, PassRefPtr<DataCallback
void WebFrameProxy::setUnreachableURL(const String& unreachableURL)
{
m_lastUnreachableURL = m_unreachableURL;
m_unreachableURL = unreachableURL;
m_frameLoadState.m_lastUnreachableURL = m_frameLoadState.m_unreachableURL;
m_frameLoadState.m_unreachableURL = unreachableURL;
}
} // namespace WebKit
......@@ -27,6 +27,7 @@
#define WebFrameProxy_h
#include "APIObject.h"
#include "FrameLoadState.h"
#include "ImmutableArray.h"
#include "GenericCallback.h"
#include "WebFrameListenerProxy.h"
......@@ -60,12 +61,6 @@ public:
virtual ~WebFrameProxy();
enum LoadState {
LoadStateProvisional,
LoadStateCommitted,
LoadStateFinished
};
uint64_t frameID() const { return m_frameID; }
WebPageProxy* page() const { return m_page; }
......@@ -76,15 +71,17 @@ public:
void setIsFrameSet(bool value) { m_isFrameSet = value; }
bool isFrameSet() const { return m_isFrameSet; }
LoadState loadState() const { return m_loadState; }
FrameLoadState& frameLoadState() { return m_frameLoadState; }
FrameLoadState::LoadState loadState() const { return m_frameLoadState.m_loadState; }
void stopLoading() const;
const String& url() const { return m_url; }
const String& provisionalURL() const { return m_provisionalURL; }
const String& url() const { return m_frameLoadState.m_url; }
const String& provisionalURL() const { return m_frameLoadState.m_provisionalURL; }
void setUnreachableURL(const String&);
const String& unreachableURL() const { return m_unreachableURL; }
const String& unreachableURL() const { return m_frameLoadState.m_unreachableURL; }
const String& mimeType() const { return m_MIMEType; }
......@@ -121,11 +118,9 @@ private:
WebFrameProxy(WebPageProxy* page, uint64_t frameID);
WebPageProxy* m_page;
LoadState m_loadState;
String m_url;
String m_provisionalURL;
String m_unreachableURL;
String m_lastUnreachableURL;
FrameLoadState m_frameLoadState;
String m_MIMEType;
String m_title;
bool m_isFrameSet;
......
......@@ -238,7 +238,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
, m_estimatedProgress(0)
, m_viewState(ViewState::NoFlags)
, m_backForwardList(WebBackForwardList::create(this))
, m_loadStateAtProcessExit(WebFrameProxy::LoadStateFinished)
, m_loadStateAtProcessExit(FrameLoadState::LoadStateFinished)
, m_temporarilyClosedComposition(false)
, m_textZoomFactor(1)
, m_pageZoomFactor(1)
......@@ -847,11 +847,11 @@ String WebPageProxy::activeURL() const
if (!m_mainFrame->unreachableURL().isEmpty())
return m_mainFrame->unreachableURL();
switch (m_mainFrame->loadState()) {
case WebFrameProxy::LoadStateProvisional:
switch (m_mainFrame->frameLoadState().m_loadState) {
case FrameLoadState::LoadStateProvisional:
return m_mainFrame->provisionalURL();
case WebFrameProxy::LoadStateCommitted:
case WebFrameProxy::LoadStateFinished:
case FrameLoadState::LoadStateCommitted:
case FrameLoadState::LoadStateFinished:
return m_mainFrame->url();
}
......
......@@ -610,7 +610,7 @@ public:
PassRefPtr<ImmutableArray> relatedPages() const;
const String& urlAtProcessExit() const { return m_urlAtProcessExit; }
WebFrameProxy::LoadState loadStateAtProcessExit() const { return m_loadStateAtProcessExit; }
FrameLoadState::LoadState loadStateAtProcessExit() const { return m_loadStateAtProcessExit; }
#if ENABLE(DRAG_SUPPORT)
WebCore::DragSession dragSession() const { return m_currentDragSession; }
......@@ -1090,7 +1090,7 @@ private:
String m_toolTip;
String m_urlAtProcessExit;
WebFrameProxy::LoadState m_loadStateAtProcessExit;
FrameLoadState::LoadState m_loadStateAtProcessExit;
EditorState m_editorState;
bool m_temporarilyClosedComposition; // Editor state changed from hasComposition to !hasComposition, but that was only with shouldIgnoreCompositionSelectionChange yet.
......
......@@ -266,6 +266,8 @@
1AE00D4F182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */; };
1AE00D5C182DADE100087DD7 /* KeyedEncoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE00D5A182DADE100087DD7 /* KeyedEncoder.cpp */; };
1AE00D5D182DADE100087DD7 /* KeyedEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D5B182DADE100087DD7 /* KeyedEncoder.h */; };
1AE00D601831792100087DD7 /* FrameLoadState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE00D5E1831792100087DD7 /* FrameLoadState.cpp */; };
1AE00D611831792100087DD7 /* FrameLoadState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE00D5F1831792100087DD7 /* FrameLoadState.h */; };
1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */; };
1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE4976611FF658E0048B464 /* NPJSObject.h */; };
1AE4976911FF658E0048B464 /* NPJSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4976711FF658E0048B464 /* NPJSObject.cpp */; };
......@@ -1752,6 +1754,8 @@
1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextHandleInternal.h; sourceTree = "<group>"; };
1AE00D5A182DADE100087DD7 /* KeyedEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyedEncoder.cpp; sourceTree = "<group>"; };
1AE00D5B182DADE100087DD7 /* KeyedEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedEncoder.h; sourceTree = "<group>"; };
1AE00D5E1831792100087DD7 /* FrameLoadState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoadState.cpp; sourceTree = "<group>"; };
1AE00D5F1831792100087DD7 /* FrameLoadState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLoadState.h; sourceTree = "<group>"; };
1AE117F511DBB30900981615 /* ProcessLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessLauncher.cpp; sourceTree = "<group>"; };
1AE4976611FF658E0048B464 /* NPJSObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPJSObject.h; sourceTree = "<group>"; };
1AE4976711FF658E0048B464 /* NPJSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPJSObject.cpp; sourceTree = "<group>"; };
......@@ -4294,6 +4298,8 @@
BC2652131182608100243E12 /* DrawingAreaProxy.h */,
1A6422FC12DD08FE00CAAE2C /* DrawingAreaProxy.messages.in */,
1A910070126675C4001842F5 /* FindIndicator.cpp */,
1AE00D5E1831792100087DD7 /* FrameLoadState.cpp */,
1AE00D5F1831792100087DD7 /* FrameLoadState.h */,
1A91006F126675C3001842F5 /* FindIndicator.h */,
BC17753E118BABF0007D9E9A /* GenericCallback.h */,
BC06F44912DBD1F5002D78DE /* GeolocationPermissionRequestManagerProxy.cpp */,
......@@ -5793,6 +5799,7 @@
1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */,
51032F1E180F791700961BB7 /* DatabaseToWebProcessConnectionMessages.h in Headers */,
51A9E1061315CCFC009E7031 /* WebKeyValueStorageManager.h in Headers */,
1AE00D611831792100087DD7 /* FrameLoadState.h in Headers */,
BC59548915C7868500FD1E3E /* WebKit2.h in Headers */,
BCB63478116BF10600603215 /* WebKit2_C.h in Headers */,
BC9BA5051697C45300E44616 /* WebKit2Initialize.h in Headers */,
......@@ -6763,6 +6770,7 @@
1A3D610513A7F03A00F95D4E /* ArgumentCoders.cpp in Sources */,
1AAF0C4B12B16334008E49E2 /* ArgumentCodersCF.cpp in Sources */,
E179FD9F134D38250015B883 /* ArgumentCodersMac.mm in Sources */,
1AE00D601831792100087DD7 /* FrameLoadState.cpp in Sources */,
BC032DA510F437D10058C15A /* ArgumentDecoder.cpp in Sources */,
BC032DA710F437D10058C15A /* ArgumentEncoder.cpp in Sources */,
BCEE966C112FAF57006BCC24 /* Attachment.cpp in Sources */,
......
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