<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[169082] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/169082">169082</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2014-05-19 16:45:54 -0700 (Mon, 19 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleh">trunk/Source/WebCore/platform/network/ResourceHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegatecpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateh">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueuecpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueueh">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegatecpp">trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegateh">trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm">trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacWebCoreResourceHandleAsDelegatemm">trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacWebCoreResourceHandleAsOperationQueueDelegatemm">trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-05-19  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        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.
+
</ins><span class="cx"> 2014-05-19  Chris Fleizach  &lt;cfleizach@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: VoiceOver sees the WebArea out of order when topContentInset is used
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -131,12 +131,20 @@
</span><span class="cx"> #if PLATFORM(COCOA) &amp;&amp; !USE(CFNETWORK)
</span><span class="cx">     void didCancelAuthenticationChallenge(const AuthenticationChallenge&amp;);
</span><span class="cx">     NSURLConnection *connection() const;
</span><del>-    static void getTimingData(NSURLConnection*, ResourceLoadTiming&amp;);
</del><span class="cx">     id makeDelegate(bool);
</span><span class="cx">     id delegate();
</span><span class="cx">     void releaseDelegate();
</span><span class="cx"> #endif
</span><del>-
</del><ins>+        
+#if PLATFORM(COCOA) &amp;&amp; ENABLE(WEB_TIMING)
+#if USE(CFNETWORK)
+    void setCollectsTimingData();
+    static void getConnectionTimingData(CFURLConnectionRef, ResourceLoadTiming&amp;);
+#else
+    static void getConnectionTimingData(NSURLConnection *, ResourceLoadTiming&amp;);
+#endif
+#endif
+        
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     void schedule(WTF::SchedulePair&amp;);
</span><span class="cx">     void unschedule(WTF::SchedulePair&amp;);
</span><span class="lines">@@ -289,6 +297,10 @@
</span><span class="cx">     void createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA) &amp;&amp; ENABLE(WEB_TIMING)
+static void getConnectionTimingData(NSDictionary *timingData, ResourceLoadTiming&amp;);
+#endif
+
</ins><span class="cx">     friend class ResourceHandleInternal;
</span><span class="cx">     OwnPtr&lt;ResourceHandleInternal&gt; d;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -254,7 +254,11 @@
</span><span class="cx">     CFURLConnectionStart(d-&gt;m_connection.get());
</span><span class="cx"> 
</span><span class="cx">     LOG(Network, &quot;CFNet - Starting URL %s (handle=%p, conn=%p)&quot;, firstRequest().url().string().utf8().data(), this, d-&gt;m_connection.get());
</span><del>-
</del><ins>+    
+#if ENABLE(WEB_TIMING)
+    setCollectsTimingData();
+#endif
+    
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -61,9 +61,9 @@
</span><span class="cx">     return static_cast&lt;ResourceHandleCFURLConnectionDelegate*&gt;(const_cast&lt;void*&gt;(clientInfo))-&gt;willSendRequest(cfRequest, originalRedirectResponse);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ResourceHandleCFURLConnectionDelegate::didReceiveResponseCallback(CFURLConnectionRef, CFURLResponseRef cfResponse, const void* clientInfo)
</del><ins>+void ResourceHandleCFURLConnectionDelegate::didReceiveResponseCallback(CFURLConnectionRef connection, CFURLResponseRef cfResponse, const void* clientInfo)
</ins><span class="cx"> {
</span><del>-    static_cast&lt;ResourceHandleCFURLConnectionDelegate*&gt;(const_cast&lt;void*&gt;(clientInfo))-&gt;didReceiveResponse(cfResponse);
</del><ins>+    static_cast&lt;ResourceHandleCFURLConnectionDelegate*&gt;(const_cast&lt;void*&gt;(clientInfo))-&gt;didReceiveResponse(connection, cfResponse);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ResourceHandleCFURLConnectionDelegate::didReceiveDataCallback(CFURLConnectionRef, CFDataRef data, CFIndex originalLength, const void* clientInfo)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> #endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><span class="cx"> 
</span><span class="cx">     virtual CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) = 0;
</span><del>-    virtual void didReceiveResponse(CFURLResponseRef) = 0;
</del><ins>+    virtual void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef) = 0;
</ins><span class="cx">     virtual void didReceiveData(CFDataRef, CFIndex originalLength) = 0;
</span><span class="cx">     virtual void didFinishLoading() = 0;
</span><span class="cx">     virtual void didFail(CFErrorRef) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">     return m_requestResult.leakRef();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse(CFURLResponseRef cfResponse)
</del><ins>+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse(CFURLConnectionRef connection, CFURLResponseRef cfResponse)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;ResourceHandleCFURLConnectionDelegateWithOperationQueue&gt; protector(this);
</span><span class="cx"> 
</span><span class="lines">@@ -131,8 +131,15 @@
</span><span class="cx">         if (_CFURLRequestCopyProtocolPropertyForKey(m_handle-&gt;firstRequest().cfURLRequest(DoNotUpdateHTTPBody), CFSTR(&quot;ForceHTMLMIMEType&quot;)))
</span><span class="cx">             wkSetCFURLResponseMIMEType(cfResponse, CFSTR(&quot;text/html&quot;));
</span><span class="cx"> #endif // !PLATFORM(IOS)
</span><del>-
-        m_handle-&gt;client()-&gt;didReceiveResponseAsync(m_handle, cfResponse);
</del><ins>+        
+        ResourceResponse resourceResponse(cfResponse);
+#if ENABLE(WEB_TIMING)
+        ResourceHandle::getConnectionTimingData(connection, resourceResponse.resourceLoadTiming());
+#else
+        UNUSED_PARAM(connection);
+#endif
+        
+        m_handle-&gt;client()-&gt;didReceiveResponseAsync(m_handle, resourceResponse);
</ins><span class="cx">     });
</span><span class="cx">     dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">     virtual void setupConnectionScheduling(CFURLConnectionRef) override;
</span><span class="cx"> 
</span><span class="cx">     virtual CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) override;
</span><del>-    virtual void didReceiveResponse(CFURLResponseRef) override;
</del><ins>+    virtual void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef) override;
</ins><span class="cx">     virtual void didReceiveData(CFDataRef, CFIndex originalLength) override;
</span><span class="cx">     virtual void didFinishLoading() override;
</span><span class="cx">     virtual void didFail(CFErrorRef) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // !PLATFORM(COCOA)
</span><span class="cx"> 
</span><del>-void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLResponseRef cfResponse)
</del><ins>+void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLConnectionRef connection, CFURLResponseRef cfResponse)
</ins><span class="cx"> {
</span><span class="cx">     LOG(Network, &quot;CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(handle=%p) (%s)&quot;, m_handle, m_handle-&gt;firstRequest().url().string().utf8().data());
</span><span class="cx"> 
</span><span class="lines">@@ -143,8 +143,15 @@
</span><span class="cx">     if (m_handle-&gt;quickLookHandle())
</span><span class="cx">         cfResponse = m_handle-&gt;quickLookHandle()-&gt;cfResponse();
</span><span class="cx"> #endif
</span><del>-
-    m_handle-&gt;client()-&gt;didReceiveResponse(m_handle, cfResponse);
</del><ins>+    
+    ResourceResponse resourceResponse(cfResponse);
+#if ENABLE(WEB_TIMING)
+    ResourceHandle::getConnectionTimingData(connection, resourceResponse.resourceLoadTiming());
+#else
+    UNUSED_PARAM(connection);
+#endif
+    
+    m_handle-&gt;client()-&gt;didReceiveResponse(m_handle, resourceResponse);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData(CFDataRef data, CFIndex originalLength)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">     virtual void setupConnectionScheduling(CFURLConnectionRef) override;
</span><span class="cx"> 
</span><span class="cx">     virtual CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) override;
</span><del>-    virtual void didReceiveResponse(CFURLResponseRef) override;
</del><ins>+    virtual void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef) override;
</ins><span class="cx">     virtual CFCachedURLResponseRef willCacheResponse(CFCachedURLResponseRef) override;
</span><span class="cx">     virtual void didReceiveChallenge(CFURLAuthChallengeRef) override;
</span><span class="cx">     virtual void didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -26,8 +26,6 @@
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> #import &quot;ResourceHandleInternal.h&quot;
</span><span class="cx"> 
</span><del>-#if !USE(CFNETWORK)
-
</del><span class="cx"> #import &quot;AuthenticationChallenge.h&quot;
</span><span class="cx"> #import &quot;AuthenticationMac.h&quot;
</span><span class="cx"> #import &quot;BlockExceptions.h&quot;
</span><span class="lines">@@ -87,7 +85,9 @@
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><del>-
</del><ins>+    
+#if !USE(CFNETWORK)
+    
</ins><span class="cx"> static void applyBasicAuthorizationHeader(ResourceRequest&amp; request, const Credential&amp; credential)
</span><span class="cx"> {
</span><span class="cx">     String authenticationHeader = &quot;Basic &quot; + base64Encode(String(credential.user() + &quot;:&quot; + credential.password()).utf8());
</span><span class="lines">@@ -370,36 +370,6 @@
</span><span class="cx">     return d-&gt;m_connection.get();
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-void ResourceHandle::getTimingData(NSURLConnection *connection, ResourceLoadTiming&amp; 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:@&quot;_kCFNTimingDataTimingDataInit&quot;] doubleValue];
-        
-        double domainLookupStart = [[timingData valueForKey:@&quot;_kCFNTimingDataDomainLookupStart&quot;] doubleValue];
-        double domainLookupEnd = [[timingData valueForKey:@&quot;_kCFNTimingDataDomainLookupEnd&quot;] doubleValue];
-        double connectStart = [[timingData valueForKey:@&quot;_kCFNTimingDataConnectStart&quot;] doubleValue];
-        double secureConnectionStart = [[timingData valueForKey:@&quot;_kCFNTimingDataSecureConnectionStart&quot;] doubleValue];
-        double connectEnd = [[timingData valueForKey:@&quot;_kCFNTimingDataConnectEnd&quot;] doubleValue];
-        double requestStart = [[timingData valueForKey:@&quot;_kCFNTimingDataRequestStart&quot;] doubleValue];
-        double responseStart = [[timingData valueForKey:@&quot;_kCFNTimingDataResponseStart&quot;] doubleValue];
-        
-        timing.domainLookupStart = domainLookupStart &lt;= 0 ? -1 : (domainLookupStart - referenceStart) * 1000;
-        timing.domainLookupEnd = domainLookupEnd &lt;= 0 ? -1 : (domainLookupEnd - referenceStart) * 1000;
-        timing.connectStart = connectStart &lt;= 0 ? -1 : (connectStart - referenceStart) * 1000;
-        timing.secureConnectionStart = secureConnectionStart &lt;= 0 ? -1 : (secureConnectionStart - referenceStart) * 1000;
-        timing.connectEnd = connectEnd &lt;= 0 ? -1 : (connectEnd - referenceStart) * 1000;
-        timing.requestStart = requestStart &lt;= 0 ? -1 : (requestStart - referenceStart) * 1000;
-        timing.responseStart = responseStart &lt;= 0 ? -1 : (responseStart - referenceStart) * 1000;
-    }
-#else
-    UNUSED_PARAM(connection);
-    UNUSED_PARAM(timing);
-#endif
-}
-    
</del><span class="cx"> bool ResourceHandle::loadsBlocked()
</span><span class="cx"> {
</span><span class="cx">     return false;
</span><span class="lines">@@ -735,8 +705,59 @@
</span><span class="cx"> 
</span><span class="cx">     [(id)delegate() continueWillCacheResponse:response];
</span><span class="cx"> }
</span><ins>+    
+#endif // !USE(CFNETWORK)
+    
+#if ENABLE(WEB_TIMING)
+    
+void ResourceHandle::getConnectionTimingData(NSDictionary *timingData, ResourceLoadTiming&amp; timing)
+{
+    if (!timingData)
+        return;
</ins><span class="cx"> 
</span><ins>+    // 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:@&quot;_kCFNTimingDataTimingDataInit&quot;] doubleValue];
+            
+    double domainLookupStart = [[timingData valueForKey:@&quot;_kCFNTimingDataDomainLookupStart&quot;] doubleValue];
+    double domainLookupEnd = [[timingData valueForKey:@&quot;_kCFNTimingDataDomainLookupEnd&quot;] doubleValue];
+    double connectStart = [[timingData valueForKey:@&quot;_kCFNTimingDataConnectStart&quot;] doubleValue];
+    double secureConnectionStart = [[timingData valueForKey:@&quot;_kCFNTimingDataSecureConnectionStart&quot;] doubleValue];
+    double connectEnd = [[timingData valueForKey:@&quot;_kCFNTimingDataConnectEnd&quot;] doubleValue];
+    double requestStart = [[timingData valueForKey:@&quot;_kCFNTimingDataRequestStart&quot;] doubleValue];
+    double responseStart = [[timingData valueForKey:@&quot;_kCFNTimingDataResponseStart&quot;] doubleValue];
+        
+    timing.domainLookupStart = domainLookupStart &lt;= 0 ? -1 : (domainLookupStart - referenceStart) * 1000;
+    timing.domainLookupEnd = domainLookupEnd &lt;= 0 ? -1 : (domainLookupEnd - referenceStart) * 1000;
+    timing.connectStart = connectStart &lt;= 0 ? -1 : (connectStart - referenceStart) * 1000;
+    timing.secureConnectionStart = secureConnectionStart &lt;= 0 ? -1 : (secureConnectionStart - referenceStart) * 1000;
+    timing.connectEnd = connectEnd &lt;= 0 ? -1 : (connectEnd - referenceStart) * 1000;
+    timing.requestStart = requestStart &lt;= 0 ? -1 : (requestStart - referenceStart) * 1000;
+    timing.responseStart = responseStart &lt;= 0 ? -1 : (responseStart - referenceStart) * 1000;
+}
+    
+#if USE(CFNETWORK)
+    
+void ResourceHandle::setCollectsTimingData()
+{
+    [NSURLConnection _setCollectsTimingData:YES];
+}
+    
+void ResourceHandle::getConnectionTimingData(CFURLConnectionRef connection, ResourceLoadTiming&amp; timing)
+{
+    getConnectionTimingData((__bridge NSDictionary*)(adoptCF(_CFURLConnectionCopyTimingData(connection)).get()), timing);
+}
+    
+#else
+    
+void ResourceHandle::getConnectionTimingData(NSURLConnection *connection, ResourceLoadTiming&amp; timing)
+{
+    getConnectionTimingData([connection _timingData], timing);
+}
+    
+#endif
+    
+#endif // ENABLE(WEB_TIMING)
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-#endif // !USE(CFNETWORK)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacWebCoreResourceHandleAsDelegatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx">     
</span><span class="cx">     ResourceResponse resourceResponse(r);
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span><del>-    ResourceHandle::getTimingData(connection, resourceResponse.resourceLoadTiming());
</del><ins>+    ResourceHandle::getConnectionTimingData(connection, resourceResponse.resourceLoadTiming());
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(connection);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacWebCoreResourceHandleAsOperationQueueDelegatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm (169081 => 169082)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -214,7 +214,7 @@
</span><span class="cx">         
</span><span class="cx">         ResourceResponse resourceResponse(r);
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span><del>-        ResourceHandle::getTimingData(connection, resourceResponse.resourceLoadTiming());
</del><ins>+        ResourceHandle::getConnectionTimingData(connection, resourceResponse.resourceLoadTiming());
</ins><span class="cx"> #else
</span><span class="cx">         UNUSED_PARAM(connection);
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>