Diff
Modified: trunk/Source/WebCore/ChangeLog (169081 => 169082)
--- trunk/Source/WebCore/ChangeLog 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/ChangeLog 2014-05-19 23:45:54 UTC (rev 169082)
@@ -1,3 +1,39 @@
+2014-05-19 Alex Christensen <achristen...@webkit.org>
+
+ Collect web timing data on iOS.
+ https://bugs.webkit.org/show_bug.cgi?id=133075
+
+ Reviewed by Sam Weinig.
+
+ * platform/network/ResourceHandle.h:
+ Added setCollectsTimingData wrapper and getConnectionTimingData declarations.
+ getConnectionTimingData with a dictionary parameter is a private helper function.
+ * platform/network/cf/ResourceHandleCFNet.cpp:
+ (WebCore::ResourceHandle::start):
+ Call setCollectsTimingData wrapper when creating a connection to ensure that timing data is collected.
+ * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
+ (WebCore::ResourceHandleCFURLConnectionDelegate::didReceiveResponseCallback):
+ * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
+ * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
+ * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
+ * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
+ * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
+ Pass the CFURLConnectionRef to didReceiveResponse to get timing data from.
+ * platform/network/mac/ResourceHandleMac.mm:
+ (WebCore::ResourceHandle::getConnectionTimingData):
+ Moved from getTimingData to compile regardless of using CFNetwork and added wrapper with CFDictionaryRef.
+ (WebCore::ResourceHandle::setCollectsTimingData):
+ Added wrapper to call objc function from c++.
+ (WebCore::ResourceHandle::getTimingData):
+ Renamed to getConnectionTimingData.
+ * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
+ (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
+ * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
+ (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
+ Updated function name from getTimingData to getConnectionTimingData.
+
2014-05-19 Chris Fleizach <cfleiz...@apple.com>
AX: VoiceOver sees the WebArea out of order when topContentInset is used
Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (169081 => 169082)
--- trunk/Source/WebCore/platform/network/ResourceHandle.h 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h 2014-05-19 23:45:54 UTC (rev 169082)
@@ -131,12 +131,20 @@
#if PLATFORM(COCOA) && !USE(CFNETWORK)
void didCancelAuthenticationChallenge(const AuthenticationChallenge&);
NSURLConnection *connection() const;
- static void getTimingData(NSURLConnection*, ResourceLoadTiming&);
id makeDelegate(bool);
id delegate();
void releaseDelegate();
#endif
-
+
+#if PLATFORM(COCOA) && ENABLE(WEB_TIMING)
+#if USE(CFNETWORK)
+ void setCollectsTimingData();
+ static void getConnectionTimingData(CFURLConnectionRef, ResourceLoadTiming&);
+#else
+ static void getConnectionTimingData(NSURLConnection *, ResourceLoadTiming&);
+#endif
+#endif
+
#if PLATFORM(COCOA)
void schedule(WTF::SchedulePair&);
void unschedule(WTF::SchedulePair&);
@@ -289,6 +297,10 @@
void createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior);
#endif
+#if PLATFORM(COCOA) && ENABLE(WEB_TIMING)
+static void getConnectionTimingData(NSDictionary *timingData, ResourceLoadTiming&);
+#endif
+
friend class ResourceHandleInternal;
OwnPtr<ResourceHandleInternal> d;
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (169081 => 169082)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2014-05-19 23:45:54 UTC (rev 169082)
@@ -254,7 +254,11 @@
CFURLConnectionStart(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;
}
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp (169081 => 169082)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp 2014-05-19 23:45:54 UTC (rev 169082)
@@ -61,9 +61,9 @@
return static_cast<ResourceHandleCFURLConnectionDelegate*>(const_cast<void*>(clientInfo))->willSendRequest(cfRequest, originalRedirectResponse);
}
-void ResourceHandleCFURLConnectionDelegate::didReceiveResponseCallback(CFURLConnectionRef, CFURLResponseRef cfResponse, const void* clientInfo)
+void ResourceHandleCFURLConnectionDelegate::didReceiveResponseCallback(CFURLConnectionRef connection, CFURLResponseRef cfResponse, const void* clientInfo)
{
- static_cast<ResourceHandleCFURLConnectionDelegate*>(const_cast<void*>(clientInfo))->didReceiveResponse(cfResponse);
+ static_cast<ResourceHandleCFURLConnectionDelegate*>(const_cast<void*>(clientInfo))->didReceiveResponse(connection, cfResponse);
}
void ResourceHandleCFURLConnectionDelegate::didReceiveDataCallback(CFURLConnectionRef, CFDataRef data, CFIndex originalLength, const void* clientInfo)
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h (169081 => 169082)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h 2014-05-19 23:45:54 UTC (rev 169082)
@@ -76,7 +76,7 @@
#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
virtual CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) = 0;
- virtual void didReceiveResponse(CFURLResponseRef) = 0;
+ virtual void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef) = 0;
virtual void didReceiveData(CFDataRef, CFIndex originalLength) = 0;
virtual void didFinishLoading() = 0;
virtual void didFail(CFErrorRef) = 0;
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp (169081 => 169082)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp 2014-05-19 23:45:54 UTC (rev 169082)
@@ -108,7 +108,7 @@
return m_requestResult.leakRef();
}
-void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse(CFURLResponseRef cfResponse)
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse(CFURLConnectionRef connection, CFURLResponseRef cfResponse)
{
RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
@@ -131,8 +131,15 @@
if (_CFURLRequestCopyProtocolPropertyForKey(m_handle->firstRequest().cfURLRequest(DoNotUpdateHTTPBody), CFSTR("ForceHTMLMIMEType")))
wkSetCFURLResponseMIMEType(cfResponse, CFSTR("text/html"));
#endif // !PLATFORM(IOS)
-
- m_handle->client()->didReceiveResponseAsync(m_handle, cfResponse);
+
+ ResourceResponse resourceResponse(cfResponse);
+#if ENABLE(WEB_TIMING)
+ ResourceHandle::getConnectionTimingData(connection, resourceResponse.resourceLoadTiming());
+#else
+ UNUSED_PARAM(connection);
+#endif
+
+ m_handle->client()->didReceiveResponseAsync(m_handle, resourceResponse);
});
dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
}
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h (169081 => 169082)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h 2014-05-19 23:45:54 UTC (rev 169082)
@@ -47,7 +47,7 @@
virtual void setupConnectionScheduling(CFURLConnectionRef) override;
virtual CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) override;
- virtual void didReceiveResponse(CFURLResponseRef) override;
+ virtual void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef) override;
virtual void didReceiveData(CFDataRef, CFIndex originalLength) override;
virtual void didFinishLoading() override;
virtual void didFail(CFErrorRef) override;
Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp (169081 => 169082)
--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp 2014-05-19 23:45:54 UTC (rev 169082)
@@ -111,7 +111,7 @@
}
#endif // !PLATFORM(COCOA)
-void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLResponseRef cfResponse)
+void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLConnectionRef connection, CFURLResponseRef cfResponse)
{
LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
@@ -143,8 +143,15 @@
if (m_handle->quickLookHandle())
cfResponse = m_handle->quickLookHandle()->cfResponse();
#endif
-
- m_handle->client()->didReceiveResponse(m_handle, cfResponse);
+
+ ResourceResponse resourceResponse(cfResponse);
+#if ENABLE(WEB_TIMING)
+ ResourceHandle::getConnectionTimingData(connection, resourceResponse.resourceLoadTiming());
+#else
+ UNUSED_PARAM(connection);
+#endif
+
+ m_handle->client()->didReceiveResponse(m_handle, resourceResponse);
}
void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData(CFDataRef data, CFIndex originalLength)
Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h (169081 => 169082)
--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h 2014-05-19 23:45:54 UTC (rev 169082)
@@ -48,7 +48,7 @@
virtual void setupConnectionScheduling(CFURLConnectionRef) override;
virtual CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) override;
- virtual void didReceiveResponse(CFURLResponseRef) override;
+ virtual void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef) override;
virtual CFCachedURLResponseRef willCacheResponse(CFCachedURLResponseRef) override;
virtual void didReceiveChallenge(CFURLAuthChallengeRef) override;
virtual void didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite) override;
Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (169081 => 169082)
--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm 2014-05-19 23:45:54 UTC (rev 169082)
@@ -26,8 +26,6 @@
#import "config.h"
#import "ResourceHandleInternal.h"
-#if !USE(CFNETWORK)
-
#import "AuthenticationChallenge.h"
#import "AuthenticationMac.h"
#import "BlockExceptions.h"
@@ -87,7 +85,9 @@
@end
namespace WebCore {
-
+
+#if !USE(CFNETWORK)
+
static void applyBasicAuthorizationHeader(ResourceRequest& request, const Credential& credential)
{
String authenticationHeader = "Basic " + base64Encode(String(credential.user() + ":" + credential.password()).utf8());
@@ -370,36 +370,6 @@
return d->m_connection.get();
}
-void ResourceHandle::getTimingData(NSURLConnection *connection, ResourceLoadTiming& timing)
-{
-#if ENABLE(WEB_TIMING)
- if (NSDictionary *timingData = [connection _timingData]) {
- // This is not the navigationStart time in monotonic time, but the other times are relative to this time
- // and only the differences between times are stored.
- double referenceStart = [[timingData valueForKey:@"_kCFNTimingDataTimingDataInit"] doubleValue];
-
- double domainLookupStart = [[timingData valueForKey:@"_kCFNTimingDataDomainLookupStart"] doubleValue];
- double domainLookupEnd = [[timingData valueForKey:@"_kCFNTimingDataDomainLookupEnd"] doubleValue];
- double connectStart = [[timingData valueForKey:@"_kCFNTimingDataConnectStart"] doubleValue];
- double secureConnectionStart = [[timingData valueForKey:@"_kCFNTimingDataSecureConnectionStart"] doubleValue];
- double connectEnd = [[timingData valueForKey:@"_kCFNTimingDataConnectEnd"] doubleValue];
- double requestStart = [[timingData valueForKey:@"_kCFNTimingDataRequestStart"] doubleValue];
- double responseStart = [[timingData valueForKey:@"_kCFNTimingDataResponseStart"] doubleValue];
-
- timing.domainLookupStart = domainLookupStart <= 0 ? -1 : (domainLookupStart - referenceStart) * 1000;
- timing.domainLookupEnd = domainLookupEnd <= 0 ? -1 : (domainLookupEnd - referenceStart) * 1000;
- timing.connectStart = connectStart <= 0 ? -1 : (connectStart - referenceStart) * 1000;
- timing.secureConnectionStart = secureConnectionStart <= 0 ? -1 : (secureConnectionStart - referenceStart) * 1000;
- timing.connectEnd = connectEnd <= 0 ? -1 : (connectEnd - referenceStart) * 1000;
- timing.requestStart = requestStart <= 0 ? -1 : (requestStart - referenceStart) * 1000;
- timing.responseStart = responseStart <= 0 ? -1 : (responseStart - referenceStart) * 1000;
- }
-#else
- UNUSED_PARAM(connection);
- UNUSED_PARAM(timing);
-#endif
-}
-
bool ResourceHandle::loadsBlocked()
{
return false;
@@ -735,8 +705,59 @@
[(id)delegate() continueWillCacheResponse:response];
}
+
+#endif // !USE(CFNETWORK)
+
+#if ENABLE(WEB_TIMING)
+
+void ResourceHandle::getConnectionTimingData(NSDictionary *timingData, ResourceLoadTiming& timing)
+{
+ if (!timingData)
+ return;
+ // This is not the navigationStart time in monotonic time, but the other times are relative to this time
+ // and only the differences between times are stored.
+ double referenceStart = [[timingData valueForKey:@"_kCFNTimingDataTimingDataInit"] doubleValue];
+
+ double domainLookupStart = [[timingData valueForKey:@"_kCFNTimingDataDomainLookupStart"] doubleValue];
+ double domainLookupEnd = [[timingData valueForKey:@"_kCFNTimingDataDomainLookupEnd"] doubleValue];
+ double connectStart = [[timingData valueForKey:@"_kCFNTimingDataConnectStart"] doubleValue];
+ double secureConnectionStart = [[timingData valueForKey:@"_kCFNTimingDataSecureConnectionStart"] doubleValue];
+ double connectEnd = [[timingData valueForKey:@"_kCFNTimingDataConnectEnd"] doubleValue];
+ double requestStart = [[timingData valueForKey:@"_kCFNTimingDataRequestStart"] doubleValue];
+ double responseStart = [[timingData valueForKey:@"_kCFNTimingDataResponseStart"] doubleValue];
+
+ timing.domainLookupStart = domainLookupStart <= 0 ? -1 : (domainLookupStart - referenceStart) * 1000;
+ timing.domainLookupEnd = domainLookupEnd <= 0 ? -1 : (domainLookupEnd - referenceStart) * 1000;
+ timing.connectStart = connectStart <= 0 ? -1 : (connectStart - referenceStart) * 1000;
+ timing.secureConnectionStart = secureConnectionStart <= 0 ? -1 : (secureConnectionStart - referenceStart) * 1000;
+ timing.connectEnd = connectEnd <= 0 ? -1 : (connectEnd - referenceStart) * 1000;
+ timing.requestStart = requestStart <= 0 ? -1 : (requestStart - referenceStart) * 1000;
+ timing.responseStart = responseStart <= 0 ? -1 : (responseStart - referenceStart) * 1000;
+}
+
+#if USE(CFNETWORK)
+
+void ResourceHandle::setCollectsTimingData()
+{
+ [NSURLConnection _setCollectsTimingData:YES];
+}
+
+void ResourceHandle::getConnectionTimingData(CFURLConnectionRef connection, ResourceLoadTiming& timing)
+{
+ getConnectionTimingData((__bridge NSDictionary*)(adoptCF(_CFURLConnectionCopyTimingData(connection)).get()), timing);
+}
+
+#else
+
+void ResourceHandle::getConnectionTimingData(NSURLConnection *connection, ResourceLoadTiming& timing)
+{
+ getConnectionTimingData([connection _timingData], timing);
+}
+
+#endif
+
+#endif // ENABLE(WEB_TIMING)
} // namespace WebCore
-#endif // !USE(CFNETWORK)
Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm (169081 => 169082)
--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm 2014-05-19 23:45:54 UTC (rev 169082)
@@ -172,7 +172,7 @@
ResourceResponse resourceResponse(r);
#if ENABLE(WEB_TIMING)
- ResourceHandle::getTimingData(connection, resourceResponse.resourceLoadTiming());
+ ResourceHandle::getConnectionTimingData(connection, resourceResponse.resourceLoadTiming());
#else
UNUSED_PARAM(connection);
#endif
Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm (169081 => 169082)
--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm 2014-05-19 23:37:56 UTC (rev 169081)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm 2014-05-19 23:45:54 UTC (rev 169082)
@@ -214,7 +214,7 @@
ResourceResponse resourceResponse(r);
#if ENABLE(WEB_TIMING)
- ResourceHandle::getTimingData(connection, resourceResponse.resourceLoadTiming());
+ ResourceHandle::getConnectionTimingData(connection, resourceResponse.resourceLoadTiming());
#else
UNUSED_PARAM(connection);
#endif