Title: [173501] trunk/Source/WebCore
Revision
173501
Author
[email protected]
Date
2014-09-10 17:47:26 -0700 (Wed, 10 Sep 2014)

Log Message

Call setCollectsTimingData only once, and before making any {CF,NS}URLConnections
https://bugs.webkit.org/show_bug.cgi?id=136731
<rdar://problem/18252844>

Reviewed by Simon Fraser.

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::start):
Move setCollectsTimingData to before createCFURLConnection, so the first connection
has timing data associated with it.

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::createNSURLConnection):
Move setCollectsTimingData to before we create our NSURLConnection, so the first connection
has timing data associated with it.
Use setCollectsTimingData instead of the NSURLConnection SPI directly.

(WebCore::ResourceHandle::setCollectsTimingData):
Only call _setCollectsTimingData once.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173500 => 173501)


--- trunk/Source/WebCore/ChangeLog	2014-09-11 00:38:53 UTC (rev 173500)
+++ trunk/Source/WebCore/ChangeLog	2014-09-11 00:47:26 UTC (rev 173501)
@@ -1,3 +1,25 @@
+2014-09-10  Tim Horton  <[email protected]>
+
+        Call setCollectsTimingData only once, and before making any {CF,NS}URLConnections
+        https://bugs.webkit.org/show_bug.cgi?id=136731
+        <rdar://problem/18252844>
+
+        Reviewed by Simon Fraser.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::start):
+        Move setCollectsTimingData to before createCFURLConnection, so the first connection
+        has timing data associated with it.
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::createNSURLConnection):
+        Move setCollectsTimingData to before we create our NSURLConnection, so the first connection
+        has timing data associated with it.
+        Use setCollectsTimingData instead of the NSURLConnection SPI directly.
+
+        (WebCore::ResourceHandle::setCollectsTimingData):
+        Only call _setCollectsTimingData once.
+
 2014-09-10  Enrica Casucci  <[email protected]>
 
         Remove iOS-only -webkit-composition-fill-color CSS property.

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (173500 => 173501)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2014-09-11 00:38:53 UTC (rev 173500)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2014-09-11 00:47:26 UTC (rev 173501)
@@ -249,6 +249,10 @@
 
     bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
 
+#if ENABLE(WEB_TIMING)
+    setCollectsTimingData();
+#endif
+
     createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff, SchedulingBehavior::Asynchronous, client()->connectionProperties(this).get());
 
     d->m_connectionDelegate->setupConnectionScheduling(d->m_connection.get());
@@ -256,10 +260,6 @@
 
     LOG(Network, "CFNet - Starting URL %s (handle=%p, conn=%p)", firstRequest().url().string().utf8().data(), this, d->m_connection.get());
     
-#if ENABLE(WEB_TIMING)
-    setCollectsTimingData();
-#endif
-    
     return true;
 }
 

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (173500 => 173501)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2014-09-11 00:38:53 UTC (rev 173500)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2014-09-11 00:47:26 UTC (rev 173501)
@@ -144,6 +144,10 @@
 void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior schedulingBehavior, NSDictionary *connectionProperties)
 #endif
 {
+#if ENABLE(WEB_TIMING)
+    setCollectsTimingData();
+#endif
+
     // Credentials for ftp can only be passed in URL, the connection:didReceiveAuthenticationChallenge: delegate call won't be made.
     if ((!d->m_user.isEmpty() || !d->m_pass.isEmpty()) && !firstRequest().url().protocolIsInHTTPFamily()) {
         URL urlWithCredentials(firstRequest().url());
@@ -221,9 +225,6 @@
     const bool usesCache = true;
 #endif
     d->m_connection = adoptNS([[NSURLConnection alloc] _initWithRequest:nsRequest delegate:delegate usesCache:usesCache maxContentLength:0 startImmediately:NO connectionProperties:propertyDictionary]);
-#if ENABLE(WEB_TIMING)
-    [NSURLConnection _setCollectsTimingData:YES];
-#endif
 }
 
 bool ResourceHandle::start()
@@ -758,7 +759,10 @@
     
 void ResourceHandle::setCollectsTimingData()
 {
-    [NSURLConnection _setCollectsTimingData:YES];
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        [NSURLConnection _setCollectsTimingData:YES];
+    });
 }
     
 void ResourceHandle::getConnectionTimingData(CFURLConnectionRef connection, ResourceLoadTiming& timing)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to