<!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>[200887] trunk</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/200887">200887</a></dd>
<dt>Author</dt> <dd>yoav@yoav.ws</dd>
<dt>Date</dt> <dd>2016-05-13 15:34:29 -0700 (Fri, 13 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>ResourceTiming entries for cached resources and XHR
https://bugs.webkit.org/show_bug.cgi?id=157669

Reviewed by Alex Christensen.

Source/WebCore:

 - Moves the ResourceTiming storage and addition logic into its own class, so that it
   can be accessed by both CachedResourceLoader and DocumentThreadableLoader.
 - Using the above, adds ResourceTiming collection into DocumentThreadableLoader,
   in order to support ResourceTiming entries for XHR based requests.
 - Adds ResourceTiming entries for resources that are reused from the memory cache.

Test: http/tests/performance/performance-resource-timing-cached-entries.html

* CMakeLists.txt: Add ResourceTimingInformation.
* WebCore.xcodeproj/project.pbxproj: Add ResourceTimingInformation.
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::didFinishLoading): Add a call to addResourceTiming.
(WebCore::DocumentThreadableLoader::loadRequest): Store the initiator information.
* loader/DocumentThreadableLoader.h:
* loader/ResourceTimingInformation.cpp: Added.
(WebCore::ResourceTimingInformation::addResourceTiming): Moved addResourceTiming logic from CachedResourceLoader.
(WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation): Moved addResourceTiming logic from
CachedResourceLoader. Removed reliance on the committingFirstRealLoad bool when storing initiator info, as I don't
see why it is required, and it made no sense in the context of DocumentThreadableLoader.
* loader/ResourceTimingInformation.h: Added.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource): Add a ResourceTiming entry when a resource is reused from MemoryCache.
(WebCore::CachedResourceLoader::revalidateResource): Use ResourceTimingInformation::storeResourceTimingInitiatorInformation.
(WebCore::CachedResourceLoader::loadResource): Use ResourceTimingInformation::storeResourceTimingInitiatorInformation.
(WebCore::CachedResourceLoader::loadDone): Use ResourceTimingInformation::addResourceTiming.
(WebCore::CachedResourceLoader::storeResourceTimingInitiatorInformation): Deleted.
* loader/cache/CachedResourceLoader.h:

LayoutTests:

These tests make sure that cacheable resources as well as XHR based resources
have ResourceTiming entries.

