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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173501
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-09-10 Tim Horton <timothy_horton@apple.com>
+
+ 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 <enrica@apple.com>
Remove iOS-only -webkit-composition-fill-color CSS property.
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());
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;
}
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());
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()
void ResourceHandle::setCollectsTimingData()
{
- [NSURLConnection _setCollectsTimingData:YES];
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ [NSURLConnection _setCollectsTimingData:YES];
+ });
}
void ResourceHandle::getConnectionTimingData(CFURLConnectionRef connection, ResourceLoadTiming& timing)