Title: [126678] trunk/Source/WebKit/mac
Revision
126678
Author
[email protected]
Date
2012-08-24 20:42:51 -0700 (Fri, 24 Aug 2012)

Log Message

Don't create a new ResourceRequest if delegate returns the same NSURLRequest we passed it
https://bugs.webkit.org/show_bug.cgi?id=94962

Reviewed by Geoffrey Garen.

If the NSURLRequest returned from the delegate callback is the same as the one we passed to
it, then avoid creating a new ResourceRequest object. This reduces the number of calls to
ResourceRequest::doUpdateResourceRequest().

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchWillSendRequest):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (126677 => 126678)


--- trunk/Source/WebKit/mac/ChangeLog	2012-08-25 02:35:00 UTC (rev 126677)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-08-25 03:42:51 UTC (rev 126678)
@@ -1,3 +1,17 @@
+2012-08-24  Pratik Solanki  <[email protected]>
+
+        Don't create a new ResourceRequest if delegate returns the same NSURLRequest we passed it
+        https://bugs.webkit.org/show_bug.cgi?id=94962
+
+        Reviewed by Geoffrey Garen.
+
+        If the NSURLRequest returned from the delegate callback is the same as the one we passed to
+        it, then avoid creating a new ResourceRequest object. This reduces the number of calls to
+        ResourceRequest::doUpdateResourceRequest().
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::dispatchWillSendRequest):
+
 2012-08-23  Mark Hahnenberg  <[email protected]>
 
         Change behavior of MasqueradesAsUndefined to better accommodate DFG changes

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (126677 => 126678)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2012-08-25 02:35:00 UTC (rev 126677)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2012-08-25 03:42:51 UTC (rev 126678)
@@ -346,8 +346,13 @@
     if (redirectResponse.isNull())
         static_cast<WebDocumentLoaderMac*>(loader)->increaseLoadCount(identifier);
 
+    NSURLRequest *currentURLRequest = request.nsURLRequest();
+    NSURLRequest *newURLRequest = currentURLRequest;
     if (implementations->willSendRequestFunc)
-        request = (NSURLRequest *)CallResourceLoadDelegate(implementations->willSendRequestFunc, webView, @selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:), [webView _objectForIdentifier:identifier], request.nsURLRequest(), redirectResponse.nsURLResponse(), dataSource(loader));
+        newURLRequest = (NSURLRequest *)CallResourceLoadDelegate(implementations->willSendRequestFunc, webView, @selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:), [webView _objectForIdentifier:identifier], currentURLRequest, redirectResponse.nsURLResponse(), dataSource(loader));
+
+    if (newURLRequest != currentURLRequest)
+        request = newURLRequest;
 }
 
 bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader* loader, unsigned long identifier)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to