Title: [170958] trunk/Source/WebKit2
Revision
170958
Author
[email protected]
Date
2014-07-09 23:14:35 -0700 (Wed, 09 Jul 2014)

Log Message

Buffer CSS and JS resources in network process before sending over to web process
https://bugs.webkit.org/show_bug.cgi?id=134560
<rdar://problem/16737186>

Reviewed by Antti Koivisto.

For CSS and JS resources, ask the network process to buffer the entire resource instead of
sending it to web process in chunks since the web process can't do anything with a partial
css or js file.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::NetworkResourceLoader):
* Shared/Network/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
(WebKit::NetworkResourceLoadParameters::encode):
(WebKit::NetworkResourceLoadParameters::decode):
* Shared/Network/NetworkResourceLoadParameters.h:
* WebProcess/Network/WebResourceLoadScheduler.cpp:
(WebKit::WebResourceLoadScheduler::scheduleLoad):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (170957 => 170958)


--- trunk/Source/WebKit2/ChangeLog	2014-07-10 06:08:58 UTC (rev 170957)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-10 06:14:35 UTC (rev 170958)
@@ -1,3 +1,25 @@
+2014-07-09  Pratik Solanki  <[email protected]>
+
+        Buffer CSS and JS resources in network process before sending over to web process
+        https://bugs.webkit.org/show_bug.cgi?id=134560
+        <rdar://problem/16737186>
+
+        Reviewed by Antti Koivisto.
+
+        For CSS and JS resources, ask the network process to buffer the entire resource instead of
+        sending it to web process in chunks since the web process can't do anything with a partial
+        css or js file.
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::NetworkResourceLoader):
+        * Shared/Network/NetworkResourceLoadParameters.cpp:
+        (WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
+        (WebKit::NetworkResourceLoadParameters::encode):
+        (WebKit::NetworkResourceLoadParameters::decode):
+        * Shared/Network/NetworkResourceLoadParameters.h:
+        * WebProcess/Network/WebResourceLoadScheduler.cpp:
+        (WebKit::WebResourceLoadScheduler::scheduleLoad):
+
 2014-07-09  Benjamin Poulain  <[email protected]>
 
         [iOS][WK2] Disable text quantization while actively changing the page's scale factor

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (170957 => 170958)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2014-07-10 06:08:58 UTC (rev 170957)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2014-07-10 06:14:35 UTC (rev 170958)
@@ -99,10 +99,12 @@
 
     ASSERT(RunLoop::isMain());
     
-    if (reply) {
+    if (reply || parameters.shouldBufferResource)
+        m_bufferedData = WebCore::SharedBuffer::create();
+
+    if (reply)
         m_networkLoaderClient = std::make_unique<SynchronousNetworkLoaderClient>(m_request, reply);
-        m_bufferedData = WebCore::SharedBuffer::create();
-    } else
+    else
         m_networkLoaderClient = std::make_unique<AsynchronousNetworkLoaderClient>();
 }
 

Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp (170957 => 170958)


--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp	2014-07-10 06:08:58 UTC (rev 170957)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp	2014-07-10 06:14:35 UTC (rev 170958)
@@ -48,6 +48,7 @@
     , shouldClearReferrerOnHTTPSToHTTPRedirect(true)
     , isMainResource(false)
     , defersLoading(false)
+    , shouldBufferResource(false)
 {
 }
 
@@ -96,6 +97,7 @@
     encoder << shouldClearReferrerOnHTTPSToHTTPRedirect;
     encoder << isMainResource;
     encoder << defersLoading;
+    encoder << shouldBufferResource;
 }
 
 bool NetworkResourceLoadParameters::decode(IPC::ArgumentDecoder& decoder, NetworkResourceLoadParameters& result)
@@ -148,6 +150,8 @@
         return false;
     if (!decoder.decode(result.defersLoading))
         return false;
+    if (!decoder.decode(result.shouldBufferResource))
+        return false;
 
     return true;
 }

Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h (170957 => 170958)


--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h	2014-07-10 06:08:58 UTC (rev 170957)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h	2014-07-10 06:14:35 UTC (rev 170958)
@@ -64,6 +64,7 @@
     bool shouldClearReferrerOnHTTPSToHTTPRedirect;
     bool isMainResource;
     bool defersLoading;
+    bool shouldBufferResource;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (170957 => 170958)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	2014-07-10 06:08:58 UTC (rev 170957)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	2014-07-10 06:14:35 UTC (rev 170958)
@@ -136,6 +136,7 @@
     loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect;
     loadParameters.isMainResource = resource && resource->type() == CachedResource::MainResource;
     loadParameters.defersLoading = resourceLoader->defersLoading();
+    loadParameters.shouldBufferResource = resource && (resource->type() == CachedResource::CSSStyleSheet || resource->type() == CachedResource::Script);
 
     ASSERT((loadParameters.webPageID && loadParameters.webFrameID) || loadParameters.clientCredentialPolicy == DoNotAskClientForAnyCredentials);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to