Changeset 148922 in webkit
- Timestamp:
- Apr 22, 2013 3:56:19 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r148919 r148922 1 2013-04-22 Anders Carlsson <andersca@apple.com> 2 3 Web process should decide when to continue main resource loads 4 https://bugs.webkit.org/show_bug.cgi?id=114995 5 6 Reviewed by Sam Weinig. 7 8 Main resource loads can be converted to downloads, so we need the ability to let the web process decide when 9 to continue loading after a response has been received. 10 11 * NetworkProcess/NetworkResourceLoader.cpp: 12 (WebKit::NetworkResourceLoader::didReceiveResponseAsync): 13 For non-main resources, just call continueDidReceiveResponse directly; there's no need to ping-pong to the web process in that case. 14 15 (WebKit::NetworkResourceLoader::continueDidReceiveResponse): 16 Just call ResourceHandle::continueDidReceiveResponse. 17 18 * NetworkProcess/NetworkResourceLoader.messages.in: 19 Add ContinueDidReceiveResponse message. 20 21 * NetworkProcess/SchedulableLoader.cpp: 22 (WebKit::SchedulableLoader::SchedulableLoader): 23 Initialize m_isLoadingMainResource. 24 25 * NetworkProcess/SchedulableLoader.h: 26 (WebKit::SchedulableLoader::isLoadingMainResource): 27 Add getter. 28 29 (SchedulableLoader): 30 Move m_shouldClearReferrerOnHTTPSToHTTPRedirect next to the rest of the booleans. 31 32 * Shared/Network/NetworkResourceLoadParameters.cpp: 33 (WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters): 34 (WebKit::NetworkResourceLoadParameters::encode): 35 (WebKit::NetworkResourceLoadParameters::decode): 36 * Shared/Network/NetworkResourceLoadParameters.h: 37 (NetworkResourceLoadParameters): 38 Add isMainResource flag. 39 40 * WebProcess/Network/WebResourceLoadScheduler.cpp: 41 (WebKit::WebResourceLoadScheduler::scheduleSubresourceLoad): 42 Pass the cached resource to scheduleLoad. 43 44 (WebKit::WebResourceLoadScheduler::schedulePluginStreamLoad): 45 Pass null to scheduleLoad. 46 47 (WebKit::WebResourceLoadScheduler::scheduleLoad): 48 Initialize isMainResource. 49 50 * WebProcess/Network/WebResourceLoader.cpp: 51 (WebKit::WebResourceLoader::didReceiveResponseWithCertificateInfo): 52 If this is a main resource load, send back a ContinueDidReceiveResponse message. 53 1 54 2013-04-22 Tim Horton <timothy_horton@apple.com> 2 55 -
trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
r147952 r148922 206 206 sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponseWithCertificateInfo(response, PlatformCertificateInfo(response))); 207 207 208 m_handle->continueDidReceiveResponse(); 208 if (!isLoadingMainResource()) { 209 // For main resources, the web process is responsible for sending back a NetworkResourceLoader::ContinueDidReceiveResponse message. 210 m_handle->continueDidReceiveResponse(); 211 return; 212 } 209 213 } 210 214 … … 280 284 } 281 285 286 void NetworkResourceLoader::continueDidReceiveResponse() 287 { 288 m_handle->continueDidReceiveResponse(); 289 } 290 282 291 void NetworkResourceLoader::didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) 283 292 { -
trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h
r147952 r148922 107 107 108 108 void continueWillSendRequest(const WebCore::ResourceRequest& newRequest); 109 void continueDidReceiveResponse(); 109 110 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 110 111 void continueCanAuthenticateAgainstProtectionSpace(bool); -
trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.messages.in
r146929 r148922 24 24 25 25 ContinueWillSendRequest(WebCore::ResourceRequest request) 26 ContinueDidReceiveResponse() 26 27 ContinueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate) 27 28 } -
trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp
r148913 r148922 47 47 , m_allowStoredCredentials(parameters.allowStoredCredentials) 48 48 , m_inPrivateBrowsingMode(parameters.inPrivateBrowsingMode) 49 , m_shouldClearReferrerOnHTTPSToHTTPRedirect(parameters.shouldClearReferrerOnHTTPSToHTTPRedirect) 50 , m_isLoadingMainResource(parameters.isMainResource) 49 51 , m_connection(connection) 50 , m_shouldClearReferrerOnHTTPSToHTTPRedirect(parameters.shouldClearReferrerOnHTTPSToHTTPRedirect)51 52 { 52 53 for (size_t i = 0, count = parameters.requestBodySandboxExtensions.size(); i < count; ++i) { -
trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.h
r145485 r148922 53 53 WebCore::StoredCredentials allowStoredCredentials() const { return m_allowStoredCredentials; } 54 54 bool inPrivateBrowsingMode() const { return m_inPrivateBrowsingMode; } 55 bool isLoadingMainResource() const { return m_isLoadingMainResource; } 55 56 56 57 NetworkConnectionToWebProcess* connectionToWebProcess() const { return m_connection.get(); } … … 81 82 WebCore::StoredCredentials m_allowStoredCredentials; 82 83 bool m_inPrivateBrowsingMode; 84 bool m_shouldClearReferrerOnHTTPSToHTTPRedirect; 85 bool m_isLoadingMainResource; 83 86 84 87 Vector<RefPtr<SandboxExtension> > m_requestBodySandboxExtensions; … … 88 91 89 92 RefPtr<HostRecord> m_hostRecord; 90 91 bool m_shouldClearReferrerOnHTTPSToHTTPRedirect;92 93 }; 93 94 -
trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp
r148913 r148922 47 47 , inPrivateBrowsingMode(false) 48 48 , shouldClearReferrerOnHTTPSToHTTPRedirect(true) 49 , isMainResource(false) 49 50 { 50 51 } … … 94 95 encoder << inPrivateBrowsingMode; 95 96 encoder << shouldClearReferrerOnHTTPSToHTTPRedirect; 97 encoder << isMainResource; 96 98 } 97 99 … … 140 142 if (!decoder.decode(result.shouldClearReferrerOnHTTPSToHTTPRedirect)) 141 143 return false; 144 if (!decoder.decode(result.isMainResource)) 145 return false; 142 146 143 147 return true; -
trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h
r148913 r148922 61 61 bool inPrivateBrowsingMode; 62 62 bool shouldClearReferrerOnHTTPSToHTTPRedirect; 63 bool isMainResource; 63 64 }; 64 65 -
trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp
r148913 r148922 38 38 #include "WebProcess.h" 39 39 #include "WebResourceLoader.h" 40 #include <WebCore/CachedResource.h> 40 41 #include <WebCore/Document.h> 41 42 #include <WebCore/DocumentLoader.h> … … 70 71 RefPtr<SubresourceLoader> loader = SubresourceLoader::create(frame, resource, request, options); 71 72 if (loader) 72 scheduleLoad(loader.get(), priority, frame->document()->referrerPolicy() == ReferrerPolicyDefault);73 scheduleLoad(loader.get(), resource, priority, frame->document()->referrerPolicy() == ReferrerPolicyDefault); 73 74 return loader.release(); 74 75 } … … 78 79 RefPtr<NetscapePlugInStreamLoader> loader = NetscapePlugInStreamLoader::create(frame, client, request); 79 80 if (loader) 80 scheduleLoad(loader.get(), ResourceLoadPriorityLow, frame->document()->referrerPolicy() == ReferrerPolicyDefault);81 scheduleLoad(loader.get(), 0, ResourceLoadPriorityLow, frame->document()->referrerPolicy() == ReferrerPolicyDefault); 81 82 return loader.release(); 82 83 } 83 84 84 void WebResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader, ResourceLoadPriority priority, bool shouldClearReferrerOnHTTPSToHTTPRedirect)85 void WebResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader, CachedResource* resource, ResourceLoadPriority priority, bool shouldClearReferrerOnHTTPSToHTTPRedirect) 85 86 { 86 87 ASSERT(resourceLoader); … … 118 119 loadParameters.inPrivateBrowsingMode = privateBrowsingEnabled; 119 120 loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect; 121 loadParameters.isMainResource = resource && resource->type() == CachedResource::MainResource; 120 122 121 123 if (!WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::ScheduleResourceLoad(loadParameters), 0)) { -
trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h
r141981 r148922 64 64 65 65 private: 66 void scheduleLoad(WebCore::ResourceLoader*, WebCore:: ResourceLoadPriority, bool shouldClearReferrerOnHTTPSToHTTPRedirect);66 void scheduleLoad(WebCore::ResourceLoader*, WebCore::CachedResource*, WebCore::ResourceLoadPriority, bool shouldClearReferrerOnHTTPSToHTTPRedirect); 67 67 void scheduleInternallyFailedLoad(WebCore::ResourceLoader*); 68 68 void internallyFailedLoadTimerFired(); -
trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp
r147568 r148922 37 37 #include "WebErrors.h" 38 38 #include "WebProcess.h" 39 #include <WebCore/DocumentLoader.h> 39 40 #include <WebCore/ResourceBuffer.h> 40 41 #include <WebCore/ResourceError.h> … … 105 106 responseCopy.setCertificateChain(certificateInfo.certificateChain()); 106 107 m_coreLoader->didReceiveResponse(responseCopy); 108 109 if (m_coreLoader == m_coreLoader->documentLoader()->mainResourceLoader()) 110 send(Messages::NetworkResourceLoader::ContinueDidReceiveResponse()); 107 111 } 108 112
Note: See TracChangeset
for help on using the changeset viewer.