* http/tests/performance/performance-resource-timing-cached-entries-expected.txt: Added.
* http/tests/performance/performance-resource-timing-cached-entries.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentThreadableLoadercpp">trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentThreadableLoaderh">trunk/Source/WebCore/loader/DocumentThreadableLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoaderh">trunk/Source/WebCore/loader/cache/CachedResourceLoader.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsperformanceperformanceresourcetimingcachedentriesexpectedtxt">trunk/LayoutTests/http/tests/performance/performance-resource-timing-cached-entries-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsperformanceperformanceresourcetimingcachedentrieshtml">trunk/LayoutTests/http/tests/performance/performance-resource-timing-cached-entries.html</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceTimingInformationcpp">trunk/Source/WebCore/loader/ResourceTimingInformation.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceTimingInformationh">trunk/Source/WebCore/loader/ResourceTimingInformation.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (200886 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-05-13 22:22:45 UTC (rev 200886)
+++ trunk/LayoutTests/ChangeLog        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-05-13  Yoav Weiss  &lt;yoav@yoav.ws&gt;
+
+        ResourceTiming entries for cached resources and XHR
+        https://bugs.webkit.org/show_bug.cgi?id=157669
+
+        Reviewed by Alex Christensen.
+
+        These tests make sure that cacheable resources as well as XHR based resources
+        have ResourceTiming entries.
+
+        * http/tests/performance/performance-resource-timing-cached-entries-expected.txt: Added.
+        * http/tests/performance/performance-resource-timing-cached-entries.html: Added.
+
</ins><span class="cx"> 2016-05-13  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         We should have one calleeSaveRegistersBuffer per VMEntryFrame, not one per VM.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsperformanceperformanceresourcetimingcachedentriesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/performance/performance-resource-timing-cached-entries-expected.txt (0 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/performance/performance-resource-timing-cached-entries-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/performance/performance-resource-timing-cached-entries-expected.txt        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+PASS foundResource is 2
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsperformanceperformanceresourcetimingcachedentrieshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/performance/performance-resource-timing-cached-entries.html (0 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/performance/performance-resource-timing-cached-entries.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/performance/performance-resource-timing-cached-entries.html        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;script&gt;
+    if (window.internals)
+        internals.setResourceTimingSupport(true);
+    if (window.testRunner) {
+        testRunner.dumpAsText()
+        testRunner.waitUntilDone();
+    }
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;img src=&quot;../../resources/square100.png&quot;&gt;
+&lt;script&gt;
+    var foundResource = 0;
+    var runTest = function() {
+        var resources = performance.getEntriesByType('resource');
+        for (var i = 0; i &lt; resources.length; ++i) {
+            if (resources[i].name.indexOf(&quot;square&quot;) != -1)
+                ++foundResource;
+        };
+        shouldBe(&quot;foundResource&quot;, &quot;2&quot;);
+        if (window.internals)
+            window.internals.setResourceTimingSupport(false);
+        if (window.testRunner)
+            testRunner.notifyDone();
+    };
+    var windowLoaded = false;
+    var xhrLoaded = false;
+    var xhr = new XMLHttpRequest();
+    xhr.addEventListener(&quot;load&quot;, function() {
+        if (windowLoaded)
+            runTest();
+        xhrLoaded = true;
+    });
+    xhr.open(&quot;GET&quot;, &quot;../../resources/square100.png&quot;);
+    xhr.send();
+    window.addEventListener(&quot;load&quot;, function() {
+        if (xhrLoaded)
+            runTest();
+        windowLoaded = true;
+    });
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (200886 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-05-13 22:22:45 UTC (rev 200886)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -1931,6 +1931,7 @@
</span><span class="cx">     loader/ResourceLoadStatistics.cpp
</span><span class="cx">     loader/ResourceLoadStatisticsStore.cpp
</span><span class="cx">     loader/ResourceLoader.cpp
</span><ins>+    loader/ResourceTimingInformation.cpp
</ins><span class="cx">     loader/SinkDocument.cpp
</span><span class="cx">     loader/SubframeLoader.cpp
</span><span class="cx">     loader/SubresourceLoader.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200886 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-13 22:22:45 UTC (rev 200886)
+++ trunk/Source/WebCore/ChangeLog        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2016-05-13  Yoav Weiss  &lt;yoav@yoav.ws&gt;
+
+        ResourceTiming entries for cached resources and XHR
+        https://bugs.webkit.org/show_bug.cgi?id=157669
+
+        Reviewed by Alex Christensen.
+
+         - Moves the ResourceTiming storage and addition logic into its own class, so that it
+           can be accessed by both CachedResourceLoader and DocumentThreadableLoader.
+         - Using the above, adds ResourceTiming collection into DocumentThreadableLoader,
+           in order to support ResourceTiming entries for XHR based requests.
+         - Adds ResourceTiming entries for resources that are reused from the memory cache.
+
+        Test: http/tests/performance/performance-resource-timing-cached-entries.html
+
+        * CMakeLists.txt: Add ResourceTimingInformation.
+        * WebCore.xcodeproj/project.pbxproj: Add ResourceTimingInformation.
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::didFinishLoading): Add a call to addResourceTiming.
+        (WebCore::DocumentThreadableLoader::loadRequest): Store the initiator information.
+        * loader/DocumentThreadableLoader.h:
+        * loader/ResourceTimingInformation.cpp: Added.
+        (WebCore::ResourceTimingInformation::addResourceTiming): Moved addResourceTiming logic from CachedResourceLoader.
+        (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation): Moved addResourceTiming logic from
+        CachedResourceLoader. Removed reliance on the committingFirstRealLoad bool when storing initiator info, as I don't
+        see why it is required, and it made no sense in the context of DocumentThreadableLoader.
+        * loader/ResourceTimingInformation.h: Added.
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::requestResource): Add a ResourceTiming entry when a resource is reused from MemoryCache.
+        (WebCore::CachedResourceLoader::revalidateResource): Use ResourceTimingInformation::storeResourceTimingInitiatorInformation.
+        (WebCore::CachedResourceLoader::loadResource): Use ResourceTimingInformation::storeResourceTimingInitiatorInformation.
+        (WebCore::CachedResourceLoader::loadDone): Use ResourceTimingInformation::addResourceTiming.
+        (WebCore::CachedResourceLoader::storeResourceTimingInitiatorInformation): Deleted.
+        * loader/cache/CachedResourceLoader.h:
+
</ins><span class="cx"> 2016-05-13  Doug Russell  &lt;d_russell@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: Regressions in undo/redo accessibility from Bug 153361
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (200886 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-05-13 22:22:45 UTC (rev 200886)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -6007,6 +6007,8 @@
</span><span class="cx">                 CB38FD5A1CD2325800592A3F /* JSPerformanceResourceTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CB38FD581CD2314500592A3F /* JSPerformanceResourceTiming.cpp */; };
</span><span class="cx">                 CB38FD5B1CD2325B00592A3F /* JSPerformanceResourceTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = CB38FD591CD2314500592A3F /* JSPerformanceResourceTiming.h */; };
</span><span class="cx">                 CB8CF0181A9358D4000D510B /* Microtasks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CB8CF0151A934B43000D510B /* Microtasks.cpp */; };
</span><ins>+                CBC2D22F1CE5B89D00D1880B /* ResourceTimingInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CBC2D22D1CE5B77400D1880B /* ResourceTimingInformation.cpp */; };
+                CBC2D2301CE5B8A100D1880B /* ResourceTimingInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = CBC2D22E1CE5B77D00D1880B /* ResourceTimingInformation.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 CCC2B51415F613060048CDD6 /* DeviceClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51015F613060048CDD6 /* DeviceClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CCC2B51115F613060048CDD6 /* DeviceController.cpp */; };
</span><span class="cx">                 CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51215F613060048CDD6 /* DeviceController.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -13988,6 +13990,8 @@
</span><span class="cx">                 CB38FD581CD2314500592A3F /* JSPerformanceResourceTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPerformanceResourceTiming.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CB38FD591CD2314500592A3F /* JSPerformanceResourceTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPerformanceResourceTiming.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CB8CF0151A934B43000D510B /* Microtasks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Microtasks.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                CBC2D22D1CE5B77400D1880B /* ResourceTimingInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceTimingInformation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                CBC2D22E1CE5B77D00D1880B /* ResourceTimingInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceTimingInformation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 CCC2B51015F613060048CDD6 /* DeviceClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CCC2B51115F613060048CDD6 /* DeviceController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceController.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CCC2B51215F613060048CDD6 /* DeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22819,6 +22823,8 @@
</span><span class="cx">                                 7A929CA21C598378004DF226 /* ResourceLoadStatistics.h */,
</span><span class="cx">                                 7A7CC8361C87506800366243 /* ResourceLoadStatisticsStore.cpp */,
</span><span class="cx">                                 7A7CC8371C87506800366243 /* ResourceLoadStatisticsStore.h */,
</span><ins>+                                CBC2D22D1CE5B77400D1880B /* ResourceTimingInformation.cpp */,
+                                CBC2D22E1CE5B77D00D1880B /* ResourceTimingInformation.h */,
</ins><span class="cx">                                 51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */,
</span><span class="cx">                                 51327D5E11A33A2B004F9D65 /* SinkDocument.h */,
</span><span class="cx">                                 D000ED2511C1B9CD00C47726 /* SubframeLoader.cpp */,
</span><span class="lines">@@ -28244,6 +28250,7 @@
</span><span class="cx">                                 83C1D432178D5AB500141E68 /* SVGPathSegLinetoRel.h in Headers */,
</span><span class="cx">                                 B2227A7D0D00BF220071B782 /* SVGPathSegLinetoVertical.h in Headers */,
</span><span class="cx">                                 83C1D433178D5AB500141E68 /* SVGPathSegLinetoVerticalAbs.h in Headers */,
</span><ins>+                                CBC2D2301CE5B8A100D1880B /* ResourceTimingInformation.h in Headers */,
</ins><span class="cx">                                 83C1D434178D5AB500141E68 /* SVGPathSegLinetoVerticalRel.h in Headers */,
</span><span class="cx">                                 B2227A810D00BF220071B782 /* SVGPathSegList.h in Headers */,
</span><span class="cx">                                 8476C9E611DF6A0B00555B02 /* SVGPathSegListBuilder.h in Headers */,
</span><span class="lines">@@ -32105,6 +32112,7 @@
</span><span class="cx">                                 1A1414B513A0F0500019996C /* WebKitFontFamilyNames.cpp in Sources */,
</span><span class="cx">                                 D7613A501474F13F00DB8606 /* WebKitNamedFlow.cpp in Sources */,
</span><span class="cx">                                 7C48A6D0191C9D6500026674 /* WebKitNamespace.cpp in Sources */,
</span><ins>+                                CBC2D22F1CE5B89D00D1880B /* ResourceTimingInformation.cpp in Sources */,
</ins><span class="cx">                                 A5DEBDA316FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp in Sources */,
</span><span class="cx">                                 31C0FF240E4CEB6E007D6FE5 /* WebKitTransitionEvent.cpp in Sources */,
</span><span class="cx">                                 0FCF332E0F2B9A25004B6795 /* WebLayer.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentThreadableLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (200886 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp        2016-05-13 22:22:45 UTC (rev 200886)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -325,6 +325,9 @@
</span><span class="cx"> 
</span><span class="cx"> void DocumentThreadableLoader::didFinishLoading(unsigned long identifier, double finishTime)
</span><span class="cx"> {
</span><ins>+    if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
+        m_resourceTimingInfo.addResourceTiming(m_resource.get(), &amp;m_document);
+
</ins><span class="cx">     if (m_actualRequest) {
</span><span class="cx">         InspectorInstrumentation::didFinishLoading(m_document.frame(), m_document.frame()-&gt;loader().documentLoader(), identifier, finishTime);
</span><span class="cx"> 
</span><span class="lines">@@ -390,9 +393,13 @@
</span><span class="cx">             newRequest.setInitiator(m_options.initiator);
</span><span class="cx">         ASSERT(!m_resource);
</span><span class="cx">         m_resource = m_document.cachedResourceLoader().requestRawResource(newRequest);
</span><del>-        if (m_resource)
</del><ins>+        if (m_resource) {
</ins><span class="cx">             m_resource-&gt;addClient(this);
</span><span class="cx"> 
</span><ins>+            if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
+                m_resourceTimingInfo.storeResourceTimingInitiatorInformation(m_resource, newRequest, m_document.frame());
+        }
+
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentThreadableLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.h (200886 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentThreadableLoader.h        2016-05-13 22:22:45 UTC (rev 200886)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.h        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CachedRawResourceClient.h&quot;
</span><span class="cx"> #include &quot;CachedResourceHandle.h&quot;
</span><ins>+#include &quot;ResourceTimingInformation.h&quot;
</ins><span class="cx"> #include &quot;ThreadableLoader.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -105,6 +106,7 @@
</span><span class="cx">         ThreadableLoaderClient* m_client;
</span><span class="cx">         Document&amp; m_document;
</span><span class="cx">         ThreadableLoaderOptions m_options;
</span><ins>+        ResourceTimingInformation m_resourceTimingInfo;
</ins><span class="cx">         bool m_sameOriginRequest;
</span><span class="cx">         bool m_simpleRequest;
</span><span class="cx">         bool m_async;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceTimingInformationcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/loader/ResourceTimingInformation.cpp (0 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceTimingInformation.cpp                                (rev 0)
+++ trunk/Source/WebCore/loader/ResourceTimingInformation.cpp        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2016 Akamai Technologies Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#if ENABLE(WEB_TIMING)
+#include &quot;ResourceTimingInformation.h&quot;
+
+#include &quot;CachedResource.h&quot;
+#include &quot;CachedResourceRequest.h&quot;
+#include &quot;DOMWindow.h&quot;
+#include &quot;Document.h&quot;
+#include &quot;Frame.h&quot;
+#include &quot;HTMLFrameOwnerElement.h&quot;
+#include &quot;Performance.h&quot;
+#include &quot;RuntimeEnabledFeatures.h&quot;
+
+namespace WebCore {
+
+void ResourceTimingInformation::addResourceTiming(CachedResource* resource, Document* document)
+{
+    ASSERT(RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled());
+    if (resource &amp;&amp; resource-&gt;response().isHTTP()
+        &amp;&amp; ((!resource-&gt;errorOccurred() &amp;&amp; !resource-&gt;wasCanceled()) || resource-&gt;response().httpStatusCode() == 304)) {
+        HashMap&lt;CachedResource*, InitiatorInfo&gt;::iterator initiatorIt = m_initiatorMap.find(resource);
+        if (initiatorIt != m_initiatorMap.end()) {
+            ASSERT(document);
+            Document* initiatorDocument = document;
+            if (resource-&gt;type() == CachedResource::MainResource)
+                initiatorDocument = document-&gt;parentDocument();
+            ASSERT(initiatorDocument);
+            ASSERT(initiatorDocument-&gt;domWindow());
+            ASSERT(initiatorDocument-&gt;domWindow()-&gt;performance());
+            const InitiatorInfo&amp; info = initiatorIt-&gt;value;
+            initiatorDocument-&gt;domWindow()-&gt;performance()-&gt;addResourceTiming(info.name, initiatorDocument, resource-&gt;resourceRequest(), resource-&gt;response(), info.startTime, resource-&gt;loadFinishTime());
+            m_initiatorMap.remove(initiatorIt);
+        }
+    }
+}
+
+void ResourceTimingInformation::storeResourceTimingInitiatorInformation(const CachedResourceHandle&lt;CachedResource&gt;&amp; resource, const CachedResourceRequest&amp; request, Frame* frame)
+{
+    ASSERT(RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled());
+    ASSERT(resource.get());
+    if (resource-&gt;type() == CachedResource::MainResource) {
+        // &lt;iframe&gt;s should report the initial navigation requested by the parent document, but not subsequent navigations.
+        ASSERT(frame);
+        if (frame-&gt;ownerElement()) {
+            InitiatorInfo info = { frame-&gt;ownerElement()-&gt;localName(), monotonicallyIncreasingTime() };
+            m_initiatorMap.add(resource.get(), info);
+        }
+    } else {
+        InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() };
+        m_initiatorMap.add(resource.get(), info);
+    }
+}
+
+}
+
+#endif // ENABLE(WEB_TIMING)
</ins></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceTimingInformationh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/loader/ResourceTimingInformation.h (0 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceTimingInformation.h                                (rev 0)
+++ trunk/Source/WebCore/loader/ResourceTimingInformation.h        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/*
+ * Copyright (C) 2016 Akamai Technologies Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_TIMING)
+
+#include &quot;CachedResourceHandle.h&quot;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+class CachedResource;
+class CachedResourceRequest;
+class Document;
+class Frame;
+
+class ResourceTimingInformation {
+public:
+
+    void addResourceTiming(CachedResource*, Document*);
+    void storeResourceTimingInitiatorInformation(const CachedResourceHandle&lt;CachedResource&gt;&amp;, const CachedResourceRequest&amp;, Frame*);
+
+private:
+    struct InitiatorInfo {
+        AtomicString name;
+        double startTime;
+    };
+    HashMap&lt;CachedResource*, InitiatorInfo&gt; m_initiatorMap;
+};
+
+}
+
+#endif // ENABLE(WEB_TIMING)
</ins></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (200886 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2016-05-13 22:22:45 UTC (rev 200886)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -618,6 +618,10 @@
</span><span class="cx">             return nullptr;
</span><span class="cx">         logMemoryCacheResourceRequest(frame(), DiagnosticLoggingKeys::inMemoryCacheKey(), DiagnosticLoggingKeys::usedKey());
</span><span class="cx">         memoryCache.resourceAccessed(*resource);
</span><ins>+        if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) {
+            m_resourceTimingInfo.storeResourceTimingInitiatorInformation(resource, request, frame());
+            m_resourceTimingInfo.addResourceTiming(resource.get(), document());
+        }
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -670,7 +674,7 @@
</span><span class="cx">     memoryCache.remove(*resource);
</span><span class="cx">     memoryCache.add(*newResource);
</span><span class="cx">     if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
</span><del>-        storeResourceTimingInitiatorInformation(resource, request);
</del><ins>+        m_resourceTimingInfo.storeResourceTimingInitiatorInformation(resource, request, frame());
</ins><span class="cx">     return newResource;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -686,25 +690,10 @@
</span><span class="cx">     if (request.allowsCaching() &amp;&amp; !memoryCache.add(*resource))
</span><span class="cx">         resource-&gt;setOwningCachedResourceLoader(this);
</span><span class="cx">     if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
</span><del>-        storeResourceTimingInitiatorInformation(resource, request);
</del><ins>+        m_resourceTimingInfo.storeResourceTimingInitiatorInformation(resource, request, frame());
</ins><span class="cx">     return resource;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CachedResourceLoader::storeResourceTimingInitiatorInformation(const CachedResourceHandle&lt;CachedResource&gt;&amp; resource, const CachedResourceRequest&amp; request)
-{
-    ASSERT(RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled());
-    if (resource-&gt;type() == CachedResource::MainResource) {
-        // &lt;iframe&gt;s should report the initial navigation requested by the parent document, but not subsequent navigations.
-        if (frame()-&gt;ownerElement() &amp;&amp; m_documentLoader-&gt;frameLoader()-&gt;stateMachine().committingFirstRealLoad()) {
-            InitiatorInfo info = { frame()-&gt;ownerElement()-&gt;localName(), monotonicallyIncreasingTime() };
-            m_initiatorMap.add(resource.get(), info);
-        }
-    } else {
-        InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() };
-        m_initiatorMap.add(resource.get(), info);
-    }
-}
-
</del><span class="cx"> static void logRevalidation(const String&amp; reason, DiagnosticLoggingClient&amp; logClient)
</span><span class="cx"> {
</span><span class="cx">     logClient.logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), DiagnosticLoggingKeys::reasonKey(), reason, ShouldSample::Yes);
</span><span class="lines">@@ -970,21 +959,8 @@
</span><span class="cx">     RefPtr&lt;Document&gt; protectDocument(m_document);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_TIMING)
</span><del>-    if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()
-        &amp;&amp; resource &amp;&amp; resource-&gt;response().isHTTP()
-        &amp;&amp; ((!resource-&gt;errorOccurred() &amp;&amp; !resource-&gt;wasCanceled()) || resource-&gt;response().httpStatusCode() == 304)) {
-        HashMap&lt;CachedResource*, InitiatorInfo&gt;::iterator initiatorIt = m_initiatorMap.find(resource);
-        if (initiatorIt != m_initiatorMap.end()) {
-            ASSERT(document());
-            Document* initiatorDocument = document();
-            if (resource-&gt;type() == CachedResource::MainResource)
-                initiatorDocument = document()-&gt;parentDocument();
-            ASSERT(initiatorDocument);
-            const InitiatorInfo&amp; info = initiatorIt-&gt;value;
-            initiatorDocument-&gt;domWindow()-&gt;performance()-&gt;addResourceTiming(info.name, initiatorDocument, resource-&gt;resourceRequest(), resource-&gt;response(), info.startTime, resource-&gt;loadFinishTime());
-            m_initiatorMap.remove(initiatorIt);
-        }
-    }
</del><ins>+    if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
+        m_resourceTimingInfo.addResourceTiming(resource, document());
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(resource);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.h (200886 => 200887)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.h        2016-05-13 22:22:45 UTC (rev 200886)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.h        2016-05-13 22:34:29 UTC (rev 200887)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;CachedResourceHandle.h&quot;
</span><span class="cx"> #include &quot;CachedResourceRequest.h&quot;
</span><span class="cx"> #include &quot;ResourceLoadPriority.h&quot;
</span><ins>+#include &quot;ResourceTimingInformation.h&quot;
</ins><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="cx"> #include &lt;wtf/Deque.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="lines">@@ -144,7 +145,6 @@
</span><span class="cx">     CachedResourceHandle&lt;CachedResource&gt; requestResource(CachedResource::Type, CachedResourceRequest&amp;);
</span><span class="cx">     CachedResourceHandle&lt;CachedResource&gt; revalidateResource(const CachedResourceRequest&amp;, CachedResource*);
</span><span class="cx">     CachedResourceHandle&lt;CachedResource&gt; loadResource(CachedResource::Type, CachedResourceRequest&amp;);
</span><del>-    void storeResourceTimingInitiatorInformation(const CachedResourceHandle&lt;CachedResource&gt;&amp;, const CachedResourceRequest&amp;);
</del><span class="cx">     void requestPreload(CachedResource::Type, CachedResourceRequest&amp;, const String&amp; charset);
</span><span class="cx"> 
</span><span class="cx">     enum RevalidationPolicy { Use, Revalidate, Reload, Load };
</span><span class="lines">@@ -177,11 +177,7 @@
</span><span class="cx"> 
</span><span class="cx">     Timer m_garbageCollectDocumentResourcesTimer;
</span><span class="cx"> 
</span><del>-    struct InitiatorInfo {
-        AtomicString name;
-        double startTime;
-    };
-    HashMap&lt;CachedResource*, InitiatorInfo&gt; m_initiatorMap;
</del><ins>+    ResourceTimingInformation m_resourceTimingInfo;
</ins><span class="cx"> 
</span><span class="cx">     // 29 bits left
</span><span class="cx">     bool m_autoLoadImages : 1;
</span></span></pre>
</div>
</div>

</body>
</html>