Diff
Modified: trunk/Source/WebKit2/ChangeLog (148921 => 148922)
--- trunk/Source/WebKit2/ChangeLog 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/ChangeLog 2013-04-22 22:56:19 UTC (rev 148922)
@@ -1,3 +1,56 @@
+2013-04-22 Anders Carlsson <[email protected]>
+
+ Web process should decide when to continue main resource loads
+ https://bugs.webkit.org/show_bug.cgi?id=114995
+
+ Reviewed by Sam Weinig.
+
+ Main resource loads can be converted to downloads, so we need the ability to let the web process decide when
+ to continue loading after a response has been received.
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::didReceiveResponseAsync):
+ For non-main resources, just call continueDidReceiveResponse directly; there's no need to ping-pong to the web process in that case.
+
+ (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
+ Just call ResourceHandle::continueDidReceiveResponse.
+
+ * NetworkProcess/NetworkResourceLoader.messages.in:
+ Add ContinueDidReceiveResponse message.
+
+ * NetworkProcess/SchedulableLoader.cpp:
+ (WebKit::SchedulableLoader::SchedulableLoader):
+ Initialize m_isLoadingMainResource.
+
+ * NetworkProcess/SchedulableLoader.h:
+ (WebKit::SchedulableLoader::isLoadingMainResource):
+ Add getter.
+
+ (SchedulableLoader):
+ Move m_shouldClearReferrerOnHTTPSToHTTPRedirect next to the rest of the booleans.
+
+ * Shared/Network/NetworkResourceLoadParameters.cpp:
+ (WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
+ (WebKit::NetworkResourceLoadParameters::encode):
+ (WebKit::NetworkResourceLoadParameters::decode):
+ * Shared/Network/NetworkResourceLoadParameters.h:
+ (NetworkResourceLoadParameters):
+ Add isMainResource flag.
+
+ * WebProcess/Network/WebResourceLoadScheduler.cpp:
+ (WebKit::WebResourceLoadScheduler::scheduleSubresourceLoad):
+ Pass the cached resource to scheduleLoad.
+
+ (WebKit::WebResourceLoadScheduler::schedulePluginStreamLoad):
+ Pass null to scheduleLoad.
+
+ (WebKit::WebResourceLoadScheduler::scheduleLoad):
+ Initialize isMainResource.
+
+ * WebProcess/Network/WebResourceLoader.cpp:
+ (WebKit::WebResourceLoader::didReceiveResponseWithCertificateInfo):
+ If this is a main resource load, send back a ContinueDidReceiveResponse message.
+
2013-04-22 Tim Horton <[email protected]>
Plugin Snapshotting: Don't consume insane amounts of time detecting the primary plugin
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (148921 => 148922)
--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp 2013-04-22 22:56:19 UTC (rev 148922)
@@ -205,7 +205,11 @@
sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponseWithCertificateInfo(response, PlatformCertificateInfo(response)));
- m_handle->continueDidReceiveResponse();
+ if (!isLoadingMainResource()) {
+ // For main resources, the web process is responsible for sending back a NetworkResourceLoader::ContinueDidReceiveResponse message.
+ m_handle->continueDidReceiveResponse();
+ return;
+ }
}
void NetworkResourceLoader::didReceiveData(ResourceHandle*, const char* data, int length, int encodedDataLength)
@@ -279,6 +283,11 @@
m_suggestedRequestForWillSendRequest = ResourceRequest();
}
+void NetworkResourceLoader::continueDidReceiveResponse()
+{
+ m_handle->continueDidReceiveResponse();
+}
+
void NetworkResourceLoader::didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
{
send(Messages::WebResourceLoader::DidSendData(bytesSent, totalBytesToBeSent));
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (148921 => 148922)
--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h 2013-04-22 22:56:19 UTC (rev 148922)
@@ -106,6 +106,7 @@
NetworkResourceLoader(const NetworkResourceLoadParameters&, NetworkConnectionToWebProcess*);
void continueWillSendRequest(const WebCore::ResourceRequest& newRequest);
+ void continueDidReceiveResponse();
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
void continueCanAuthenticateAgainstProtectionSpace(bool);
#endif
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.messages.in (148921 => 148922)
--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.messages.in 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.messages.in 2013-04-22 22:56:19 UTC (rev 148922)
@@ -23,5 +23,6 @@
messages -> NetworkResourceLoader LegacyReceiver {
ContinueWillSendRequest(WebCore::ResourceRequest request)
+ ContinueDidReceiveResponse()
ContinueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate)
}
Modified: trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp (148921 => 148922)
--- trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp 2013-04-22 22:56:19 UTC (rev 148922)
@@ -46,8 +46,9 @@
, m_contentSniffingPolicy(parameters.contentSniffingPolicy)
, m_allowStoredCredentials(parameters.allowStoredCredentials)
, m_inPrivateBrowsingMode(parameters.inPrivateBrowsingMode)
+ , m_shouldClearReferrerOnHTTPSToHTTPRedirect(parameters.shouldClearReferrerOnHTTPSToHTTPRedirect)
+ , m_isLoadingMainResource(parameters.isMainResource)
, m_connection(connection)
- , m_shouldClearReferrerOnHTTPSToHTTPRedirect(parameters.shouldClearReferrerOnHTTPSToHTTPRedirect)
{
for (size_t i = 0, count = parameters.requestBodySandboxExtensions.size(); i < count; ++i) {
if (RefPtr<SandboxExtension> extension = SandboxExtension::create(parameters.requestBodySandboxExtensions[i]))
Modified: trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.h (148921 => 148922)
--- trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.h 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.h 2013-04-22 22:56:19 UTC (rev 148922)
@@ -52,6 +52,7 @@
WebCore::ContentSniffingPolicy contentSniffingPolicy() const { return m_contentSniffingPolicy; }
WebCore::StoredCredentials allowStoredCredentials() const { return m_allowStoredCredentials; }
bool inPrivateBrowsingMode() const { return m_inPrivateBrowsingMode; }
+ bool isLoadingMainResource() const { return m_isLoadingMainResource; }
NetworkConnectionToWebProcess* connectionToWebProcess() const { return m_connection.get(); }
virtual void connectionToWebProcessDidClose() = 0;
@@ -80,6 +81,8 @@
WebCore::ContentSniffingPolicy m_contentSniffingPolicy;
WebCore::StoredCredentials m_allowStoredCredentials;
bool m_inPrivateBrowsingMode;
+ bool m_shouldClearReferrerOnHTTPSToHTTPRedirect;
+ bool m_isLoadingMainResource;
Vector<RefPtr<SandboxExtension> > m_requestBodySandboxExtensions;
Vector<RefPtr<SandboxExtension> > m_resourceSandboxExtensions;
@@ -87,8 +90,6 @@
RefPtr<NetworkConnectionToWebProcess> m_connection;
RefPtr<HostRecord> m_hostRecord;
-
- bool m_shouldClearReferrerOnHTTPSToHTTPRedirect;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp (148921 => 148922)
--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp 2013-04-22 22:56:19 UTC (rev 148922)
@@ -46,6 +46,7 @@
, allowStoredCredentials(DoNotAllowStoredCredentials)
, inPrivateBrowsingMode(false)
, shouldClearReferrerOnHTTPSToHTTPRedirect(true)
+ , isMainResource(false)
{
}
@@ -93,6 +94,7 @@
encoder.encodeEnum(allowStoredCredentials);
encoder << inPrivateBrowsingMode;
encoder << shouldClearReferrerOnHTTPSToHTTPRedirect;
+ encoder << isMainResource;
}
bool NetworkResourceLoadParameters::decode(CoreIPC::ArgumentDecoder& decoder, NetworkResourceLoadParameters& result)
@@ -139,6 +141,8 @@
return false;
if (!decoder.decode(result.shouldClearReferrerOnHTTPSToHTTPRedirect))
return false;
+ if (!decoder.decode(result.isMainResource))
+ return false;
return true;
}
Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h (148921 => 148922)
--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h 2013-04-22 22:56:19 UTC (rev 148922)
@@ -60,6 +60,7 @@
WebCore::StoredCredentials allowStoredCredentials;
bool inPrivateBrowsingMode;
bool shouldClearReferrerOnHTTPSToHTTPRedirect;
+ bool isMainResource;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (148921 => 148922)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp 2013-04-22 22:56:19 UTC (rev 148922)
@@ -37,6 +37,7 @@
#include "WebPage.h"
#include "WebProcess.h"
#include "WebResourceLoader.h"
+#include <WebCore/CachedResource.h>
#include <WebCore/Document.h>
#include <WebCore/DocumentLoader.h>
#include <WebCore/Frame.h>
@@ -69,7 +70,7 @@
{
RefPtr<SubresourceLoader> loader = SubresourceLoader::create(frame, resource, request, options);
if (loader)
- scheduleLoad(loader.get(), priority, frame->document()->referrerPolicy() == ReferrerPolicyDefault);
+ scheduleLoad(loader.get(), resource, priority, frame->document()->referrerPolicy() == ReferrerPolicyDefault);
return loader.release();
}
@@ -77,11 +78,11 @@
{
RefPtr<NetscapePlugInStreamLoader> loader = NetscapePlugInStreamLoader::create(frame, client, request);
if (loader)
- scheduleLoad(loader.get(), ResourceLoadPriorityLow, frame->document()->referrerPolicy() == ReferrerPolicyDefault);
+ scheduleLoad(loader.get(), 0, ResourceLoadPriorityLow, frame->document()->referrerPolicy() == ReferrerPolicyDefault);
return loader.release();
}
-void WebResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader, ResourceLoadPriority priority, bool shouldClearReferrerOnHTTPSToHTTPRedirect)
+void WebResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader, CachedResource* resource, ResourceLoadPriority priority, bool shouldClearReferrerOnHTTPSToHTTPRedirect)
{
ASSERT(resourceLoader);
ASSERT(priority != ResourceLoadPriorityUnresolved);
@@ -117,6 +118,7 @@
loadParameters.allowStoredCredentials = allowStoredCredentials;
loadParameters.inPrivateBrowsingMode = privateBrowsingEnabled;
loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect;
+ loadParameters.isMainResource = resource && resource->type() == CachedResource::MainResource;
if (!WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::ScheduleResourceLoad(loadParameters), 0)) {
// We probably failed to schedule this load with the NetworkProcess because it had crashed.
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h (148921 => 148922)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h 2013-04-22 22:56:19 UTC (rev 148922)
@@ -63,7 +63,7 @@
void networkProcessCrashed();
private:
- void scheduleLoad(WebCore::ResourceLoader*, WebCore::ResourceLoadPriority, bool shouldClearReferrerOnHTTPSToHTTPRedirect);
+ void scheduleLoad(WebCore::ResourceLoader*, WebCore::CachedResource*, WebCore::ResourceLoadPriority, bool shouldClearReferrerOnHTTPSToHTTPRedirect);
void scheduleInternallyFailedLoad(WebCore::ResourceLoader*);
void internallyFailedLoadTimerFired();
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (148921 => 148922)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2013-04-22 22:52:23 UTC (rev 148921)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2013-04-22 22:56:19 UTC (rev 148922)
@@ -36,6 +36,7 @@
#include "WebCoreArgumentCoders.h"
#include "WebErrors.h"
#include "WebProcess.h"
+#include <WebCore/DocumentLoader.h>
#include <WebCore/ResourceBuffer.h>
#include <WebCore/ResourceError.h>
#include <WebCore/ResourceLoader.h>
@@ -104,6 +105,9 @@
ResourceResponse responseCopy(response);
responseCopy.setCertificateChain(certificateInfo.certificateChain());
m_coreLoader->didReceiveResponse(responseCopy);
+
+ if (m_coreLoader == m_coreLoader->documentLoader()->mainResourceLoader())
+ send(Messages::NetworkResourceLoader::ContinueDidReceiveResponse());
}
void WebResourceLoader::didReceiveData(const CoreIPC::DataReference& data, int64_t encodedDataLength)