Unreviewed, rolling out r212944.
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Feb 2017 03:34:33 +0000 (03:34 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Feb 2017 03:34:33 +0000 (03:34 +0000)
Caused a lot of failures on the debug bots

Reverted changeset:

"[Resource Timing] Gather timing information with reliable
responseEnd time"
https://bugs.webkit.org/show_bug.cgi?id=168351
http://trac.webkit.org/changeset/212944

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212989 268f45cc-cd09-0410-ab3c-d52691b4dbfc

106 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.js [deleted file]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.js [deleted file]
LayoutTests/performance-api/resource-timing-apis-expected.txt
LayoutTests/performance-api/resources/resource-timing-api.js
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios-simulator/TestExpectations
LayoutTests/platform/mac-elcapitan/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt [deleted file]
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/mac/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt [deleted file]
LayoutTests/platform/win/TestExpectations
Source/WTF/ChangeLog
Source/WTF/wtf/persistence/Coders.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchLoader.cpp
Source/WebCore/Modules/fetch/FetchLoader.h
Source/WebCore/PlatformMac.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/fileapi/FileReaderLoader.cpp
Source/WebCore/fileapi/FileReaderLoader.h
Source/WebCore/html/MediaFragmentURIParser.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorNetworkAgent.cpp
Source/WebCore/inspector/InspectorNetworkAgent.h
Source/WebCore/loader/CrossOriginPreflightChecker.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/DocumentThreadableLoader.h
Source/WebCore/loader/NetscapePlugInStreamLoader.cpp
Source/WebCore/loader/NetscapePlugInStreamLoader.h
Source/WebCore/loader/ResourceLoadNotifier.cpp
Source/WebCore/loader/ResourceLoadNotifier.h
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/ResourceTiming.cpp
Source/WebCore/loader/ResourceTiming.h
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/SubresourceLoader.h
Source/WebCore/loader/ThreadableLoaderClient.h
Source/WebCore/loader/ThreadableLoaderClientWrapper.h
Source/WebCore/loader/WorkerThreadableLoader.cpp
Source/WebCore/loader/WorkerThreadableLoader.h
Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
Source/WebCore/loader/appcache/ApplicationCacheGroup.h
Source/WebCore/loader/cache/CachedResource.h
Source/WebCore/loader/ios/QuickLook.mm
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/EventSource.h
Source/WebCore/page/PerformanceResourceTiming.cpp
Source/WebCore/page/PerformanceResourceTiming.h
Source/WebCore/page/PerformanceResourceTiming.idl
Source/WebCore/page/PerformanceTiming.cpp
Source/WebCore/page/PerformanceTiming.h
Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
Source/WebCore/platform/network/BlobResourceHandle.cpp
Source/WebCore/platform/network/NetworkLoadTiming.h [moved from Source/WebCore/platform/network/NetworkLoadMetrics.h with 51% similarity]
Source/WebCore/platform/network/PingHandle.h
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/ResourceHandleClient.h
Source/WebCore/platform/network/ResourceResponseBase.cpp
Source/WebCore/platform/network/ResourceResponseBase.h
Source/WebCore/platform/network/SynchronousLoaderClient.cpp
Source/WebCore/platform/network/SynchronousLoaderClient.h
Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp
Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp
Source/WebCore/platform/network/cocoa/NetworkLoadTiming.mm [moved from Source/WebCore/platform/network/cocoa/NetworkLoadMetrics.mm with 72% similarity]
Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp
Source/WebCore/platform/network/curl/ResourceHandleManager.cpp
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
Source/WebCore/workers/WorkerScriptLoader.cpp
Source/WebCore/workers/WorkerScriptLoader.h
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.cpp
Source/WebKit2/NetworkProcess/Downloads/BlobDownloadClient.h
Source/WebKit2/NetworkProcess/Downloads/PendingDownload.h
Source/WebKit2/NetworkProcess/NetworkDataTask.h
Source/WebKit2/NetworkProcess/NetworkLoad.cpp
Source/WebKit2/NetworkProcess/NetworkLoad.h
Source/WebKit2/NetworkProcess/NetworkLoadClient.h
Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit2/NetworkProcess/NetworkResourceLoader.h
Source/WebKit2/NetworkProcess/PingLoad.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.h
Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.h
Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp
Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.h
Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp
Source/WebKit2/WebProcess/Network/WebResourceLoader.h
Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in

index 75481a5..c8588b0 100644 (file)
@@ -1,3 +1,16 @@
+2017-02-24  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, rolling out r212944.
+
+        Caused a lot of failures on the debug bots
+
+        Reverted changeset:
+
+        "[Resource Timing] Gather timing information with reliable
+        responseEnd time"
+        https://bugs.webkit.org/show_bug.cgi?id=168351
+        http://trac.webkit.org/changeset/212944
+
 2017-02-24  Jon Lee  <jonlee@apple.com>
 
         Alias "system-ui" for the System font name
index cb518cf..0640b16 100644 (file)
@@ -312,7 +312,6 @@ webkit.org/b/161088 imported/w3c/web-platform-tests/resource-timing/resource-tim
 webkit.org/b/168357 imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-media.html [ Failure ]
 webkit.org/b/168448 imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-frames.html [ Pass Failure ]
 webkit.org/b/168448 imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-workers.html [ Pass Failure ]
-imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html [ Pass Failure ]
 
 webkit.org/b/161176 [ Debug ] imported/w3c/web-platform-tests/url/url-setters.html [ Skip ]
 
index 92a4b1f..da6ae3d 100644 (file)
@@ -1,3 +1,16 @@
+2017-02-24  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, rolling out r212944.
+
+        Caused a lot of failures on the debug bots
+
+        Reverted changeset:
+
+        "[Resource Timing] Gather timing information with reliable
+        responseEnd time"
+        https://bugs.webkit.org/show_bug.cgi?id=168351
+        http://trac.webkit.org/changeset/212944
+
 2017-02-24  Alex Christensen  <achristensen@webkit.org>
 
         Non-special relative URLs should not ignore extra slashes
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol-expected.txt
deleted file mode 100644 (file)
index 82b211e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Resource Timing: nextHopProtocol
-
-
-PASS nextHopProtocol is expected to be 'http1/1' 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html
deleted file mode 100644 (file)
index 3ece308..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<title>Resource Timing - nextHopProtocol</title>
-<meta name="author" title="JosephPecoraro" href="mailto:joepeck@webkit.org">
-<meta name="assert" content="Resource Timing nextHopProtocol">
-<link rel="help" href="https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-nexthopprotocol">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/rt-utilities.js"></script>
-</head>
-<body>
-<h1>Resource Timing: nextHopProtocol</h1>
-<div id="log"></div>
-<script src="rt-nextHopProtocol.js"></script>
-</body>
-</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.js b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.js
deleted file mode 100644 (file)
index ec39776..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-promise_test(function(t) {
-    return loadResources(1).then(function([entry]) {
-        assert_equals(entry.nextHopProtocol, "http/1.1");
-    });
-}, "nextHopProtocol is expected to be 'http1/1'", {timeout: 3000});
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker-expected.txt
deleted file mode 100644 (file)
index e625e19..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-
-PASS Must have PerformanceObserver and PerformanceResourceTiming in DedicatedWorkerGlobalScope 
-PASS nextHopProtocol is expected to be 'http1/1' 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.js b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.js
deleted file mode 100644 (file)
index 583e45d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-importScripts("/resources/testharness.js");
-importScripts("resources/rt-utilities.js");
-
-(function() {
-    if (!testNecessaryPerformanceFeatures()) {
-        done();
-        return;
-    }
-
-    importScripts("rt-nextHopProtocol.js");
-
-    done();
-})();
index d970b1c..b8d846c 100644 (file)
@@ -6,7 +6,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 PerformanceResourceTiming
 PASS PerformanceResourceTiming is defined.
 PASS "initiatorType" in PerformanceResourceTiming.prototype is true
-PASS "nextHopProtocol" in PerformanceResourceTiming.prototype is true
+FAIL "nextHopProtocol" in PerformanceResourceTiming.prototype should be true. Was false.
 PASS "workerStart" in PerformanceResourceTiming.prototype is true
 PASS "redirectStart" in PerformanceResourceTiming.prototype is true
 PASS "redirectEnd" in PerformanceResourceTiming.prototype is true
@@ -37,7 +37,7 @@ Starting worker: resources/resource-timing-api.js
 [Worker] PerformanceResourceTiming
 PASS [Worker] PerformanceResourceTiming is defined.
 PASS [Worker] "initiatorType" in PerformanceResourceTiming.prototype is true
-PASS [Worker] "nextHopProtocol" in PerformanceResourceTiming.prototype is true
+FAIL [Worker] "nextHopProtocol" in PerformanceResourceTiming.prototype should be true. Was false.
 PASS [Worker] "workerStart" in PerformanceResourceTiming.prototype is true
 PASS [Worker] "redirectStart" in PerformanceResourceTiming.prototype is true
 PASS [Worker] "redirectEnd" in PerformanceResourceTiming.prototype is true
index b4bce6f..3cf5f76 100644 (file)
@@ -7,7 +7,7 @@ if (self.window)
 debug("PerformanceResourceTiming");
 shouldBeDefined("PerformanceResourceTiming");
 shouldBeTrue(`"initiatorType" in PerformanceResourceTiming.prototype`);
-shouldBeTrue(`"nextHopProtocol" in PerformanceResourceTiming.prototype`);
+shouldBeTrue(`"nextHopProtocol" in PerformanceResourceTiming.prototype`); // Not yet implemented.
 shouldBeTrue(`"workerStart" in PerformanceResourceTiming.prototype`);
 shouldBeTrue(`"redirectStart" in PerformanceResourceTiming.prototype`);
 shouldBeTrue(`"redirectEnd" in PerformanceResourceTiming.prototype`);
index 92f9905..81d910b 100644 (file)
@@ -2840,9 +2840,6 @@ webkit.org/b/167999 imported/w3c/web-platform-tests/fetch/api/redirect/redirect-
 webkit.org/b/167999 imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html [ Failure ]
 webkit.org/b/167999 imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html [ Failure ]
 
-webkit.org/b/168543 imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html [ Failure ]
-webkit.org/b/168543 imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html [ Failure ]
-
 webkit.org/b/145260 media/audio-playback-restriction-play.html [ Failure ]
 
 webkit.org/b/168188 fast/events/ime-compositionend-on-selection-change.html [ Failure ]
index eb4288b..bc7d1a6 100644 (file)
@@ -2877,14 +2877,6 @@ webkit.org/b/168054 compositing/masks/solid-color-masked.html [ ImageOnlyFailure
 webkit.org/b/168215 imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click.html [ Skip ]
 webkit.org/b/168215 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-download-click.html [ Skip ]
 
-# <rdar://problem/30610988>
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin-worker.html [ Failure ]
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin.html [ Failure ]
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html [ Failure ]
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html [ Failure ]
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html [ Failure ]
-imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html [ Failure ]
-
 # rdar://problem/23643423
 [ Debug ] fast/frames/exponential-frames.html [ Skip ]
 
diff --git a/LayoutTests/platform/mac-elcapitan/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt b/LayoutTests/platform/mac-elcapitan/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt
deleted file mode 100644 (file)
index fa5129a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-Description
-
-NOTE: Due to caching behavior in the browser, it is possible that when revisiting this page, some resources may not have to be fetched from the network. As a result, the performance timeline will not contain entries for these resources. This test will fail if any entries are missing to ensure that all resources are fetched from the network and entries for these resources exist in the Performance Timeline. If revisiting this page, please either perform a full reload of the page or clear the cache between visits.
-
-
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (iframe) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (iframe) 
-PASS PerformanceEntry has correct order of timing attributes (iframe) 
-FAIL PerformanceEntry has correct network transfer attributes (iframe) assert_equals: encodedBodySize size expected (number) 215 but got (undefined) undefined
-FAIL PerformanceEntry has correct protocol attribute (iframe) assert_equals: expected protocol expected (string) "http/1.1" but got (undefined) undefined
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (img) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (img) 
-PASS PerformanceEntry has correct order of timing attributes (img) 
-FAIL PerformanceEntry has correct network transfer attributes (img) assert_equals: encodedBodySize size expected (number) 249 but got (undefined) undefined
-FAIL PerformanceEntry has correct protocol attribute (img) assert_equals: expected protocol expected (string) "http/1.1" but got (undefined) undefined
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (link) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (link) 
-PASS PerformanceEntry has correct order of timing attributes (link) 
-FAIL PerformanceEntry has correct network transfer attributes (link) assert_equals: encodedBodySize size expected (number) 44 but got (undefined) undefined
-FAIL PerformanceEntry has correct protocol attribute (link) assert_equals: expected protocol expected (string) "http/1.1" but got (undefined) undefined
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (script) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (script) 
-PASS PerformanceEntry has correct order of timing attributes (script) 
-FAIL PerformanceEntry has correct network transfer attributes (script) assert_equals: encodedBodySize size expected (number) 133 but got (undefined) undefined
-FAIL PerformanceEntry has correct protocol attribute (script) assert_equals: expected protocol expected (string) "http/1.1" but got (undefined) undefined
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (xmlhttprequest) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (xmlhttprequest) 
-PASS PerformanceEntry has correct order of timing attributes (xmlhttprequest) 
-FAIL PerformanceEntry has correct network transfer attributes (xmlhttprequest) assert_equals: encodedBodySize size expected (number) 112 but got (undefined) undefined
-FAIL PerformanceEntry has correct protocol attribute (xmlhttprequest) assert_equals: expected protocol expected (string) "http/1.1" but got (undefined) undefined
-PASS window.performance Resource Timing Entries exist 
-PASS window.performance Resource Timing Entries exist 1 
-PASS window.performance Resource Timing Entries exist 2 
-
index e4f581f..f49cab2 100644 (file)
@@ -1535,15 +1535,4 @@ webkit.org/b/168415 [ ElCapitan ] imported/w3c/web-platform-tests/resource-timin
 
 webkit.org/b/212466 [ ElCapitan ] js/dom/gc-slot-visitor-parallel-drain-pings-runloop-when-done.html [ Skip ]
 
-[ ElCapitan ] imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html [ Failure ]
-[ ElCapitan ] imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html [ Failure ]
-
-# <rdar://problem/30610988>
-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin-worker.html [ Failure ]
-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-cross-origin.html [ Failure ]
-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count-worker.html [ Failure ]
-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html [ Failure ]
-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-worker.html [ Failure ]
-[ Sierra+ ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.html [ Failure ]
-
 webkit.org/b/168503 editing/pasteboard/drag-drop-copy-content.html [ Failure ]
diff --git a/LayoutTests/platform/mac/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt b/LayoutTests/platform/mac/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt
deleted file mode 100644 (file)
index a0e5d7a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-Description
-
-NOTE: Due to caching behavior in the browser, it is possible that when revisiting this page, some resources may not have to be fetched from the network. As a result, the performance timeline will not contain entries for these resources. This test will fail if any entries are missing to ensure that all resources are fetched from the network and entries for these resources exist in the Performance Timeline. If revisiting this page, please either perform a full reload of the page or clear the cache between visits.
-
-
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (iframe) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (iframe) 
-PASS PerformanceEntry has correct order of timing attributes (iframe) 
-FAIL PerformanceEntry has correct network transfer attributes (iframe) assert_equals: encodedBodySize size expected (number) 215 but got (undefined) undefined
-PASS PerformanceEntry has correct protocol attribute (iframe) 
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (img) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (img) 
-PASS PerformanceEntry has correct order of timing attributes (img) 
-FAIL PerformanceEntry has correct network transfer attributes (img) assert_equals: encodedBodySize size expected (number) 249 but got (undefined) undefined
-PASS PerformanceEntry has correct protocol attribute (img) 
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (link) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (link) 
-PASS PerformanceEntry has correct order of timing attributes (link) 
-FAIL PerformanceEntry has correct network transfer attributes (link) assert_equals: encodedBodySize size expected (number) 44 but got (undefined) undefined
-PASS PerformanceEntry has correct protocol attribute (link) 
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (script) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (script) 
-PASS PerformanceEntry has correct order of timing attributes (script) 
-FAIL PerformanceEntry has correct network transfer attributes (script) assert_equals: encodedBodySize size expected (number) 133 but got (undefined) undefined
-PASS PerformanceEntry has correct protocol attribute (script) 
-PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (xmlhttprequest) 
-PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (xmlhttprequest) 
-PASS PerformanceEntry has correct order of timing attributes (xmlhttprequest) 
-FAIL PerformanceEntry has correct network transfer attributes (xmlhttprequest) assert_equals: encodedBodySize size expected (number) 112 but got (undefined) undefined
-PASS PerformanceEntry has correct protocol attribute (xmlhttprequest) 
-PASS window.performance Resource Timing Entries exist 
-PASS window.performance Resource Timing Entries exist 1 
-PASS window.performance Resource Timing Entries exist 2 
-
index 3bfcd27..f358a45 100644 (file)
@@ -3785,10 +3785,6 @@ fast/layers/prevent-hit-test-during-layout.html [ Skip ]
 # webrtc not supported
 imported/w3c/web-platform-tests/webrtc [ Skip ]
 
-# Resource Timing networking data not yet available.
-imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.html [ Failure ]
-imported/w3c/web-platform-tests/resource-timing/rt-nextHopProtocol.worker.html [ Failure ]
-
 # WebCrypto tests are failing.
 webkit.org/b/165090 imported/w3c/WebCryptoAPI [ Skip ]
 webkit.org/b/165090 imported/w3c/web-platform-tests/WebCryptoAPI [ Skip ]
index 88a5a99..4c3debc 100644 (file)
@@ -1,3 +1,16 @@
+2017-02-24  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, rolling out r212944.
+
+        Caused a lot of failures on the debug bots
+
+        Reverted changeset:
+
+        "[Resource Timing] Gather timing information with reliable
+        responseEnd time"
+        https://bugs.webkit.org/show_bug.cgi?id=168351
+        http://trac.webkit.org/changeset/212944
+
 2017-02-24  Keith Miller  <keith_miller@apple.com>
 
         We should be able to use std::tuples as keys in HashMap
index 4050674..3cde70a 100644 (file)
@@ -30,7 +30,6 @@
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/SHA1.h>
-#include <wtf/Seconds.h>
 #include <wtf/Vector.h>
 #include <wtf/persistence/Decoder.h>
 #include <wtf/persistence/Encoder.h>
@@ -279,23 +278,6 @@ template<> struct Coder<std::chrono::system_clock::time_point> {
     }
 };
 
-template<> struct Coder<Seconds> {
-    static void encode(Encoder& encoder, const Seconds& seconds)
-    {
-        encoder << seconds.value();
-    }
-
-    static bool decode(Decoder& decoder, Seconds& result)
-    {
-        double value;
-        if (!decoder.decode(value))
-            return false;
-
-        result = Seconds(value);
-        return true;
-    }
-};
-
 template<> struct Coder<AtomicString> {
     WTF_EXPORT_PRIVATE static void encode(Encoder&, const AtomicString&);
     WTF_EXPORT_PRIVATE static bool decode(Decoder&, AtomicString&);
index 757b0b9..9cc1659 100644 (file)
@@ -1,5 +1,18 @@
 2017-02-24  Chris Dumez  <cdumez@apple.com>
 
+        Unreviewed, rolling out r212944.
+
+        Caused a lot of failures on the debug bots
+
+        Reverted changeset:
+
+        "[Resource Timing] Gather timing information with reliable
+        responseEnd time"
+        https://bugs.webkit.org/show_bug.cgi?id=168351
+        http://trac.webkit.org/changeset/212944
+
+2017-02-24  Chris Dumez  <cdumez@apple.com>
+
         Unreviewed, follow-up fix after r212972.
 
         Fixes a few assertions on the debug build bots.
index d6666d7..6e2fd5c 100644 (file)
@@ -141,7 +141,7 @@ void FetchLoader::didReceiveData(const char* value, int size)
     m_consumer->append(value, size);
 }
 
-void FetchLoader::didFinishLoading(unsigned long)
+void FetchLoader::didFinishLoading(unsigned long, double)
 {
     m_client.didSucceed();
 }
index 92806a9..44c1adb 100644 (file)
@@ -57,7 +57,7 @@ private:
     // ThreadableLoaderClient API.
     void didReceiveResponse(unsigned long, const ResourceResponse&) final;
     void didReceiveData(const char*, int) final;
-    void didFinishLoading(unsigned long) final;
+    void didFinishLoading(unsigned long, double) final;
     void didFail(const ResourceError&) final;
 
 private:
index 796dba3..ce1a629 100644 (file)
@@ -525,7 +525,7 @@ list(APPEND WebCore_SOURCES
     platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp
 
     platform/network/cocoa/CredentialCocoa.mm
-    platform/network/cocoa/NetworkLoadMetrics.mm
+    platform/network/cocoa/NetworkLoadTiming.mm
     platform/network/cocoa/ProtectionSpaceCocoa.mm
     platform/network/cocoa/ResourceRequestCocoa.mm
     platform/network/cocoa/ResourceResponseCocoa.mm
index ad19985..0a0a567 100644 (file)
                5C7C88D81D0F1F4A009D2F6D /* SocketProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5C9A7A751AA0F6EA00958ACF /* DFABytecodeCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C39305E1AA0F6A90029C816 /* DFABytecodeCompiler.cpp */; };
                5C9A7A761AA0F6ED00958ACF /* DFABytecodeInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C3930601AA0F6A90029C816 /* DFABytecodeInterpreter.cpp */; };
-               5C9B860C1C21E3C900110F36 /* NetworkLoadMetrics.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C9B860B1C21E3C600110F36 /* NetworkLoadMetrics.mm */; };
+               5C9B860C1C21E3C900110F36 /* NetworkLoadTiming.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C9B860B1C21E3C600110F36 /* NetworkLoadTiming.mm */; };
                5C9EF1711DFF71CC00A452E3 /* XPathGrammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9EF16F1DFF719900A452E3 /* XPathGrammar.cpp */; };
                5CB37FFE1C62D28C00F20188 /* ScrollAnimatorMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CB37FFC1C62D27800F20188 /* ScrollAnimatorMock.cpp */; };
                5CB37FFF1C62D2A100F20188 /* ScrollAnimatorMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB37FFD1C62D27800F20188 /* ScrollAnimatorMock.h */; };
                8A413AE11207BBA50082016E /* ScriptRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A413ADF1207BBA50082016E /* ScriptRunner.cpp */; };
                8A7CC96B12076D73001D4588 /* PendingScript.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A7CC96A12076D73001D4588 /* PendingScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
                8A7CC97012076F8A001D4588 /* PendingScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A7CC96F12076F8A001D4588 /* PendingScript.cpp */; };
-               8A81BF8511DCFD9000DA2B98 /* NetworkLoadMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A81BF8411DCFD9000DA2B98 /* NetworkLoadMetrics.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               8A81BF8511DCFD9000DA2B98 /* NetworkLoadTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A81BF8411DCFD9000DA2B98 /* NetworkLoadTiming.h */; settings = {ATTRIBUTES = (Private, ); }; };
                8A844D0511D3C18E0014065C /* Performance.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A844D0211D3C18E0014065C /* Performance.h */; };
                8A9A587011E84C36008ACFD1 /* JSPerformanceNavigation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A9A586E11E84C35008ACFD1 /* JSPerformanceNavigation.cpp */; };
                8A9A587111E84C36008ACFD1 /* JSPerformanceNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A9A586F11E84C36008ACFD1 /* JSPerformanceNavigation.h */; };
                5C6E653F1D5CEDC900F7862E /* URLParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLParser.cpp; sourceTree = "<group>"; };
                5C6E65401D5CEDC900F7862E /* URLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLParser.h; sourceTree = "<group>"; };
                5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketProvider.h; sourceTree = "<group>"; };
-               5C9B860B1C21E3C600110F36 /* NetworkLoadMetrics.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkLoadMetrics.mm; sourceTree = "<group>"; };
+               5C9B860B1C21E3C600110F36 /* NetworkLoadTiming.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkLoadTiming.mm; sourceTree = "<group>"; };
                5C9EF16F1DFF719900A452E3 /* XPathGrammar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathGrammar.cpp; sourceTree = "<group>"; };
                5C9EF1701DFF719900A452E3 /* XPathGrammar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathGrammar.h; sourceTree = "<group>"; };
                5CB37FFC1C62D27800F20188 /* ScrollAnimatorMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimatorMock.cpp; sourceTree = "<group>"; };
                8A413ADF1207BBA50082016E /* ScriptRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptRunner.cpp; sourceTree = "<group>"; };
                8A7CC96A12076D73001D4588 /* PendingScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PendingScript.h; sourceTree = "<group>"; };
                8A7CC96F12076F8A001D4588 /* PendingScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PendingScript.cpp; sourceTree = "<group>"; };
-               8A81BF8411DCFD9000DA2B98 /* NetworkLoadMetrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkLoadMetrics.h; sourceTree = "<group>"; };
+               8A81BF8411DCFD9000DA2B98 /* NetworkLoadTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkLoadTiming.h; sourceTree = "<group>"; };
                8A844D0211D3C18E0014065C /* Performance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Performance.h; sourceTree = "<group>"; };
                8A844D0311D3C18E0014065C /* Performance.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Performance.idl; sourceTree = "<group>"; };
                8A9A586E11E84C35008ACFD1 /* JSPerformanceNavigation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPerformanceNavigation.cpp; sourceTree = "<group>"; };
                                37DDCD9213844FD50008B793 /* MIMEHeader.cpp */,
                                37DDCD9313844FD50008B793 /* MIMEHeader.h */,
                                628D214B12131ED10055DCFC /* NetworkingContext.h */,
-                               8A81BF8411DCFD9000DA2B98 /* NetworkLoadMetrics.h */,
+                               8A81BF8411DCFD9000DA2B98 /* NetworkLoadTiming.h */,
                                1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */,
                                1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */,
                                5C3C856C1D5A7AD30088B9EC /* NetworkStorageSession.cpp */,
                        children = (
                                3792917C1987678F00F4B661 /* CredentialCocoa.h */,
                                3792917B1987678F00F4B661 /* CredentialCocoa.mm */,
-                               5C9B860B1C21E3C600110F36 /* NetworkLoadMetrics.mm */,
+                               5C9B860B1C21E3C600110F36 /* NetworkLoadTiming.mm */,
                                372ADA37197F47B900FC501E /* ProtectionSpaceCocoa.h */,
                                372ADA39197F687600FC501E /* ProtectionSpaceCocoa.mm */,
                                7E7DE1FC195CEF260035363B /* ResourceRequestCocoa.mm */,
                                656D37430ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h in Headers */,
                                A19D934B1AA11B1E00B46C24 /* NetworkExtensionContentFilter.h in Headers */,
                                628D214C12131ED10055DCFC /* NetworkingContext.h in Headers */,
-                               8A81BF8511DCFD9000DA2B98 /* NetworkLoadMetrics.h in Headers */,
+                               8A81BF8511DCFD9000DA2B98 /* NetworkLoadTiming.h in Headers */,
                                59C27F07138D28CF0079B7E2 /* NetworkResourcesData.h in Headers */,
                                1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */,
                                E13EF3441684ECF40034C83F /* NetworkStorageSession.h in Headers */,
                                996E59DE1DF01285006612B9 /* NavigatorWebDriver.cpp in Sources */,
                                5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */,
                                A19D934A1AA11B1E00B46C24 /* NetworkExtensionContentFilter.mm in Sources */,
-                               5C9B860C1C21E3C900110F36 /* NetworkLoadMetrics.mm in Sources */,
+                               5C9B860C1C21E3C900110F36 /* NetworkLoadTiming.mm in Sources */,
                                59C27F05138D28C10079B7E2 /* NetworkResourcesData.cpp in Sources */,
                                1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */,
                                443F04270E75C8FB007E5407 /* NetworkStateNotifierIOS.mm in Sources */,
index 851ad35..7fd08fe 100644 (file)
@@ -215,7 +215,7 @@ void FileReaderLoader::didReceiveData(const char* data, int dataLength)
         m_client->didReceiveData();
 }
 
-void FileReaderLoader::didFinishLoading(unsigned long)
+void FileReaderLoader::didFinishLoading(unsigned long, double)
 {
     if (m_variableLength && m_totalBytes > m_bytesLoaded) {
         RefPtr<ArrayBuffer> newData = m_rawData->slice(0, m_bytesLoaded);
index d15ddac..5f4e73e 100644 (file)
@@ -70,7 +70,7 @@ public:
     // ThreadableLoaderClient
     void didReceiveResponse(unsigned long, const ResourceResponse&) override;
     void didReceiveData(const char*, int) override;
-    void didFinishLoading(unsigned long) override;
+    void didFinishLoading(unsigned long, double) override;
     void didFail(const ResourceError&) override;
 
     String stringResult();
index e7a516e..e64eba9 100644 (file)
@@ -244,7 +244,7 @@ bool MediaFragmentURIParser::parseNPTTime(const LChar* timeString, unsigned leng
 
     // http://www.w3.org/2008/WebVideo/Fragments/WD-media-fragments-spec/#npttimedef
     // Normal Play Time can either be specified as seconds, with an optional
-    // fractional part to indicate milliseconds, or as colon-separated hours,
+    // fractional part to indicate miliseconds, or as colon-separated hours,
     // minutes and seconds (again with an optional fraction). Minutes and
     // seconds must be specified as exactly two digits, hours and fractional
     // seconds can be any number of digits. The hours, minutes and seconds
index 70f22af..87f0d93 100644 (file)
@@ -605,13 +605,13 @@ void InspectorInstrumentation::didReceiveDataImpl(InstrumentingAgents& instrumen
         networkAgent->didReceiveData(identifier, data, dataLength, encodedDataLength);
 }
 
-void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader)
+void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime)
 {
     if (!loader)
         return;
 
     if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent())
-        networkAgent->didFinishLoading(identifier, *loader);
+        networkAgent->didFinishLoading(identifier, *loader, finishTime);
 }
 
 void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
index 80f1230..68ceccf 100644 (file)
@@ -157,7 +157,7 @@ public:
     static void didReceiveResourceResponse(Frame&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
     static void didReceiveThreadableLoaderResponse(DocumentThreadableLoader&, unsigned long identifier);
     static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
-    static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier);
+    static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime);
     static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
     static void continueAfterXFrameOptionsDenied(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&);
     static void continueWithPolicyDownload(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&);
@@ -327,7 +327,7 @@ private:
     static void didReceiveResourceResponseImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
     static void didReceiveThreadableLoaderResponseImpl(InstrumentingAgents&, DocumentThreadableLoader&, unsigned long identifier);
     static void didReceiveDataImpl(InstrumentingAgents&, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
-    static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*);
+    static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, double finishTime);
     static void didFailLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceError&);
     static void didFinishXHRLoadingImpl(InstrumentingAgents&, unsigned long identifier, std::optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
     static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&);
@@ -863,10 +863,10 @@ inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long
         didReceiveDataImpl(*instrumentingAgents, identifier, data, dataLength, encodedDataLength);
 }
 
-inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier)
+inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, double finishTime)
 {
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didFinishLoadingImpl(*instrumentingAgents, identifier, loader);
+        didFinishLoadingImpl(*instrumentingAgents, identifier, loader, finishTime);
 }
 
 inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
index ee34ccf..569ce4a 100644 (file)
@@ -114,7 +114,7 @@ public:
         m_responseText.append(m_decoder->decode(data, dataLength));
     }
 
-    void didFinishLoading(unsigned long) override
+    void didFinishLoading(unsigned long, double) override
     {
         if (m_decoder)
             m_responseText.append(m_decoder->flush());
@@ -179,20 +179,20 @@ static Ref<InspectorObject> buildObjectForHeaders(const HTTPHeaderMap& headers)
     return headersObject;
 }
 
-Ref<Inspector::Protocol::Network::ResourceTiming> InspectorNetworkAgent::buildObjectForTiming(const NetworkLoadMetrics& timing, ResourceLoader& resourceLoader)
+Ref<Inspector::Protocol::Network::ResourceTiming> InspectorNetworkAgent::buildObjectForTiming(const NetworkLoadTiming& timing, ResourceLoader& resourceLoader)
 {
     MonotonicTime startTime = resourceLoader.loadTiming().startTime();
     double startTimeInInspector = m_environment.executionStopwatch()->elapsedTimeSince(startTime);
 
     return Inspector::Protocol::Network::ResourceTiming::create()
         .setStartTime(startTimeInInspector)
-        .setDomainLookupStart(timing.domainLookupStart.milliseconds())
-        .setDomainLookupEnd(timing.domainLookupEnd.milliseconds())
-        .setConnectStart(timing.connectStart.milliseconds())
-        .setConnectEnd(timing.connectEnd.milliseconds())
-        .setSecureConnectionStart(timing.secureConnectionStart.milliseconds())
-        .setRequestStart(timing.requestStart.milliseconds())
-        .setResponseStart(timing.responseStart.milliseconds())
+        .setDomainLookupStart(timing.domainLookupStart)
+        .setDomainLookupEnd(timing.domainLookupEnd)
+        .setConnectStart(timing.connectStart)
+        .setConnectEnd(timing.connectEnd)
+        .setSecureConnectionStart(timing.secureConnectionStart)
+        .setRequestStart(timing.requestStart)
+        .setResponseStart(timing.responseStart)
         .release();
 }
 
@@ -229,7 +229,7 @@ RefPtr<Inspector::Protocol::Network::Response> InspectorNetworkAgent::buildObjec
 
     responseObject->setFromDiskCache(response.source() == ResourceResponse::Source::DiskCache || response.source() == ResourceResponse::Source::DiskCacheAfterValidation);
     if (resourceLoader)
-        responseObject->setTiming(buildObjectForTiming(response.deprecatedNetworkLoadMetrics(), *resourceLoader));
+        responseObject->setTiming(buildObjectForTiming(response.networkLoadTiming(), *resourceLoader));
 
     return WTFMove(responseObject);
 }
@@ -380,20 +380,19 @@ void InspectorNetworkAgent::didReceiveData(unsigned long identifier, const char*
     m_frontendDispatcher->dataReceived(requestId, timestamp(), dataLength, encodedDataLength);
 }
 
-void InspectorNetworkAgent::didFinishLoading(unsigned long identifier, DocumentLoader& loader)
+void InspectorNetworkAgent::didFinishLoading(unsigned long identifier, DocumentLoader& loader, double finishTime)
 {
     if (m_hiddenRequestIdentifiers.remove(identifier))
         return;
 
-    // FIXME: Inspector should make use of NetworkLoadMetrics.
-    double elapsedFinishTime = timestamp();
-
     String requestId = IdentifiersFactory::requestId(identifier);
     if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::DocumentResource)
         m_resourcesData->addResourceSharedBuffer(requestId, loader.frameLoader()->documentLoader()->mainResourceData(), loader.frame()->document()->encoding());
 
     m_resourcesData->maybeDecodeDataToContent(requestId);
 
+    double elapsedFinishTime = finishTime ? m_environment.executionStopwatch()->elapsedTimeSince(MonotonicTime::fromRawSeconds(finishTime)) : timestamp();
+
     String sourceMappingURL;
     NetworkResourcesData::ResourceData const* resourceData = m_resourcesData->data(requestId);
     if (resourceData && resourceData->cachedResource())
index 5c29246..a07e0dc 100644 (file)
@@ -49,7 +49,7 @@ class Document;
 class DocumentLoader;
 class DocumentThreadableLoader;
 class InspectorPageAgent;
-class NetworkLoadMetrics;
+class NetworkLoadTiming;
 class NetworkResourcesData;
 class ResourceError;
 class ResourceLoader;
@@ -79,7 +79,7 @@ public:
     void markResourceAsCached(unsigned long identifier);
     void didReceiveResponse(unsigned long identifier, DocumentLoader&, const ResourceResponse&, ResourceLoader*);
     void didReceiveData(unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
-    void didFinishLoading(unsigned long identifier, DocumentLoader&);
+    void didFinishLoading(unsigned long identifier, DocumentLoader&, double finishTime);
     void didFailLoading(unsigned long identifier, DocumentLoader&, const ResourceError&);
     void didLoadResourceFromMemoryCache(DocumentLoader&, CachedResource&);
     void didReceiveThreadableLoaderResponse(unsigned long identifier, DocumentThreadableLoader&);
@@ -117,7 +117,7 @@ public:
 private:
     void enable();
 
-    Ref<Inspector::Protocol::Network::ResourceTiming> buildObjectForTiming(const NetworkLoadMetrics&, ResourceLoader&);
+    Ref<Inspector::Protocol::Network::ResourceTiming> buildObjectForTiming(const NetworkLoadTiming&, ResourceLoader&);
     RefPtr<Inspector::Protocol::Network::Response> buildObjectForResourceResponse(const ResourceResponse&, ResourceLoader*);
     Ref<Inspector::Protocol::Network::CachedResource> buildObjectForCachedResource(CachedResource*);
 
index d5285ef..9886c51 100644 (file)
@@ -83,7 +83,7 @@ void CrossOriginPreflightChecker::validatePreflightResponse(DocumentThreadableLo
     // This is only showing success preflight requests and responses but we should show network events
     // for preflight failures and distinguish them better from non-preflight requests.
     InspectorInstrumentation::didReceiveResourceResponse(*frame, identifier, frame->loader().documentLoader(), response, nullptr);
-    InspectorInstrumentation::didFinishLoading(frame, frame->loader().documentLoader(), identifier);
+    InspectorInstrumentation::didFinishLoading(frame, frame->loader().documentLoader(), identifier, 0);
 
     CrossOriginPreflightResultCache::singleton().appendEntry(loader.securityOrigin().toString(), request.url(), WTFMove(result));
     loader.preflightSuccess(WTFMove(request));
index ce2c5cf..0eb8170 100644 (file)
@@ -363,7 +363,7 @@ void DocumentLoader::notifyFinished(CachedResource& resource)
     ASSERT_UNUSED(resource, m_mainResource == &resource);
     ASSERT(m_mainResource);
     if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) {
-        finishedLoading();
+        finishedLoading(m_mainResource->loadFinishTime());
         return;
     }
 
@@ -375,7 +375,7 @@ void DocumentLoader::notifyFinished(CachedResource& resource)
     mainReceivedError(m_mainResource->resourceError());
 }
 
-void DocumentLoader::finishedLoading()
+void DocumentLoader::finishedLoading(double finishTime)
 {
     // There is a bug in CFNetwork where callbacks can be dispatched even when loads are deferred.
     // See <rdar://problem/6304600> for more details.
@@ -392,12 +392,16 @@ void DocumentLoader::finishedLoading()
         // cancel the already-finished substitute load.
         unsigned long identifier = m_identifierForLoadWithoutResourceLoader;
         m_identifierForLoadWithoutResourceLoader = 0;
-        frameLoader()->notifier().dispatchDidFinishLoading(this, identifier);
+        frameLoader()->notifier().dispatchDidFinishLoading(this, identifier, finishTime);
     }
 
     maybeFinishLoadingMultipartContent();
 
-    MonotonicTime responseEndTime = m_timeOfLastDataReceived ? m_timeOfLastDataReceived : MonotonicTime::now();
+    MonotonicTime responseEndTime = MonotonicTime::fromRawSeconds(finishTime);
+    if (!responseEndTime)
+        responseEndTime = m_timeOfLastDataReceived;
+    if (!responseEndTime)
+        responseEndTime = MonotonicTime::now();
     timing().setResponseEnd(responseEndTime);
 
     commitIfReady();
@@ -808,7 +812,7 @@ void DocumentLoader::continueAfterContentPolicy(PolicyAction policy)
         if (content && content->size())
             dataReceived(content->data(), content->size());
         if (isLoadingMainResource())
-            finishedLoading();
+            finishedLoading(0);
     }
 }
 
@@ -1421,7 +1425,7 @@ bool DocumentLoader::maybeLoadEmpty()
 
     String mimeType = shouldLoadEmpty ? "text/html" : frameLoader()->client().generatedMIMETypeForURLScheme(m_request.url().protocol().toStringWithoutCopying());
     m_response = ResourceResponse(m_request.url(), mimeType, 0, String());
-    finishedLoading();
+    finishedLoading(monotonicallyIncreasingTime());
     return true;
 }
 
index 0ad372a..138883f 100644 (file)
@@ -319,7 +319,7 @@ private:
 #endif
 
     void willSendRequest(ResourceRequest&, const ResourceResponse&);
-    void finishedLoading();
+    void finishedLoading(double finishTime);
     void mainReceivedError(const ResourceError&);
     WEBCORE_EXPORT void redirectReceived(CachedResource&, ResourceRequest&, const ResourceResponse&) override;
     WEBCORE_EXPORT void responseReceived(CachedResource&, const ResourceResponse&) override;
index 34ea5af..d667935 100644 (file)
@@ -306,7 +306,7 @@ void DocumentThreadableLoader::didReceiveResponse(unsigned long identifier, cons
         if (tainting == ResourceResponse::Tainting::Opaque) {
             clearResource();
             if (m_client)
-                m_client->didFinishLoading(identifier);
+                m_client->didFinishLoading(identifier, 0.0);
         }
     } else {
         ASSERT(response.type() == ResourceResponse::Type::Opaqueredirect);
@@ -355,13 +355,13 @@ void DocumentThreadableLoader::notifyFinished(CachedResource& resource)
     if (m_resource->errorOccurred())
         didFail(m_resource->identifier(), m_resource->resourceError());
     else
-        didFinishLoading(m_resource->identifier());
+        didFinishLoading(m_resource->identifier(), m_resource->loadFinishTime());
 }
 
-void DocumentThreadableLoader::didFinishLoading(unsigned long identifier)
+void DocumentThreadableLoader::didFinishLoading(unsigned long identifier, double finishTime)
 {
     ASSERT(m_client);
-    m_client->didFinishLoading(identifier);
+    m_client->didFinishLoading(identifier, finishTime);
 }
 
 void DocumentThreadableLoader::didFail(unsigned long, const ResourceError& error)
@@ -461,7 +461,7 @@ void DocumentThreadableLoader::loadRequest(ResourceRequest&& request, SecurityCh
             // We don't want XMLHttpRequest to raise an exception for file:// resources, see <rdar://problem/4962298>.
             // FIXME: XMLHttpRequest quirks should be in XMLHttpRequest code, not in DocumentThreadableLoader.cpp.
             didReceiveResponse(identifier, response, ResourceResponse::Tainting::Basic);
-            didFinishLoading(identifier);
+            didFinishLoading(identifier, 0.0);
             return;
         }
         logErrorAndFail(error);
@@ -504,7 +504,7 @@ void DocumentThreadableLoader::loadRequest(ResourceRequest&& request, SecurityCh
 
 #if ENABLE(WEB_TIMING)
     if (RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) {
-        ResourceTiming resourceTiming = ResourceTiming::fromSynchronousLoad(requestURL, m_options.initiator, loadTiming, response.deprecatedNetworkLoadMetrics(), response, securityOrigin());
+        ResourceTiming resourceTiming = ResourceTiming::fromSynchronousLoad(requestURL, m_options.initiator, loadTiming, response.networkLoadTiming(), response, securityOrigin());
         if (options().initiatorContext == InitiatorContext::Worker)
             finishedTimingForWorkerLoad(resourceTiming);
         else {
@@ -514,7 +514,7 @@ void DocumentThreadableLoader::loadRequest(ResourceRequest&& request, SecurityCh
     }
 #endif
 
-    didFinishLoading(identifier);
+    didFinishLoading(identifier, 0.0);
 }
 
 bool DocumentThreadableLoader::isAllowedByContentSecurityPolicy(const URL& url, ContentSecurityPolicy::RedirectResponseReceived redirectResponseReceived)
index 2630d57..37f951f 100644 (file)
@@ -89,7 +89,7 @@ namespace WebCore {
 
         void didReceiveResponse(unsigned long identifier, const ResourceResponse&, ResourceResponse::Tainting);
         void didReceiveData(unsigned long identifier, const char* data, int dataLength);
-        void didFinishLoading(unsigned long identifier);
+        void didFinishLoading(unsigned long identifier, double finishTime);
         void didFail(unsigned long identifier, const ResourceError&);
         void makeCrossOriginAccessRequest(ResourceRequest&&);
         void makeSimpleCrossOriginAccessRequest(ResourceRequest&&);
index 45624c4..6b9a344 100644 (file)
@@ -146,14 +146,14 @@ void NetscapePlugInStreamLoader::didReceiveDataOrBuffer(const char* data, int le
     ResourceLoader::didReceiveDataOrBuffer(data, length, WTFMove(buffer), encodedDataLength, dataPayloadType);
 }
 
-void NetscapePlugInStreamLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMetrics)
+void NetscapePlugInStreamLoader::didFinishLoading(double finishTime)
 {
     Ref<NetscapePlugInStreamLoader> protectedThis(*this);
 
     notifyDone();
 
     m_client->didFinishLoading(this);
-    ResourceLoader::didFinishLoading(networkLoadMetrics);
+    ResourceLoader::didFinishLoading(finishTime);
 }
 
 void NetscapePlugInStreamLoader::didFail(const ResourceError& error)
index 1288111..1fe772b 100644 (file)
@@ -62,7 +62,7 @@ private:
     void didReceiveResponse(const ResourceResponse&) override;
     void didReceiveData(const char*, unsigned, long long encodedDataLength, DataPayloadType) override;
     void didReceiveBuffer(Ref<SharedBuffer>&&, long long encodedDataLength, DataPayloadType) override;
-    void didFinishLoading(const NetworkLoadMetrics&) override;
+    void didFinishLoading(double finishTime) override;
     void didFail(const ResourceError&) override;
 
     void releaseResources() override;
index d0cd98b..63443d3 100644 (file)
@@ -87,14 +87,11 @@ void ResourceLoadNotifier::didReceiveData(ResourceLoader* loader, const char* da
     dispatchDidReceiveData(loader->documentLoader(), loader->identifier(), data, dataLength, encodedDataLength);
 }
 
-void ResourceLoadNotifier::didFinishLoad(ResourceLoader* loader, const NetworkLoadMetrics&)
+void ResourceLoadNotifier::didFinishLoad(ResourceLoader* loader, double finishTime)
 {    
     if (Page* page = m_frame.page())
         page->progress().completeProgress(loader->identifier());
-
-    // FIXME: Inspector should make use of NetworkLoadMetrics.
-
-    dispatchDidFinishLoading(loader->documentLoader(), loader->identifier());
+    dispatchDidFinishLoading(loader->documentLoader(), loader->identifier(), finishTime);
 }
 
 void ResourceLoadNotifier::didFailToLoad(ResourceLoader* loader, const ResourceError& error)
@@ -162,13 +159,13 @@ void ResourceLoadNotifier::dispatchDidReceiveData(DocumentLoader* loader, unsign
     InspectorInstrumentation::didReceiveData(&m_frame, identifier, data, dataLength, encodedDataLength);
 }
 
-void ResourceLoadNotifier::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier)
+void ResourceLoadNotifier::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier, double finishTime)
 {
     // Notifying the FrameLoaderClient may cause the frame to be destroyed.
     Ref<Frame> protect(m_frame);
     m_frame.loader().client().dispatchDidFinishLoading(loader, identifier);
 
-    InspectorInstrumentation::didFinishLoading(&m_frame, loader, identifier);
+    InspectorInstrumentation::didFinishLoading(&m_frame, loader, identifier, finishTime);
 }
 
 void ResourceLoadNotifier::dispatchDidFailLoading(DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
@@ -197,7 +194,7 @@ void ResourceLoadNotifier::sendRemainingDelegateMessages(DocumentLoader* loader,
         dispatchDidReceiveData(loader, identifier, data, dataLength, encodedDataLength);
 
     if (error.isNull())
-        dispatchDidFinishLoading(loader, identifier);
+        dispatchDidFinishLoading(loader, identifier, 0);
     else
         dispatchDidFailLoading(loader, identifier, error);
 }
index 4cc1f2b..f316ec2 100644 (file)
@@ -36,11 +36,11 @@ namespace WebCore {
 class AuthenticationChallenge;
 class DocumentLoader;
 class Frame;
-class NetworkLoadMetrics;
+class Page;
 class ResourceError;
 class ResourceLoader;
-class ResourceRequest;
 class ResourceResponse;
+class ResourceRequest;
 
 class ResourceLoadNotifier {
     WTF_MAKE_NONCOPYABLE(ResourceLoadNotifier);
@@ -53,14 +53,14 @@ public:
     void willSendRequest(ResourceLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
     void didReceiveResponse(ResourceLoader*, const ResourceResponse&);
     void didReceiveData(ResourceLoader*, const char*, int dataLength, int encodedDataLength);
-    void didFinishLoad(ResourceLoader*, const NetworkLoadMetrics&);
+    void didFinishLoad(ResourceLoader*, double finishTime);
     void didFailToLoad(ResourceLoader*, const ResourceError&);
 
     void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&);
     void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
     void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&, ResourceLoader* = nullptr);
     void dispatchDidReceiveData(DocumentLoader*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
-    void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier);
+    void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier, double finishTime);
     void dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&);
 
     void sendRemainingDelegateMessages(DocumentLoader*, unsigned long identifier, const ResourceRequest&, const ResourceResponse&, const char* data, int dataLength, int encodedDataLength, const ResourceError&);
index d65f3bf..0fbb0c3 100644 (file)
@@ -181,8 +181,7 @@ void ResourceLoader::deliverResponseAndData(const ResourceResponse& response, Re
             return;
     }
 
-    NetworkLoadMetrics emptyMetrics;
-    didFinishLoading(emptyMetrics);
+    didFinishLoading(0);
 }
 
 void ResourceLoader::start()
@@ -272,10 +271,8 @@ void ResourceLoader::loadDataURL()
         if (!protectedThis->reachedTerminalState() && dataSize)
             protectedThis->didReceiveBuffer(result.data.releaseNonNull(), dataSize, DataPayloadWholeResource);
 
-        if (!protectedThis->reachedTerminalState()) {
-            NetworkLoadMetrics emptyMetrics;
-            protectedThis->didFinishLoading(emptyMetrics);
-        }
+        if (!protectedThis->reachedTerminalState())
+            protectedThis->didFinishLoading(currentTime());
     });
 }
 
@@ -491,9 +488,9 @@ void ResourceLoader::didReceiveDataOrBuffer(const char* data, unsigned length, R
         frameLoader()->notifier().didReceiveData(this, buffer ? buffer->data() : data, buffer ? buffer->size() : length, static_cast<int>(encodedDataLength));
 }
 
-void ResourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMetrics)
+void ResourceLoader::didFinishLoading(double finishTime)
 {
-    didFinishLoadingOnePart(networkLoadMetrics);
+    didFinishLoadingOnePart(finishTime);
 
     // If the load has been cancelled by a delegate in response to didFinishLoad(), do not release
     // the resources a second time, they have been released by cancel.
@@ -502,7 +499,7 @@ void ResourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMetri
     releaseResources();
 }
 
-void ResourceLoader::didFinishLoadingOnePart(const NetworkLoadMetrics& networkLoadMetrics)
+void ResourceLoader::didFinishLoadingOnePart(double finishTime)
 {
     // If load has been cancelled after finishing (which could happen with a
     // JavaScript that changes the window location), do nothing.
@@ -514,7 +511,7 @@ void ResourceLoader::didFinishLoadingOnePart(const NetworkLoadMetrics& networkLo
         return;
     m_notifiedLoadComplete = true;
     if (m_options.sendLoadCallbacks == SendCallbacks)
-        frameLoader()->notifier().didFinishLoad(this, networkLoadMetrics);
+        frameLoader()->notifier().didFinishLoad(this, finishTime);
 }
 
 void ResourceLoader::didFail(const ResourceError& error)
@@ -648,10 +645,9 @@ void ResourceLoader::didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&& buffe
     didReceiveBuffer(WTFMove(buffer), encodedDataLength, DataPayloadBytes);
 }
 
-void ResourceLoader::didFinishLoading(ResourceHandle*)
+void ResourceLoader::didFinishLoading(ResourceHandle*, double finishTime)
 {
-    NetworkLoadMetrics emptyMetrics;
-    didFinishLoading(emptyMetrics);
+    didFinishLoading(finishTime);
 }
 
 void ResourceLoader::didFail(ResourceHandle*, const ResourceError& error)
index 5a5ec14..5bb1eda 100644 (file)
@@ -50,7 +50,6 @@ class AuthenticationChallenge;
 class DocumentLoader;
 class Frame;
 class FrameLoader;
-class NetworkLoadMetrics;
 class QuickLookHandle;
 class URL;
 
@@ -103,7 +102,7 @@ public:
     virtual void didReceiveResponse(const ResourceResponse&);
     virtual void didReceiveData(const char*, unsigned, long long encodedDataLength, DataPayloadType);
     virtual void didReceiveBuffer(Ref<SharedBuffer>&&, long long encodedDataLength, DataPayloadType);
-    virtual void didFinishLoading(const NetworkLoadMetrics&);
+    virtual void didFinishLoading(double finishTime);
     virtual void didFail(const ResourceError&);
 #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
     virtual void didReceiveDataArray(CFArrayRef dataArray);
@@ -153,7 +152,7 @@ public:
 protected:
     ResourceLoader(Frame&, ResourceLoaderOptions);
 
-    void didFinishLoadingOnePart(const NetworkLoadMetrics&);
+    void didFinishLoadingOnePart(double finishTime);
     void cleanupForError(const ResourceError&);
 
     bool wasCancelled() const { return m_cancellationStatus >= Cancelled; }
@@ -192,7 +191,7 @@ private:
     void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override;
     void didReceiveData(ResourceHandle*, const char*, unsigned, int encodedDataLength) override;
     void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedDataLength) override;
-    void didFinishLoading(ResourceHandle*) override;
+    void didFinishLoading(ResourceHandle*, double finishTime) override;
     void didFail(ResourceHandle*, const ResourceError&) override;
     void wasBlocked(ResourceHandle*) override;
     void cannotShowURL(ResourceHandle*) override;
index 0340be8..ccdef73 100644 (file)
@@ -60,14 +60,14 @@ ResourceTiming ResourceTiming::fromCache(const URL& url, const String& initiator
     return ResourceTiming(url, initiator, loadTiming);
 }
 
-ResourceTiming ResourceTiming::fromLoad(CachedResource& resource, const String& initiator, const LoadTiming& loadTiming, const NetworkLoadMetrics& networkLoadMetrics, const SecurityOrigin& securityOrigin)
+ResourceTiming ResourceTiming::fromLoad(CachedResource& resource, const String& initiator, const LoadTiming& loadTiming, const SecurityOrigin& securityOrigin)
 {
-    return ResourceTiming(resource, initiator, loadTiming, networkLoadMetrics, securityOrigin);
+    return ResourceTiming(resource, initiator, loadTiming, securityOrigin);
 }
 
-ResourceTiming ResourceTiming::fromSynchronousLoad(const URL& url, const String& initiator, const LoadTiming& loadTiming, const NetworkLoadMetrics& networkLoadMetrics, const ResourceResponse& response, const SecurityOrigin& securityOrigin)
+ResourceTiming ResourceTiming::fromSynchronousLoad(const URL& url, const String& initiator, const LoadTiming& loadTiming, const NetworkLoadTiming& networkLoadTiming, const ResourceResponse& response, const SecurityOrigin& securityOrigin)
 {
-    return ResourceTiming(url, initiator, loadTiming, networkLoadMetrics, response, securityOrigin);
+    return ResourceTiming(url, initiator, loadTiming, networkLoadTiming, response, securityOrigin);
 }
 
 ResourceTiming::ResourceTiming(const URL& url, const String& initiator, const LoadTiming& loadTiming)
@@ -78,27 +78,27 @@ ResourceTiming::ResourceTiming(const URL& url, const String& initiator, const Lo
 {
 }
 
-ResourceTiming::ResourceTiming(CachedResource& resource, const String& initiator, const LoadTiming& loadTiming, const NetworkLoadMetrics& networkLoadMetrics, const SecurityOrigin& securityOrigin)
+ResourceTiming::ResourceTiming(CachedResource& resource, const String& initiator, const LoadTiming& loadTiming, const SecurityOrigin& securityOrigin)
     : m_url(resource.resourceRequest().url())
     , m_initiator(initiator)
     , m_loadTiming(loadTiming)
-    , m_networkLoadMetrics(networkLoadMetrics)
+    , m_networkLoadTiming(resource.response().networkLoadTiming())
     , m_allowTimingDetails(passesTimingAllowCheck(resource.response(), securityOrigin))
 {
 }
 
-ResourceTiming::ResourceTiming(const URL& url, const String& initiator, const LoadTiming& loadTiming, const NetworkLoadMetrics& networkLoadMetrics, const ResourceResponse& response, const SecurityOrigin& securityOrigin)
+ResourceTiming::ResourceTiming(const URL& url, const String& initiator, const LoadTiming& loadTiming, const NetworkLoadTiming& networkLoadTiming, const ResourceResponse& response, const SecurityOrigin& securityOrigin)
     : m_url(url)
     , m_initiator(initiator)
     , m_loadTiming(loadTiming)
-    , m_networkLoadMetrics(networkLoadMetrics)
+    , m_networkLoadTiming(networkLoadTiming)
     , m_allowTimingDetails(passesTimingAllowCheck(response, securityOrigin))
 {
 }
 
 ResourceTiming ResourceTiming::isolatedCopy() const
 {
-    return ResourceTiming(m_url.isolatedCopy(), m_initiator.isolatedCopy(), m_loadTiming.isolatedCopy(), m_networkLoadMetrics.isolatedCopy(), m_allowTimingDetails);
+    return ResourceTiming(m_url.isolatedCopy(), m_initiator.isolatedCopy(), m_loadTiming.isolatedCopy(), m_networkLoadTiming.isolatedCopy(), m_allowTimingDetails);
 }
 
 } // namespace WebCore
index 646235f..222122a 100644 (file)
@@ -26,7 +26,7 @@
 #pragma once
 
 #include "LoadTiming.h"
-#include "NetworkLoadMetrics.h"
+#include "NetworkLoadTiming.h"
 #include "URL.h"
 
 namespace WebCore {
@@ -39,13 +39,13 @@ class ResourceTiming {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     static ResourceTiming fromCache(const URL&, const String& initiator, const LoadTiming&);
-    static ResourceTiming fromLoad(CachedResource&, const String& initiator, const LoadTiming&, const NetworkLoadMetrics&, const SecurityOrigin&);
-    static ResourceTiming fromSynchronousLoad(const URL&, const String& initiator, const LoadTiming&, const NetworkLoadMetrics&, const ResourceResponse&, const SecurityOrigin&);
+    static ResourceTiming fromLoad(CachedResource&, const String& initiator, const LoadTiming&, const SecurityOrigin&);
+    static ResourceTiming fromSynchronousLoad(const URL&, const String& initiator, const LoadTiming&, const NetworkLoadTiming&, const ResourceResponse&, const SecurityOrigin&);
 
     URL url() const { return m_url; }
     String initiator() const { return m_initiator; }
     LoadTiming loadTiming() const { return m_loadTiming; }
-    NetworkLoadMetrics networkLoadMetrics() const { return m_networkLoadMetrics; }
+    NetworkLoadTiming networkLoadTiming() const { return m_networkLoadTiming; }
     bool allowTimingDetails() const { return m_allowTimingDetails; }
 
     ResourceTiming isolatedCopy() const;
@@ -53,14 +53,14 @@ public:
     void overrideInitiatorName(const String& name) { m_initiator = name; }
 
 private:
-    ResourceTiming(CachedResource&, const String& initiator, const LoadTiming&, const NetworkLoadMetrics&, const SecurityOrigin&);
-    ResourceTiming(const URL&, const String& initiator, const LoadTiming&, const NetworkLoadMetrics&, const ResourceResponse&, const SecurityOrigin&);
+    ResourceTiming(CachedResource&, const String& initiator, const LoadTiming&, const SecurityOrigin&);
+    ResourceTiming(const URL&, const String& initiator, const LoadTiming&, const NetworkLoadTiming&, const ResourceResponse&, const SecurityOrigin&);
     ResourceTiming(const URL&, const String& initiator, const LoadTiming&);
-    ResourceTiming(const URL& url, const String& initiator, const LoadTiming& loadTiming, const NetworkLoadMetrics& networkLoadMetrics, bool allowTimingDetails)
+    ResourceTiming(const URL& url, const String& initiator, const LoadTiming& loadTiming, const NetworkLoadTiming& networkLoadTiming, bool allowTimingDetails)
         : m_url(url)
         , m_initiator(initiator)
         , m_loadTiming(loadTiming)
-        , m_networkLoadMetrics(networkLoadMetrics)
+        , m_networkLoadTiming(networkLoadTiming)
         , m_allowTimingDetails(allowTimingDetails)
     {
     }
@@ -68,7 +68,7 @@ private:
     URL m_url;
     String m_initiator;
     LoadTiming m_loadTiming;
-    NetworkLoadMetrics m_networkLoadMetrics;
+    NetworkLoadTiming m_networkLoadTiming;
     bool m_allowTimingDetails { false };
 };
 
index da8b0ae..e3cadca 100644 (file)
@@ -81,6 +81,7 @@ SubresourceLoader::RequestCountTracker::~RequestCountTracker()
 SubresourceLoader::SubresourceLoader(Frame& frame, CachedResource& resource, const ResourceLoaderOptions& options)
     : ResourceLoader(frame, options)
     , m_resource(&resource)
+    , m_loadingMultipartContent(false)
     , m_state(Uninitialized)
     , m_requestCountTracker(std::in_place, frame.document()->cachedResourceLoader(), resource)
 {
@@ -191,8 +192,7 @@ void SubresourceLoader::willSendRequestInternal(ResourceRequest& newRequest, con
             opaqueRedirectedResponse.setURL(redirectResponse.url());
             opaqueRedirectedResponse.setType(ResourceResponse::Type::Opaqueredirect);
             m_resource->responseReceived(opaqueRedirectedResponse);
-            NetworkLoadMetrics emptyMetrics;
-            didFinishLoading(emptyMetrics);
+            didFinishLoading(currentTime());
             return;
         } else if (m_redirectCount++ >= options().maxRedirectCount) {
             cancel(ResourceError(String(), 0, request().url(), ASCIILiteral("Too many redirections"), ResourceError::Type::General));
@@ -283,12 +283,8 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response)
     }
 #endif
 
-    // We want redirect responses to be processed through willSendRequestInternal.
-    // The only exception is redirection with no Location headers. Or in rare circumstances,
-    // cases of too many redirects from CFNetwork (<rdar://problem/30610988>).
-#if !PLATFORM(COCOA)
+    // We want redirect responses to be processed through willSendRequestInternal. The only exception is redirection with no Location headers.
     ASSERT(response.httpStatusCode() < 300 || response.httpStatusCode() >= 400 || response.httpStatusCode() == 304 || !response.httpHeaderField(HTTPHeaderName::Location));
-#endif
 
     // Reference the object in this method since the additional processing can do
     // anything including removing the last reference to this object; one example of this is 3266216.
@@ -351,9 +347,8 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response)
         clearResourceData();
         // Since a subresource loader does not load multipart sections progressively, data was delivered to the loader all at once.
         // After the first multipart section is complete, signal to delegates that this load is "finished"
-        NetworkLoadMetrics emptyMetrics;
         m_documentLoader->subresourceLoaderFinishedLoadingOnePart(this);
-        didFinishLoadingOnePart(emptyMetrics);
+        didFinishLoadingOnePart(0);
     }
 
     checkForHTTPStatusCodeError();
@@ -515,7 +510,7 @@ bool SubresourceLoader::checkRedirectionCrossOriginAccessControl(const ResourceR
     return true;
 }
 
-void SubresourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMetrics)
+void SubresourceLoader::didFinishLoading(double finishTime)
 {
 #if USE(QUICK_LOOK)
     if (auto quickLookHandle = m_quickLookHandle.get()) {
@@ -536,28 +531,30 @@ void SubresourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMe
     Ref<SubresourceLoader> protectedThis(*this);
     CachedResourceHandle<CachedResource> protectResource(m_resource);
 
-    // FIXME: Remove this with deprecatedNetworkLoadMetrics.
-    m_loadTiming.setResponseEnd(MonotonicTime::now());
+    // FIXME: <https://webkit.org/b/168351> [Resource Timing] Gather timing information with reliable responseEnd time
+    // The finishTime that is passed in is from the NetworkProcess and is more accurate.
+    // However, all other load times are generated from the web process or offsets.
+    // Mixing times from different processes can cause the finish time to be earlier than
+    // the response received time due to inter-process communication lag. This could be solved
+    // by gathering NetworkLoadTiming information at completion time instead of at
+    // didReceiveResponse time.
+    UNUSED_PARAM(finishTime);
+    MonotonicTime responseEndTime = MonotonicTime::now();
+    m_loadTiming.setResponseEnd(responseEndTime);
 
 #if ENABLE(WEB_TIMING)
-    if (networkLoadMetrics.isComplete())
-        reportResourceTiming(networkLoadMetrics);
-    else {
-        // This is the legacy path for platforms (and ResourceHandle paths) that do not provide
-        // complete load metrics in didFinishLoad. In those cases, fall back to the possibility
-        // that they populated partial load timing information on the ResourceResponse.
-        reportResourceTiming(m_resource->response().deprecatedNetworkLoadMetrics());
-    }
+    reportResourceTiming();
 #endif
 
     m_state = Finishing;
+    m_resource->setLoadFinishTime(responseEndTime.secondsSinceEpoch().seconds()); // FIXME: Users of the loadFinishTime should use the LoadTiming struct instead.
     m_resource->finishLoading(resourceData());
 
     if (wasCancelled())
         return;
     m_resource->finish();
     ASSERT(!reachedTerminalState());
-    didFinishLoadingOnePart(m_resource->response().deprecatedNetworkLoadMetrics());
+    didFinishLoadingOnePart(responseEndTime.secondsSinceEpoch().seconds());
     notifyDone();
     if (reachedTerminalState())
         return;
@@ -665,7 +662,7 @@ void SubresourceLoader::releaseResources()
 }
 
 #if ENABLE(WEB_TIMING)
-void SubresourceLoader::reportResourceTiming(const NetworkLoadMetrics& networkLoadMetrics)
+void SubresourceLoader::reportResourceTiming()
 {
     if (!RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled())
         return;
@@ -676,9 +673,9 @@ void SubresourceLoader::reportResourceTiming(const NetworkLoadMetrics& networkLo
     Document* document = m_documentLoader->cachedResourceLoader().document();
     if (!document)
         return;
-
+    
     SecurityOrigin& origin = m_origin ? *m_origin : document->securityOrigin();
-    ResourceTiming resourceTiming = ResourceTiming::fromLoad(*m_resource, m_resource->initiatorName(), m_loadTiming, networkLoadMetrics, origin);
+    ResourceTiming resourceTiming = ResourceTiming::fromLoad(*m_resource, m_resource->initiatorName(), m_loadTiming, origin);
 
     // Worker resources loaded here are all CachedRawResources loaded through WorkerThreadableLoader.
     // Pass the ResourceTiming information on so that WorkerThreadableLoader may add them to the
index 828aa9b..929bc56 100644 (file)
 
 #include "FrameLoaderTypes.h"
 #include "ResourceLoader.h"
+
 #include <wtf/text/WTFString.h>
  
 namespace WebCore {
 
 class CachedResource;
 class CachedResourceLoader;
-class NetworkLoadMetrics;
+class Document;
 class ResourceRequest;
 class SecurityOrigin;
 
@@ -70,7 +71,7 @@ private:
     void didReceiveResponse(const ResourceResponse&) override;
     void didReceiveData(const char*, unsigned, long long encodedDataLength, DataPayloadType) override;
     void didReceiveBuffer(Ref<SharedBuffer>&&, long long encodedDataLength, DataPayloadType) override;
-    void didFinishLoading(const NetworkLoadMetrics&) override;
+    void didFinishLoading(double finishTime) override;
     void didFail(const ResourceError&) override;
     void willCancel(const ResourceError&) override;
     void didCancel(const ResourceError&) override;
@@ -102,7 +103,7 @@ private:
     void notifyDone();
 
 #if ENABLE(WEB_TIMING)
-    void reportResourceTiming(const NetworkLoadMetrics&);
+    void reportResourceTiming();
 #endif
 
 #if USE(QUICK_LOOK)
@@ -134,11 +135,11 @@ private:
     ResourceRequest m_iOSOriginalRequest;
 #endif
     CachedResource* m_resource;
+    bool m_loadingMultipartContent;
     SubresourceLoaderState m_state;
     std::optional<RequestCountTracker> m_requestCountTracker;
     RefPtr<SecurityOrigin> m_origin;
     unsigned m_redirectCount { 0 };
-    bool m_loadingMultipartContent { false };
 };
 
 }
index 5d4f2c9..a51c388 100644 (file)
@@ -43,7 +43,7 @@ namespace WebCore {
 
         virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&) { }
         virtual void didReceiveData(const char*, int /*dataLength*/) { }
-        virtual void didFinishLoading(unsigned long /*identifier*/) { }
+        virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) { }
         virtual void didFail(const ResourceError&) { }
 
 #if ENABLE(WEB_TIMING)
index 23d28da..602b2f2 100644 (file)
@@ -73,11 +73,11 @@ public:
             m_client->didReceiveData(data, dataLength);
     }
 
-    void didFinishLoading(unsigned long identifier)
+    void didFinishLoading(unsigned long identifier, double finishTime)
     {
         m_done = true;
         if (m_client)
-            m_client->didFinishLoading(identifier);
+            m_client->didFinishLoading(identifier, finishTime);
     }
 
     void didFail(const ResourceError& error)
index 15edb45..31ea9bb 100644 (file)
@@ -201,12 +201,12 @@ void WorkerThreadableLoader::MainThreadBridge::didReceiveData(const char* data,
     }, m_taskMode);
 }
 
-void WorkerThreadableLoader::MainThreadBridge::didFinishLoading(unsigned long identifier)
+void WorkerThreadableLoader::MainThreadBridge::didFinishLoading(unsigned long identifier, double finishTime)
 {
     m_loadingFinished = true;
-    m_loaderProxy.postTaskForModeToWorkerGlobalScope([protectedWorkerClientWrapper = makeRef(*m_workerClientWrapper), identifier] (ScriptExecutionContext& context) mutable {
+    m_loaderProxy.postTaskForModeToWorkerGlobalScope([protectedWorkerClientWrapper = makeRef(*m_workerClientWrapper), identifier, finishTime] (ScriptExecutionContext& context) mutable {
         ASSERT_UNUSED(context, context.isWorkerGlobalScope());
-        protectedWorkerClientWrapper->didFinishLoading(identifier);
+        protectedWorkerClientWrapper->didFinishLoading(identifier, finishTime);
     }, m_taskMode);
 }
 
index bc96c81..c0a5705 100644 (file)
@@ -101,7 +101,7 @@ namespace WebCore {
             void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
             void didReceiveResponse(unsigned long identifier, const ResourceResponse&) override;
             void didReceiveData(const char*, int dataLength) override;
-            void didFinishLoading(unsigned long identifier) override;
+            void didFinishLoading(unsigned long identifier, double finishTime) override;
             void didFail(const ResourceError&) override;
 
 #if ENABLE(WEB_TIMING)
index b77beb5..9f9ab00 100644 (file)
@@ -570,9 +570,9 @@ void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* d
     m_currentResource->data().append(data, length);
 }
 
-void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle)
+void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle, double finishTime)
 {
-    InspectorInstrumentation::didFinishLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier);
+    InspectorInstrumentation::didFinishLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, finishTime);
 
     if (handle == m_manifestHandle) {
         didFinishLoadingManifest();
index 5373845..ceb83df 100644 (file)
@@ -108,10 +108,9 @@ private:
     // the existing client callback cannot be used, so assume that any client that enables application cache also wants it to use credential storage.
     bool shouldUseCredentialStorage(ResourceHandle*) override { return true; }
 
-    // ResourceHandleClient
     void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override;
     void didReceiveData(ResourceHandle*, const char*, unsigned length, int encodedDataLength) override;
-    void didFinishLoading(ResourceHandle*) override;
+    void didFinishLoading(ResourceHandle*, double finishTime) override;
     void didFail(ResourceHandle*, const ResourceError&) override;
 
     void didReceiveManifestResponse(const ResourceResponse&);
index 380b546..6f4e0e1 100644 (file)
@@ -260,6 +260,9 @@ public:
 
     virtual void didRetrieveDerivedDataFromCache(const String& /* type */, SharedBuffer&) { }
 
+    void setLoadFinishTime(double finishTime) { m_loadFinishTime = finishTime; }
+    double loadFinishTime() const { return m_loadFinishTime; }
+
 #if USE(FOUNDATION) || USE(SOUP)
     WEBCORE_EXPORT void tryReplaceEncodedData(SharedBuffer&);
 #endif
@@ -320,6 +323,7 @@ private:
     AtomicString m_initiatorName;
 
     double m_lastDecodedAccessTime { 0 }; // Used as a "thrash guard" in the cache
+    double m_loadFinishTime { 0 };
 
     unsigned m_encodedSize { 0 };
     unsigned m_decodedSize { 0 };
index d935fa6..396b835 100644 (file)
@@ -40,7 +40,6 @@
 #import "ResourceLoader.h"
 #import "ResourceRequest.h"
 #import "SharedBuffer.h"
-#import <WebCore/NetworkLoadMetrics.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/Vector.h>
 #import <wtf/text/WTFString.h>
@@ -231,9 +230,7 @@ static QuickLookHandleClient& emptyClient()
 {
     ASSERT_UNUSED(connection, !connection);
     ASSERT(_hasSentDidReceiveResponse);
-
-    NetworkLoadMetrics emptyMetrics;
-    _resourceLoader->didFinishLoading(emptyMetrics);
+    _resourceLoader->didFinishLoading(0);
 }
 
 static inline bool isQuickLookPasswordError(NSError *error)
index 2eae8cf..d5555ed 100644 (file)
@@ -213,7 +213,7 @@ void EventSource::didReceiveData(const char* data, int length)
     parseEventStream();
 }
 
-void EventSource::didFinishLoading(unsigned long)
+void EventSource::didFinishLoading(unsigned long, double)
 {
     ASSERT(m_state == OPEN);
     ASSERT(m_requestInFlight);
index 3792a91..60501f3 100644 (file)
@@ -81,7 +81,7 @@ private:
     // ThreadableLoaderClient
     void didReceiveResponse(unsigned long, const ResourceResponse&) final;
     void didReceiveData(const char*, int) final;
-    void didFinishLoading(unsigned long) final;
+    void didFinishLoading(unsigned long, double) final;
     void didFail(const ResourceError&) final;
 
     void stop() final;
index c56f18e..270a086 100644 (file)
@@ -1,5 +1,4 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
  * Copyright (C) 2012 Google Inc. All rights reserved.
  * Copyright (C) 2012 Intel Inc. All rights reserved.
  *
@@ -54,32 +53,17 @@ static double monotonicTimeToDOMHighResTimeStamp(MonotonicTime timeOrigin, Monot
     return Performance::reduceTimeResolution(seconds).milliseconds();
 }
 
-static double entryStartTime(MonotonicTime timeOrigin, const ResourceTiming& resourceTiming)
-{
-    return monotonicTimeToDOMHighResTimeStamp(timeOrigin, resourceTiming.loadTiming().startTime());
-}
-
-static double entryEndTime(MonotonicTime timeOrigin, const ResourceTiming& resourceTiming)
-{
-    if (resourceTiming.networkLoadMetrics().isComplete()) {
-        Seconds endTime = (resourceTiming.loadTiming().fetchStart() + resourceTiming.networkLoadMetrics().responseEnd) - timeOrigin;
-        return Performance::reduceTimeResolution(endTime).milliseconds();
-    }
-
-    return monotonicTimeToDOMHighResTimeStamp(timeOrigin, resourceTiming.loadTiming().responseEnd());
-}
-
 Ref<PerformanceResourceTiming> PerformanceResourceTiming::create(MonotonicTime timeOrigin, ResourceTiming&& resourceTiming)
 {
     return adoptRef(*new PerformanceResourceTiming(timeOrigin, WTFMove(resourceTiming)));
 }
 
 PerformanceResourceTiming::PerformanceResourceTiming(MonotonicTime timeOrigin, ResourceTiming&& resourceTiming)
-    : PerformanceEntry(PerformanceEntry::Type::Resource, resourceTiming.url().string(), ASCIILiteral("resource"), entryStartTime(timeOrigin, resourceTiming), entryEndTime(timeOrigin, resourceTiming))
+    : PerformanceEntry(PerformanceEntry::Type::Resource, resourceTiming.url().string(), ASCIILiteral("resource"), monotonicTimeToDOMHighResTimeStamp(timeOrigin, resourceTiming.loadTiming().startTime()), monotonicTimeToDOMHighResTimeStamp(timeOrigin, resourceTiming.loadTiming().responseEnd()))
     , m_initiatorType(resourceTiming.initiator())
     , m_timeOrigin(timeOrigin)
     , m_loadTiming(resourceTiming.loadTiming())
-    , m_networkLoadMetrics(resourceTiming.networkLoadMetrics())
+    , m_networkLoadTiming(resourceTiming.networkLoadTiming())
     , m_shouldReportDetails(resourceTiming.allowTimingDetails())
 {
 }
@@ -88,11 +72,6 @@ PerformanceResourceTiming::~PerformanceResourceTiming()
 {
 }
 
-String PerformanceResourceTiming::nextHopProtocol() const
-{
-    return m_networkLoadMetrics.protocol;
-}
-
 double PerformanceResourceTiming::workerStart() const
 {
     return 0.0;
@@ -127,10 +106,10 @@ double PerformanceResourceTiming::domainLookupStart() const
     if (!m_shouldReportDetails)
         return 0.0;
 
-    if (m_networkLoadMetrics.domainLookupStart <= 0_ms)
+    if (m_networkLoadTiming.domainLookupStart <= 0)
         return fetchStart();
 
-    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadMetrics.domainLookupStart);
+    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadTiming.domainLookupStart);
 }
 
 double PerformanceResourceTiming::domainLookupEnd() const
@@ -138,10 +117,10 @@ double PerformanceResourceTiming::domainLookupEnd() const
     if (!m_shouldReportDetails)
         return 0.0;
 
-    if (m_networkLoadMetrics.domainLookupEnd <= 0_ms)
+    if (m_networkLoadTiming.domainLookupEnd <= 0)
         return domainLookupStart();
 
-    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadMetrics.domainLookupEnd);
+    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadTiming.domainLookupEnd);
 }
 
 double PerformanceResourceTiming::connectStart() const
@@ -149,10 +128,16 @@ double PerformanceResourceTiming::connectStart() const
     if (!m_shouldReportDetails)
         return 0.0;
 
-    if (m_networkLoadMetrics.connectStart <= 0_ms)
+    // connectStart will be -1 when a network request is not made.
+    if (m_networkLoadTiming.connectStart <= 0)
         return domainLookupEnd();
 
-    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadMetrics.connectStart);
+    // connectStart includes any DNS time, so we may need to trim that off.
+    double connectStart = m_networkLoadTiming.connectStart;
+    if (m_networkLoadTiming.domainLookupEnd >= 0)
+        connectStart = m_networkLoadTiming.domainLookupEnd;
+
+    return networkLoadTimeToDOMHighResTimeStamp(connectStart);
 }
 
 double PerformanceResourceTiming::connectEnd() const
@@ -160,10 +145,11 @@ double PerformanceResourceTiming::connectEnd() const
     if (!m_shouldReportDetails)
         return 0.0;
 
-    if (m_networkLoadMetrics.connectEnd <= 0_ms)
+    // connectStart will be -1 when a network request is not made.
+    if (m_networkLoadTiming.connectEnd <= 0)
         return connectStart();
 
-    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadMetrics.connectEnd);
+    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadTiming.connectEnd);
 }
 
 double PerformanceResourceTiming::secureConnectionStart() const
@@ -171,10 +157,10 @@ double PerformanceResourceTiming::secureConnectionStart() const
     if (!m_shouldReportDetails)
         return 0.0;
 
-    if (m_networkLoadMetrics.secureConnectionStart <= 0_ms)
+    if (m_networkLoadTiming.secureConnectionStart < 0) // Secure connection not negotiated.
         return 0.0;
 
-    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadMetrics.secureConnectionStart);
+    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadTiming.secureConnectionStart);
 }
 
 double PerformanceResourceTiming::requestStart() const
@@ -183,10 +169,10 @@ double PerformanceResourceTiming::requestStart() const
         return 0.0;
 
     // requestStart is 0 when a network request is not made.
-    if (m_networkLoadMetrics.requestStart <= 0_ms)
+    if (m_networkLoadTiming.requestStart <= 0)
         return connectEnd();
 
-    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadMetrics.requestStart);
+    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadTiming.requestStart);
 }
 
 double PerformanceResourceTiming::responseStart() const
@@ -195,43 +181,26 @@ double PerformanceResourceTiming::responseStart() const
         return 0.0;
 
     // responseStart is 0 when a network request is not made.
-    if (m_networkLoadMetrics.responseStart <= 0_ms)
+    if (m_networkLoadTiming.responseStart <= 0)
         return requestStart();
 
-    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadMetrics.responseStart);
+    return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadTiming.responseStart);
 }
 
 double PerformanceResourceTiming::responseEnd() const
 {
     // responseEnd is a required property.
-    ASSERT(m_networkLoadMetrics.isComplete() || m_loadTiming.responseEnd());
-
-    if (m_networkLoadMetrics.isComplete()) {
-        // responseEnd is 0 when a network request is not made.
-        // This should mean all other properties are empty.
-        if (m_networkLoadMetrics.responseEnd <= 0_ms) {
-            ASSERT(m_networkLoadMetrics.responseStart <= 0_ms);
-            ASSERT(m_networkLoadMetrics.requestStart <= 0_ms);
-            ASSERT(m_networkLoadMetrics.requestStart <= 0_ms);
-            ASSERT(m_networkLoadMetrics.secureConnectionStart <= 0_ms);
-            ASSERT(m_networkLoadMetrics.connectEnd <= 0_ms);
-            ASSERT(m_networkLoadMetrics.connectStart <= 0_ms);
-            ASSERT(m_networkLoadMetrics.domainLookupEnd <= 0_ms);
-            ASSERT(m_networkLoadMetrics.domainLookupStart <= 0_ms);
-            return fetchStart();
-        }
-
-        return networkLoadTimeToDOMHighResTimeStamp(m_networkLoadMetrics.responseEnd);
-    }
+    ASSERT(m_loadTiming.responseEnd());
 
     return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_loadTiming.responseEnd());
 }
 
-double PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp(Seconds delta) const
+double PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp(double deltaMilliseconds) const
 {
-    ASSERT(delta);
-    Seconds final = (m_loadTiming.fetchStart() + delta) - m_timeOrigin;
-    return Performance::reduceTimeResolution(final).milliseconds();
+    ASSERT(deltaMilliseconds);
+    MonotonicTime combined = m_loadTiming.fetchStart() + Seconds::fromMilliseconds(deltaMilliseconds);
+    Seconds delta = combined - m_timeOrigin;
+    return Performance::reduceTimeResolution(delta).milliseconds();
 }
 
 } // namespace WebCore
index c6a7e50..b11a3cd 100644 (file)
@@ -34,7 +34,7 @@
 #if ENABLE(WEB_TIMING)
 
 #include "LoadTiming.h"
-#include "NetworkLoadMetrics.h"
+#include "NetworkLoadTiming.h"
 #include "PerformanceEntry.h"
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
@@ -48,7 +48,6 @@ public:
     static Ref<PerformanceResourceTiming> create(MonotonicTime timeOrigin, ResourceTiming&&);
 
     AtomicString initiatorType() const { return m_initiatorType; }
-    String nextHopProtocol() const;
 
     double workerStart() const;
     double redirectStart() const;
@@ -67,12 +66,12 @@ private:
     PerformanceResourceTiming(MonotonicTime timeOrigin, ResourceTiming&&);
     ~PerformanceResourceTiming();
 
-    double networkLoadTimeToDOMHighResTimeStamp(Seconds) const;
+    double networkLoadTimeToDOMHighResTimeStamp(double deltaMilliseconds) const;
 
     AtomicString m_initiatorType;
     MonotonicTime m_timeOrigin;
     LoadTiming m_loadTiming;
-    NetworkLoadMetrics m_networkLoadMetrics;
+    NetworkLoadTiming m_networkLoadTiming;
     bool m_shouldReportDetails;
 };
 
index d64312d..ebf1e20 100644 (file)
@@ -38,7 +38,6 @@ typedef double DOMHighResTimeStamp;
     Exposed=(Window,Worker),
 ] interface PerformanceResourceTiming : PerformanceEntry {
     readonly attribute DOMString initiatorType;
-    readonly attribute DOMString nextHopProtocol;
 
     readonly attribute DOMHighResTimeStamp workerStart;
     readonly attribute DOMHighResTimeStamp redirectStart;
index 69efe8b..2fb5ead 100644 (file)
@@ -39,7 +39,7 @@
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "LoadTiming.h"
-#include "NetworkLoadMetrics.h"
+#include "NetworkLoadTiming.h"
 #include "Performance.h"
 #include "ResourceResponse.h"
 #include <wtf/CurrentTime.h>
@@ -123,11 +123,11 @@ unsigned long long PerformanceTiming::domainLookupStart() const
     if (!loader)
         return fetchStart();
     
-    const NetworkLoadMetrics& timing = loader->response().deprecatedNetworkLoadMetrics();
+    const NetworkLoadTiming& timing = loader->response().networkLoadTiming();
     
     // This will be -1 when a DNS request is not performed.
     // Rather than exposing a special value that indicates no DNS, we "backfill" with fetchStart.
-    if (timing.domainLookupStart < 0_ms)
+    if (timing.domainLookupStart < 0)
         return fetchStart();
 
     return resourceLoadTimeRelativeToFetchStart(timing.domainLookupStart);
@@ -139,11 +139,11 @@ unsigned long long PerformanceTiming::domainLookupEnd() const
     if (!loader)
         return domainLookupStart();
     
-    const NetworkLoadMetrics& timing = loader->response().deprecatedNetworkLoadMetrics();
+    const NetworkLoadTiming& timing = loader->response().networkLoadTiming();
     
     // This will be -1 when a DNS request is not performed.
     // Rather than exposing a special value that indicates no DNS, we "backfill" with domainLookupStart.
-    if (timing.domainLookupEnd < 0_ms)
+    if (timing.domainLookupEnd < 0)
         return domainLookupStart();
 
     return resourceLoadTimeRelativeToFetchStart(timing.domainLookupEnd);
@@ -155,17 +155,17 @@ unsigned long long PerformanceTiming::connectStart() const
     if (!loader)
         return domainLookupEnd();
 
-    const NetworkLoadMetrics& timing = loader->response().deprecatedNetworkLoadMetrics();
+    const NetworkLoadTiming& timing = loader->response().networkLoadTiming();
     
     // connectStart will be -1 when a network request is not made.
     // Rather than exposing a special value that indicates no new connection, we "backfill" with domainLookupEnd.
-    Seconds connectStart = timing.connectStart;
-    if (connectStart < 0_ms)
+    double connectStart = timing.connectStart;
+    if (connectStart < 0)
         return domainLookupEnd();
 
-    // NetworkLoadMetrics's connect phase includes DNS, however Navigation Timing's
+    // NetworkLoadTiming's connect phase includes DNS, however Navigation Timing's
     // connect phase should not. So if there is DNS time, trim it from the start.
-    if (timing.domainLookupEnd >= 0_ms && timing.domainLookupEnd > connectStart)
+    if (timing.domainLookupEnd >= 0 && timing.domainLookupEnd > connectStart)
         connectStart = timing.domainLookupEnd;
 
     return resourceLoadTimeRelativeToFetchStart(connectStart);
@@ -177,11 +177,11 @@ unsigned long long PerformanceTiming::connectEnd() const
     if (!loader)
         return connectStart();
 
-    const NetworkLoadMetrics& timing = loader->response().deprecatedNetworkLoadMetrics();
+    const NetworkLoadTiming& timing = loader->response().networkLoadTiming();
     
     // connectEnd will be -1 when a network request is not made.
     // Rather than exposing a special value that indicates no new connection, we "backfill" with connectStart.
-    if (timing.connectEnd < 0_ms)
+    if (timing.connectEnd < 0)
         return connectStart();
 
     return resourceLoadTimeRelativeToFetchStart(timing.connectEnd);
@@ -193,9 +193,9 @@ unsigned long long PerformanceTiming::secureConnectionStart() const
     if (!loader)
         return 0;
 
-    const NetworkLoadMetrics& timing = loader->response().deprecatedNetworkLoadMetrics();
+    const NetworkLoadTiming& timing = loader->response().networkLoadTiming();
     
-    if (timing.secureConnectionStart < 0_ms)
+    if (timing.secureConnectionStart < 0)
         return 0;
 
     return resourceLoadTimeRelativeToFetchStart(timing.secureConnectionStart);
@@ -207,9 +207,9 @@ unsigned long long PerformanceTiming::requestStart() const
     if (!loader)
         return connectEnd();
     
-    const NetworkLoadMetrics& timing = loader->response().deprecatedNetworkLoadMetrics();
+    const NetworkLoadTiming& timing = loader->response().networkLoadTiming();
     
-    ASSERT(timing.requestStart >= 0_ms);
+    ASSERT(timing.requestStart >= 0);
     return resourceLoadTimeRelativeToFetchStart(timing.requestStart);
 }
 
@@ -219,9 +219,9 @@ unsigned long long PerformanceTiming::responseStart() const
     if (!loader)
         return requestStart();
 
-    const NetworkLoadMetrics& timing = loader->response().deprecatedNetworkLoadMetrics();
+    const NetworkLoadTiming& timing = loader->response().networkLoadTiming();
     
-    ASSERT(timing.responseStart >= 0_ms);
+    ASSERT(timing.responseStart >= 0);
     return resourceLoadTimeRelativeToFetchStart(timing.responseStart);
 }
 
@@ -326,16 +326,16 @@ LoadTiming* PerformanceTiming::loadTiming() const
     return &loader->timing();
 }
 
-unsigned long long PerformanceTiming::resourceLoadTimeRelativeToFetchStart(Seconds delta) const
+unsigned long long PerformanceTiming::resourceLoadTimeRelativeToFetchStart(double relativeMilliseconds) const
 {
-    ASSERT(delta >= 0_ms);
+    ASSERT(relativeMilliseconds >= 0);
 
     LoadTiming* timing = loadTiming();
     if (!timing)
         return 0;
 
     WallTime fetchStart = timing->monotonicTimeToPseudoWallTime(timing->fetchStart());
-    WallTime combined = fetchStart + delta;
+    WallTime combined = fetchStart + Seconds::fromMilliseconds(relativeMilliseconds);
     Seconds reduced = Performance::reduceTimeResolution(combined.secondsSinceEpoch());
     return static_cast<unsigned long long>(reduced.milliseconds());
 }
index 679b35b..0499f7d 100644 (file)
@@ -76,7 +76,7 @@ private:
     const DocumentTiming* documentTiming() const;
     DocumentLoader* documentLoader() const;
     LoadTiming* loadTiming() const;
-    unsigned long long resourceLoadTimeRelativeToFetchStart(Seconds) const;
+    unsigned long long resourceLoadTimeRelativeToFetchStart(double) const;
     unsigned long long monotonicTimeToIntegerMilliseconds(MonotonicTime) const;
 };
 
index c3bff9a..e29bd1f 100644 (file)
@@ -103,7 +103,7 @@ class ResourceHandleStreamingClient : public ResourceHandleClient, public Stream
         void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override;
         void didReceiveData(ResourceHandle*, const char*, unsigned, int) override;
         void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedLength) override;
-        void didFinishLoading(ResourceHandle*) override;
+        void didFinishLoading(ResourceHandle*, double /*finishTime*/) override;
         void didFail(ResourceHandle*, const ResourceError&) override;
         void wasBlocked(ResourceHandle*) override;
         void cannotShowURL(ResourceHandle*) override;
@@ -1172,7 +1172,7 @@ void ResourceHandleStreamingClient::didReceiveBuffer(ResourceHandle*, Ref<Shared
     }
 }
 
-void ResourceHandleStreamingClient::didFinishLoading(ResourceHandle*)
+void ResourceHandleStreamingClient::didFinishLoading(ResourceHandle*, double)
 {
     handleNotifyFinished();
 }
index 8e574c1..e06fa65 100644 (file)
@@ -621,7 +621,7 @@ static void doNotifyFinish(BlobResourceHandle& handle)
     if (!handle.client())
         return;
 
-    handle.client()->didFinishLoading(&handle);
+    handle.client()->didFinishLoading(&handle, 0);
 }
 
 void BlobResourceHandle::notifyFinish()
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Google, Inc. All Rights Reserved.
- * Copyright (C) 2014-2017 Apple, Inc. All Rights Reserved.
+ * Copyright (C) 2014 Apple, Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #pragma once
 
-#include <wtf/Seconds.h>
-#include <wtf/text/WTFString.h>
-
 #if PLATFORM(COCOA)
 OBJC_CLASS NSDictionary;
 #endif
 
 namespace WebCore {
-
-class NetworkLoadMetrics {
+    
+class NetworkLoadTiming {
 public:
-    NetworkLoadMetrics()
+    NetworkLoadTiming()
+        : domainLookupStart(-1)
+        , domainLookupEnd(-1)
+        , connectStart(-1)
+        , connectEnd(-1)
+        , requestStart(0)
+        , responseStart(0)
+        , secureConnectionStart(-1)
     {
-        reset();
     }
 
-    NetworkLoadMetrics isolatedCopy() const
+    NetworkLoadTiming(const NetworkLoadTiming& other)
+        : domainLookupStart(other.domainLookupStart)
+        , domainLookupEnd(other.domainLookupEnd)
+        , connectStart(other.connectStart)
+        , connectEnd(other.connectEnd)
+        , requestStart(other.requestStart)
+        , responseStart(other.responseStart)
+        , secureConnectionStart(other.secureConnectionStart)
     {
-        NetworkLoadMetrics copy;
-
-        copy.domainLookupStart = domainLookupStart;
-        copy.domainLookupEnd = domainLookupEnd;
-        copy.connectStart = connectStart;
-        copy.secureConnectionStart = secureConnectionStart;
-        copy.connectEnd = connectEnd;
-        copy.requestStart = requestStart;
-        copy.responseStart = responseStart;
-        copy.responseEnd = responseEnd;
-        copy.complete = complete;
-        copy.protocol = protocol.isolatedCopy();
-
-        return copy;
     }
 
-    void reset()
+    NetworkLoadTiming& operator=(const NetworkLoadTiming& other)
     {
-        domainLookupStart = Seconds(-1);
-        domainLookupEnd = Seconds(-1);
-        connectStart = Seconds(-1);
-        secureConnectionStart = Seconds(-1);
-        connectEnd = Seconds(-1);
-        requestStart = Seconds(0);
-        responseStart = Seconds(0);
-        responseEnd = Seconds(0);
-        protocol = String();
-        complete = false;
+        domainLookupStart = other.domainLookupStart;
+        domainLookupEnd = other.domainLookupEnd;
+        connectStart = other.connectStart;
+        connectEnd = other.connectEnd;
+        requestStart = other.requestStart;
+        responseStart = other.responseStart;
+        secureConnectionStart = other.secureConnectionStart;
+        return *this;
     }
 
-    bool operator==(const NetworkLoadMetrics& other) const
+    NetworkLoadTiming isolatedCopy() const
+    {
+        // There are currently no members that need isolated copies, so we can use the copy constructor.
+        return *this;
+    }
+    
+    bool operator==(const NetworkLoadTiming& other) const
     {
         return domainLookupStart == other.domainLookupStart
             && domainLookupEnd == other.domainLookupEnd
             && connectStart == other.connectStart
-            && secureConnectionStart == other.secureConnectionStart
             && connectEnd == other.connectEnd
             && requestStart == other.requestStart
             && responseStart == other.responseStart
-            && responseEnd == other.responseEnd
-            && complete == other.complete
-            && protocol == other.protocol;
+            && secureConnectionStart == other.secureConnectionStart;
     }
 
-    bool operator!=(const NetworkLoadMetrics& other) const
+    bool operator!=(const NetworkLoadTiming& other) const
     {
         return !(*this == other);
     }
 
-    bool isComplete() const { return complete; }
-    void markComplete() { complete = true; }
-
     template<class Encoder> void encode(Encoder&) const;
-    template<class Decoder> static bool decode(Decoder&, NetworkLoadMetrics&);
-
-    // These should be treated as deltas to LoadTiming's fetchStart.
-    // They should be in ascending order as listed here.
-    Seconds domainLookupStart;     // -1 if no DNS.
-    Seconds domainLookupEnd;       // -1 if no DNS.
-    Seconds connectStart;          // -1 if reused connection.
-    Seconds secureConnectionStart; // -1 if no secure connection.
-    Seconds connectEnd;            // -1 if reused connection.
-    Seconds requestStart;
-    Seconds responseStart;
-    Seconds responseEnd;
-
-    // Whether or not all of the properties (0 or otherwise) have been set.
-    bool complete { false };
-
-    // ALPN Protocol ID: https://w3c.github.io/resource-timing/#bib-RFC7301
-    String protocol;
+    template<class Decoder> static bool decode(Decoder&, NetworkLoadTiming&);
+
+    // These are millisecond deltas from the start time.
+    double domainLookupStart;
+    double domainLookupEnd;
+    double connectStart;
+    double connectEnd;
+    double requestStart;
+    double responseStart;
+    double secureConnectionStart;
 };
 
 #if PLATFORM(COCOA)
-WEBCORE_EXPORT void copyTimingData(NSDictionary *timingData, NetworkLoadMetrics&);
+WEBCORE_EXPORT void copyTimingData(NSDictionary *timingData, NetworkLoadTiming&);
 #endif
 
 #if PLATFORM(COCOA) && !HAVE(TIMINGDATAOPTIONS)
 WEBCORE_EXPORT void setCollectsTimingData();
 #endif
-
+    
 template<class Encoder>
-void NetworkLoadMetrics::encode(Encoder& encoder) const
+void NetworkLoadTiming::encode(Encoder& encoder) const
 {
     encoder << domainLookupStart;
     encoder << domainLookupEnd;
     encoder << connectStart;
-    encoder << secureConnectionStart;
     encoder << connectEnd;
     encoder << requestStart;
     encoder << responseStart;
-    encoder << responseEnd;
-    encoder << complete;
-    encoder << protocol;
+    encoder << secureConnectionStart;
 }
 
 template<class Decoder>
-bool NetworkLoadMetrics::decode(Decoder& decoder, NetworkLoadMetrics& timing)
+bool NetworkLoadTiming::decode(Decoder& decoder, NetworkLoadTiming& timing)
 {
     return decoder.decode(timing.domainLookupStart)
         && decoder.decode(timing.domainLookupEnd)
         && decoder.decode(timing.connectStart)
-        && decoder.decode(timing.secureConnectionStart)
         && decoder.decode(timing.connectEnd)
         && decoder.decode(timing.requestStart)
         && decoder.decode(timing.responseStart)
-        && decoder.decode(timing.responseEnd)
-        && decoder.decode(timing.complete)
-        && decoder.decode(timing.protocol);
+        && decoder.decode(timing.secureConnectionStart);
 }
 
 }
index 17c54e0..cd9f2bf 100644 (file)
@@ -71,7 +71,7 @@ private:
     }
     void didReceiveResponse(ResourceHandle*, ResourceResponse&&) final { delete this; }
     void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int) final { delete this; };
-    void didFinishLoading(ResourceHandle*) final { delete this; }
+    void didFinishLoading(ResourceHandle*, double) final { delete this; }
     void didFail(ResourceHandle*, const ResourceError&) final { delete this; }
     bool shouldUseCredentialStorage(ResourceHandle*) final { return m_shouldUseCredentialStorage; }
     bool usesAsyncCallbacks() final { return m_usesAsyncCallbacks == UsesAsyncCallbacks::Yes; }
index 86e1161..e1c429a 100644 (file)
@@ -83,7 +83,7 @@ class QuickLookHandle;
 class ResourceError;
 class ResourceHandleClient;
 class ResourceHandleInternal;
-class NetworkLoadMetrics;
+class NetworkLoadTiming;
 class ResourceRequest;
 class ResourceResponse;
 class SoupNetworkSession;
@@ -132,9 +132,9 @@ public:
         
 #if PLATFORM(COCOA) && ENABLE(WEB_TIMING)
 #if USE(CFURLCONNECTION)
-    static void getConnectionTimingData(CFURLConnectionRef, NetworkLoadMetrics&);
+    static void getConnectionTimingData(CFURLConnectionRef, NetworkLoadTiming&);
 #else
-    static void getConnectionTimingData(NSURLConnection *, NetworkLoadMetrics&);
+    static void getConnectionTimingData(NSURLConnection *, NetworkLoadTiming&);
 #endif
 #endif
         
@@ -178,7 +178,7 @@ public:
     void ensureReadBuffer();
     size_t currentStreamPosition() const;
     void didStartRequest();
-    MonotonicTime m_requestTime;
+    double m_requestTime;
 #endif
 
     bool hasAuthenticationChallenge() const;
index 362c251..5c371ed 100644 (file)
@@ -71,7 +71,7 @@ namespace WebCore {
         virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) { }
         WEBCORE_EXPORT virtual void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedDataLength);
         
-        virtual void didFinishLoading(ResourceHandle*) { }
+        virtual void didFinishLoading(ResourceHandle*, double /*finishTime*/) { }
         virtual void didFail(ResourceHandle*, const ResourceError&) { }
         virtual void wasBlocked(ResourceHandle*) { }
         virtual void cannotShowURL(ResourceHandle*) { }
index 92a014c..d7e7056 100644 (file)
@@ -71,7 +71,7 @@ ResourceResponseBase::CrossThreadData ResourceResponseBase::crossThreadData() co
     data.httpVersion = httpVersion().isolatedCopy();
 
     data.httpHeaderFields = httpHeaderFields().isolatedCopy();
-    data.networkLoadMetrics = m_networkLoadMetrics.isolatedCopy();
+    data.networkLoadTiming = m_networkLoadTiming.isolatedCopy();
     data.type = m_type;
     data.isRedirected = m_isRedirected;
 
@@ -92,7 +92,7 @@ ResourceResponse ResourceResponseBase::fromCrossThreadData(CrossThreadData&& dat
     response.setHTTPVersion(data.httpVersion);
 
     response.m_httpHeaderFields = WTFMove(data.httpHeaderFields);
-    response.m_networkLoadMetrics = data.networkLoadMetrics;
+    response.m_networkLoadTiming = data.networkLoadTiming;
     response.m_type = data.type;
     response.m_isRedirected = data.isRedirected;
 
@@ -595,7 +595,7 @@ bool ResourceResponseBase::compare(const ResourceResponse& a, const ResourceResp
         return false;
     if (a.httpHeaderFields() != b.httpHeaderFields())
         return false;
-    if (a.deprecatedNetworkLoadMetrics() != b.deprecatedNetworkLoadMetrics())
+    if (a.networkLoadTiming() != b.networkLoadTiming())
         return false;
     return ResourceResponse::platformCompare(a, b);
 }
index 1effe1f..fbf125c 100644 (file)
@@ -29,7 +29,7 @@
 #include "CacheValidation.h"
 #include "CertificateInfo.h"
 #include "HTTPHeaderMap.h"
-#include "NetworkLoadMetrics.h"
+#include "NetworkLoadTiming.h"
 #include "ParsedContentRange.h"
 #include "URL.h"
 #include <wtf/SHA1.h>
@@ -58,7 +58,7 @@ public:
         String httpStatusText;
         String httpVersion;
         HTTPHeaderMap httpHeaderFields;
-        NetworkLoadMetrics networkLoadMetrics;
+        NetworkLoadTiming networkLoadTiming;
         Type type;
         bool isRedirected;
     };
@@ -140,10 +140,7 @@ public:
     const std::optional<SHA1::Digest>& cacheBodyKey() const { return m_cacheBodyKey; }
     void setCacheBodyKey(const SHA1::Digest& key) { m_cacheBodyKey = key; }
 
-    // FIXME: This should be eliminated from ResourceResponse.
-    // Network loading metrics should be delivered via didFinishLoad
-    // and should not be part of the ResourceResponse.
-    NetworkLoadMetrics& deprecatedNetworkLoadMetrics() const { return m_networkLoadMetrics; }
+    NetworkLoadTiming& networkLoadTiming() const { return m_networkLoadTiming; }
 
     // The ResourceResponse subclass may "shadow" this method to provide platform-specific memory usage information
     unsigned memoryUsage() const
@@ -195,7 +192,7 @@ protected:
     AtomicString m_httpStatusText;
     AtomicString m_httpVersion;
     HTTPHeaderMap m_httpHeaderFields;
-    mutable NetworkLoadMetrics m_networkLoadMetrics;
+    mutable NetworkLoadTiming m_networkLoadTiming;
 
     mutable std::optional<CertificateInfo> m_certificateInfo;
 
@@ -243,10 +240,10 @@ void ResourceResponseBase::encode(Encoder& encoder) const
     encoder << m_httpVersion;
     encoder << m_httpHeaderFields;
 
-    // We don't want to put the networkLoadMetrics info
+    // We don't want to put the networkLoadTiming info
     // into the disk cache, because we will never use the old info.
     if (Encoder::isIPCEncoder)
-        encoder << m_networkLoadMetrics;
+        encoder << m_networkLoadTiming;
 
     encoder << m_httpStatusCode;
     encoder << m_certificateInfo;
@@ -282,8 +279,8 @@ bool ResourceResponseBase::decode(Decoder& decoder, ResourceResponseBase& respon
         return false;
     if (!decoder.decode(response.m_httpHeaderFields))
         return false;
-    // The networkLoadMetrics info is only send over IPC and not stored in disk cache.
-    if (Decoder::isIPCDecoder && !decoder.decode(response.m_networkLoadMetrics))
+    // The networkLoadTiming info is only send over IPC and not stored in disk cache.
+    if (Decoder::isIPCDecoder && !decoder.decode(response.m_networkLoadTiming))
         return false;
     if (!decoder.decode(response.m_httpStatusCode))
         return false;
index 98c0b95..87c994b 100644 (file)
@@ -72,7 +72,7 @@ void SynchronousLoaderClient::didReceiveData(ResourceHandle*, const char* data,
     m_data.append(data, length);
 }
 
-void SynchronousLoaderClient::didFinishLoading(ResourceHandle*)
+void SynchronousLoaderClient::didFinishLoading(ResourceHandle*, double)
 {
     m_isDone = true;
 }
index cb9b309..9ca0e6a 100644 (file)
@@ -50,7 +50,7 @@ private:
     void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) override;
     void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override;
     void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) override;
-    void didFinishLoading(ResourceHandle*) override;
+    void didFinishLoading(ResourceHandle*, double /*finishTime*/) override;
     void didFail(ResourceHandle*, const ResourceError&) override;
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) override;
index 17fdc7f..f7a9b2e 100644 (file)
@@ -156,7 +156,7 @@ void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse
         
         ResourceResponse resourceResponse(cfResponse);
 #if ENABLE(WEB_TIMING)
-        ResourceHandle::getConnectionTimingData(connection, resourceResponse.deprecatedNetworkLoadMetrics());
+        ResourceHandle::getConnectionTimingData(connection, resourceResponse.networkLoadTiming());
 #else
         UNUSED_PARAM(connection);
 #endif
@@ -195,7 +195,7 @@ void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading()
 
         LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
 
-        m_handle->client()->didFinishLoading(m_handle);
+        m_handle->client()->didFinishLoading(m_handle, 0);
     });
 }
 
index bec1b19..282d283 100644 (file)
@@ -171,7 +171,7 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLC
 
     ResourceResponse resourceResponse(cfResponse);
 #if PLATFORM(COCOA) && ENABLE(WEB_TIMING)
-    ResourceHandle::getConnectionTimingData(connection, resourceResponse.deprecatedNetworkLoadMetrics());
+    ResourceHandle::getConnectionTimingData(connection, resourceResponse.networkLoadTiming());
 #else
     UNUSED_PARAM(connection);
 #endif
@@ -192,7 +192,7 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading()
     LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
 
     if (ResourceHandleClient* client = m_handle->client())
-        client->didFinishLoading(m_handle);
+        client->didFinishLoading(m_handle, 0);
 }
 
 void SynchronousResourceHandleCFURLConnectionDelegate::didFail(CFErrorRef error)
@@ -24,7 +24,7 @@
  */
 
 #import "config.h"
-#import "NetworkLoadMetrics.h"
+#import "NetworkLoadTiming.h"
 
 #import <WebCore/NSURLConnectionSPI.h>
 
@@ -37,7 +37,7 @@ static double timingValue(NSDictionary *timingData, NSString *key)
     return 0.0;
 }
     
-void copyTimingData(NSDictionary *timingData, NetworkLoadMetrics& timing)
+void copyTimingData(NSDictionary *timingData, NetworkLoadTiming& timing)
 {
     if (!timingData)
         return;
@@ -54,15 +54,13 @@ void copyTimingData(NSDictionary *timingData, NetworkLoadMetrics& timing)
     double requestStart = timingValue(timingData, @"_kCFNTimingDataRequestStart");
     double responseStart = timingValue(timingData, @"_kCFNTimingDataResponseStart");
     
-    timing.domainLookupStart = Seconds(domainLookupStart <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(domainLookupStart - referenceStart));
-    timing.domainLookupEnd = Seconds(domainLookupEnd <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(domainLookupEnd - referenceStart));
-    timing.connectStart = Seconds(connectStart <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(connectStart - referenceStart));
-    timing.secureConnectionStart = Seconds(secureConnectionStart <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(secureConnectionStart - referenceStart));
-    timing.connectEnd = Seconds(connectEnd <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(connectEnd - referenceStart));
-    timing.requestStart = Seconds(requestStart <= 0 ? Seconds(0) : Seconds::fromMilliseconds(requestStart - referenceStart));
-    timing.responseStart = Seconds(responseStart <= 0 ? Seconds(0) : Seconds::fromMilliseconds(responseStart - referenceStart));
-
-    // NOTE: responseEnd is not populated in this code path.
+    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 ? 0 : (requestStart - referenceStart) * 1000;
+    timing.responseStart = responseStart <= 0 ? 0 : (responseStart - referenceStart) * 1000;
 }
 
 #if !HAVE(TIMINGDATAOPTIONS)
index 2adb844..c254011 100644 (file)
@@ -48,7 +48,7 @@ public:
 
     virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
     virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int encodedDataLength);
-    virtual void didFinishLoading(ResourceHandle*);
+    virtual void didFinishLoading(ResourceHandle*, double /*finishTime*/);
     virtual void didFail(ResourceHandle*, const ResourceError&);
 
     ResourceResponse resourceResponse() const { return m_response; }
@@ -75,7 +75,7 @@ void WebCoreSynchronousLoader::didReceiveData(ResourceHandle*, const char* data,
     m_data.append(data, length);
 }
 
-void WebCoreSynchronousLoader::didFinishLoading(ResourceHandle*)
+void WebCoreSynchronousLoader::didFinishLoading(ResourceHandle*, double)
 {
 }
 
index 358e02a..acf6027 100644 (file)
@@ -170,8 +170,14 @@ static Lock* sharedResourceMutex(curl_lock_data data)
 }
 
 #if ENABLE(WEB_TIMING)
+static double milisecondsSinceRequest(double requestTime)
+{
+    return (monotonicallyIncreasingTime() - requestTime) * 1000.0;
+}
+
 static void calculateWebTimingInformations(ResourceHandleInternal* d)
 {
+    double startTransfertTime = 0;
     double preTransferTime = 0;
     double dnslookupTime = 0;
     double connectTime = 0;
@@ -180,19 +186,20 @@ static void calculateWebTimingInformations(ResourceHandleInternal* d)
     curl_easy_getinfo(d->m_handle, CURLINFO_NAMELOOKUP_TIME, &dnslookupTime);
     curl_easy_getinfo(d->m_handle, CURLINFO_CONNECT_TIME, &connectTime);
     curl_easy_getinfo(d->m_handle, CURLINFO_APPCONNECT_TIME, &appConnectTime);
+    curl_easy_getinfo(d->m_handle, CURLINFO_STARTTRANSFER_TIME, &startTransfertTime);
     curl_easy_getinfo(d->m_handle, CURLINFO_PRETRANSFER_TIME, &preTransferTime);
 
-    d->m_response.deprecatedNetworkLoadMetrics().domainLookupStart = Seconds(0);
-    d->m_response.deprecatedNetworkLoadMetrics().domainLookupEnd = Seconds(dnslookupTime);
+    d->m_response.networkLoadTiming().domainLookupStart = 0;
+    d->m_response.networkLoadTiming().domainLookupEnd = dnslookupTime * 1000;
 
-    d->m_response.deprecatedNetworkLoadMetrics().connectStart = Seconds(dnslookupTime);
-    d->m_response.deprecatedNetworkLoadMetrics().connectEnd = Seconds(connectTime);
+    d->m_response.networkLoadTiming().connectStart = dnslookupTime * 1000;
+    d->m_response.networkLoadTiming().connectEnd = connectTime * 1000;
 
-    d->m_response.deprecatedNetworkLoadMetrics().requestStart = Seconds(connectTime);
-    d->m_response.deprecatedNetworkLoadMetrics().responseStart = Seconds(preTransferTime);
+    d->m_response.networkLoadTiming().requestStart = connectTime * 1000;
+    d->m_response.networkLoadTiming().responseStart = preTransferTime * 1000;
 
     if (appConnectTime)
-        d->m_response.deprecatedNetworkLoadMetrics().secureConnectionStart = Seconds(connectTime);
+        d->m_response.networkLoadTiming().secureConnectionStart = connectTime * 1000;
 }
 #endif
 
@@ -670,7 +677,7 @@ void ResourceHandleManager::downloadTimerCallback()
         // find the node which has same d->m_handle as completed transfer
         CURL* handle = msg->easy_handle;
         ASSERT(handle);
-        ResourceHandle* job = nullptr;
+        ResourceHandle* job = 0;
         CURLcode err = curl_easy_getinfo(handle, CURLINFO_PRIVATE, &job);
         ASSERT_UNUSED(err, CURLE_OK == err);
         ASSERT(job);
@@ -704,7 +711,7 @@ void ResourceHandleManager::downloadTimerCallback()
                 d->m_multipartHandle->contentEnded();
 
             if (d->client()) {
-                d->client()->didFinishLoading(job);
+                d->client()->didFinishLoading(job, 0);
                 CurlCacheManager::getInstance().didFinishLoading(*job);
             }
         } else {
@@ -965,7 +972,7 @@ static void handleDataURL(ResourceHandle* handle)
     }
 
     if (handle->client())
-        handle->client()->didFinishLoading(handle);
+        handle->client()->didFinishLoading(handle, 0);
 }
 
 void ResourceHandleManager::dispatchSynchronousJob(ResourceHandle* job)
index 6a5ce43..ada8988 100644 (file)
@@ -736,14 +736,14 @@ void ResourceHandle::continueWillCacheResponse(NSCachedURLResponse *response)
 
 #if USE(CFURLCONNECTION)
     
-void ResourceHandle::getConnectionTimingData(CFURLConnectionRef connection, NetworkLoadMetrics& timing)
+void ResourceHandle::getConnectionTimingData(CFURLConnectionRef connection, NetworkLoadTiming& timing)
 {
     copyTimingData((__bridge NSDictionary*)adoptCF(_CFURLConnectionCopyTimingData(connection)).get(), timing);
 }
     
 #else
     
-void ResourceHandle::getConnectionTimingData(NSURLConnection *connection, NetworkLoadMetrics& timing)
+void ResourceHandle::getConnectionTimingData(NSURLConnection *connection, NetworkLoadTiming& timing)
 {
     copyTimingData([connection _timingData], timing);
 }
index f0ec325..fc1f4f6 100644 (file)
@@ -145,7 +145,7 @@ using namespace WebCore;
     ResourceResponse resourceResponse(response);
     resourceResponse.setSource(ResourceResponse::Source::Network);
 #if ENABLE(WEB_TIMING)
-    ResourceHandle::getConnectionTimingData(connection, resourceResponse.deprecatedNetworkLoadMetrics());
+    ResourceHandle::getConnectionTimingData(connection, resourceResponse.networkLoadTiming());
 #else
     UNUSED_PARAM(connection);
 #endif
@@ -215,7 +215,7 @@ using namespace WebCore;
     if (!m_handle || !m_handle->client())
         return;
 
-    m_handle->client()->didFinishLoading(m_handle);
+    m_handle->client()->didFinishLoading(m_handle, 0);
 }
 
 - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
index 2c93a4b..002e128 100644 (file)
@@ -195,7 +195,7 @@ using namespace WebCore;
         
         ResourceResponse resourceResponse(r);
 #if ENABLE(WEB_TIMING)
-        ResourceHandle::getConnectionTimingData(connection, resourceResponse.deprecatedNetworkLoadMetrics());
+        ResourceHandle::getConnectionTimingData(connection, resourceResponse.networkLoadTiming());
 #else
         UNUSED_PARAM(connection);
 #endif
@@ -274,7 +274,7 @@ using namespace WebCore;
         if (!m_handle || !m_handle->client())
             return;
 
-        m_handle->client()->didFinishLoading(m_handle);
+        m_handle->client()->didFinishLoading(m_handle, 0);
     });
 }
 
index e68e51c..e76fac8 100644 (file)
@@ -68,6 +68,9 @@ static bool createSoupRequestAndMessageForHandle(ResourceHandle*, const Resource
 static void cleanupSoupRequestOperation(ResourceHandle*, bool isDestroying = false);
 static void sendRequestCallback(GObject*, GAsyncResult*, gpointer);
 static void readCallback(GObject*, GAsyncResult*, gpointer);
+#if ENABLE(WEB_TIMING)
+static double milisecondsSinceRequest(double requestTime);
+#endif
 static void continueAfterDidReceiveResponse(ResourceHandle*);
 
 ResourceHandleInternal::~ResourceHandleInternal()
@@ -244,7 +247,7 @@ static void restartedCallback(SoupMessage*, gpointer data)
     if (!handle || handle->cancelledOrClientless())
         return;
 
-    handle->m_requestTime = MonotonicTime::now();
+    handle->m_requestTime = monotonicallyIncreasingTime();
 }
 #endif
 
@@ -465,7 +468,7 @@ static void nextMultipartResponsePartCallback(GObject* /*source*/, GAsyncResult*
     }
 
     if (!d->m_inputStream) {
-        handle->client()->didFinishLoading(handle.get());
+        handle->client()->didFinishLoading(handle.get(), 0);
         cleanupSoupRequestOperation(handle.get());
         return;
     }
@@ -527,7 +530,7 @@ static void sendRequestCallback(GObject*, GAsyncResult* result, gpointer data)
     }
 
 #if ENABLE(WEB_TIMING)
-    d->m_response.deprecatedNetworkLoadMetrics().responseStart = MonotonicTime::now() - handle->m_requestTime;
+    d->m_response.networkLoadTiming().responseStart = milisecondsSinceRequest(handle->m_requestTime);
 #endif
 
     if (soupMessage && d->m_response.isMultipart())
@@ -564,9 +567,14 @@ static void continueAfterDidReceiveResponse(ResourceHandle* handle)
 }
 
 #if ENABLE(WEB_TIMING)
+static double milisecondsSinceRequest(double requestTime)
+{
+    return (monotonicallyIncreasingTime() - requestTime) * 1000.0;
+}
+
 void ResourceHandle::didStartRequest()
 {
-    getInternal()->m_response.deprecatedNetworkLoadMetrics().requestStart = MonotonicTime::now() - m_requestTime;
+    getInternal()->m_response.networkLoadTiming().requestStart = milisecondsSinceRequest(m_requestTime);
 }
 
 #if SOUP_CHECK_VERSION(2, 49, 91)
@@ -586,24 +594,24 @@ static void networkEventCallback(SoupMessage*, GSocketClientEvent event, GIOStre
         return;
 
     ResourceHandleInternal* d = handle->getInternal();
-    Seconds deltaTime = MonotonicTime::now() - handle->m_requestTime;
+    double deltaTime = milisecondsSinceRequest(handle->m_requestTime);
     switch (event) {
     case G_SOCKET_CLIENT_RESOLVING:
-        d->m_response.deprecatedNetworkLoadMetrics().domainLookupStart = deltaTime;
+        d->m_response.networkLoadTiming().domainLookupStart = deltaTime;
         break;
     case G_SOCKET_CLIENT_RESOLVED:
-        d->m_response.deprecatedNetworkLoadMetrics().domainLookupEnd = deltaTime;
+        d->m_response.networkLoadTiming().domainLookupEnd = deltaTime;
         break;
     case G_SOCKET_CLIENT_CONNECTING:
-        d->m_response.deprecatedNetworkLoadMetrics().connectStart = deltaTime;
-        if (d->m_response.deprecatedNetworkLoadMetrics().domainLookupStart != Seconds(-1)) {
+        d->m_response.networkLoadTiming().connectStart = deltaTime;
+        if (d->m_response.networkLoadTiming().domainLookupStart != -1) {
             // WebCore/inspector/front-end/RequestTimingView.js assumes
             // that DNS time is included in connection time so must
             // substract here the DNS delta that will be added later (see
             // WebInspector.RequestTimingView.createTimingTable in the
             // file above for more details).
-            d->m_response.deprecatedNetworkLoadMetrics().connectStart -=
-                d->m_response.deprecatedNetworkLoadMetrics().domainLookupEnd - d->m_response.deprecatedNetworkLoadMetrics().domainLookupStart;
+            d->m_response.networkLoadTiming().connectStart -=
+                d->m_response.networkLoadTiming().domainLookupEnd - d->m_response.networkLoadTiming().domainLookupStart;
         }
         break;
     case G_SOCKET_CLIENT_CONNECTED:
@@ -615,12 +623,12 @@ static void networkEventCallback(SoupMessage*, GSocketClientEvent event, GIOStre
     case G_SOCKET_CLIENT_PROXY_NEGOTIATED:
         break;
     case G_SOCKET_CLIENT_TLS_HANDSHAKING:
-        d->m_response.deprecatedNetworkLoadMetrics().secureConnectionStart = deltaTime;
+        d->m_response.networkLoadTiming().secureConnectionStart = deltaTime;
         break;
     case G_SOCKET_CLIENT_TLS_HANDSHAKED:
         break;
     case G_SOCKET_CLIENT_COMPLETE:
-        d->m_response.deprecatedNetworkLoadMetrics().connectEnd = deltaTime;
+        d->m_response.networkLoadTiming().connectEnd = deltaTime;
         break;
     default:
         ASSERT_NOT_REACHED();
@@ -768,7 +776,7 @@ void ResourceHandle::timeoutFired()
 void ResourceHandle::sendPendingRequest()
 {
 #if ENABLE(WEB_TIMING)
-    m_requestTime = MonotonicTime::now();
+    m_requestTime = monotonicallyIncreasingTime();
 #endif
 
     if (d->m_firstRequest.timeoutInterval() > 0)
@@ -1012,7 +1020,7 @@ static void readCallback(GObject*, GAsyncResult* asyncResult, gpointer data)
 
         g_input_stream_close(d->m_inputStream.get(), 0, 0);
 
-        handle->client()->didFinishLoading(handle.get());
+        handle->client()->didFinishLoading(handle.get(), 0);
         cleanupSoupRequestOperation(handle.get());
         return;
     }
index 62c9470..b6aa267 100644 (file)
@@ -144,7 +144,7 @@ void WorkerScriptLoader::didReceiveData(const char* data, int len)
     m_script.append(m_decoder->decode(data, len));
 }
 
-void WorkerScriptLoader::didFinishLoading(unsigned long identifier)
+void WorkerScriptLoader::didFinishLoading(unsigned long identifier, double)
 {
     if (m_failed) {
         notifyError();
index c80798a..77ce0fd 100644 (file)
@@ -64,7 +64,7 @@ namespace WebCore {
 
         void didReceiveResponse(unsigned long identifier, const ResourceResponse&) override;
         void didReceiveData(const char* data, int dataLength) override;
-        void didFinishLoading(unsigned long identifier) override;
+        void didFinishLoading(unsigned long identifier, double) override;
         void didFail(const ResourceError&) override;
 
     private:
index 8222121..8ab3557 100644 (file)
@@ -1029,7 +1029,7 @@ void XMLHttpRequest::didFail(const ResourceError& error)
     networkError();
 }
 
-void XMLHttpRequest::didFinishLoading(unsigned long identifier)
+void XMLHttpRequest::didFinishLoading(unsigned long identifier, double)
 {
     if (m_error)
         return;
index dad5662..0c61fdb 100644 (file)
@@ -149,7 +149,7 @@ private:
     void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
     void didReceiveResponse(unsigned long identifier, const ResourceResponse&) override;
     void didReceiveData(const char* data, int dataLength) override;
-    void didFinishLoading(unsigned long identifier) override;
+    void didFinishLoading(unsigned long identifier, double finishTime) override;
     void didFail(const ResourceError&) override;
 
     bool responseIsXML() const;
index 6a8bafb..7192584 100644 (file)
@@ -1,3 +1,16 @@
+2017-02-24  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, rolling out r212944.
+
+        Caused a lot of failures on the debug bots
+
+        Reverted changeset:
+
+        "[Resource Timing] Gather timing information with reliable
+        responseEnd time"
+        https://bugs.webkit.org/show_bug.cgi?id=168351
+        http://trac.webkit.org/changeset/212944
+
 2017-02-24  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Unreviewed, fix the internal build
index c6ff15a..cf9acce 100644 (file)
@@ -77,7 +77,7 @@ void BlobDownloadClient::didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&& b
     m_download.didReceiveData(buffer->size());
 }
 
-void BlobDownloadClient::didFinishLoading(ResourceHandle*)
+void BlobDownloadClient::didFinishLoading(ResourceHandle*, double)
 {
     closeFile(m_destinationFile);
     m_download.didFinish();
index 4a42cc2..4a3e63e 100644 (file)
@@ -47,7 +47,7 @@ private:
     // ResourceHandleClient
     void didReceiveResponseAsync(WebCore::ResourceHandle*, WebCore::ResourceResponse&&) final;
     void didReceiveBuffer(WebCore::ResourceHandle*, Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) final;
-    void didFinishLoading(WebCore::ResourceHandle*) final;
+    void didFinishLoading(WebCore::ResourceHandle*, double finishTime) final;
     void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) final;
     bool usesAsyncCallbacks() final { return true; }
 
index 38fc2e1..208d73d 100644 (file)
@@ -64,7 +64,7 @@ private:
     void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse) override;
     ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) override { return ShouldContinueDidReceiveResponse::No; };
     void didReceiveBuffer(Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) override { };
-    void didFinishLoading(const WebCore::NetworkLoadMetrics&) override { };
+    void didFinishLoading(double finishTime) override { };
     void didFailLoading(const WebCore::ResourceError&) override;
 
     // MessageSender.
index 6cb826d..cc47307 100644 (file)
@@ -31,7 +31,6 @@
 #include "SandboxExtension.h"
 #include <WebCore/Credential.h>
 #include <WebCore/FrameLoaderTypes.h>
-#include <WebCore/NetworkLoadMetrics.h>
 #include <WebCore/ResourceHandleTypes.h>
 #include <WebCore/ResourceLoaderOptions.h>
 #include <WebCore/ResourceRequest.h>
@@ -64,17 +63,11 @@ public:
     virtual void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&) = 0;
     virtual void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler&&) = 0;
     virtual void didReceiveData(Ref<WebCore::SharedBuffer>&&) = 0;
-    virtual void didCompleteWithError(const WebCore::ResourceError&, const WebCore::NetworkLoadMetrics&) = 0;
+    virtual void didCompleteWithError(const WebCore::ResourceError&) = 0;
     virtual void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) = 0;
     virtual void wasBlocked() = 0;
     virtual void cannotShowURL() = 0;
-
-    void didCompleteWithError(const WebCore::ResourceError& error)
-    {
-        WebCore::NetworkLoadMetrics emptyMetrics;
-        didCompleteWithError(error, emptyMetrics);
-    }
-
+    
     virtual ~NetworkDataTaskClient() { }
 };
 
index 710db79..1c3e281 100644 (file)
@@ -199,8 +199,7 @@ void NetworkLoad::continueWillSendRequest(WebCore::ResourceRequest&& newRequest)
     auto redirectCompletionHandler = std::exchange(m_redirectCompletionHandler, nullptr);
     ASSERT(redirectCompletionHandler);
     if (m_currentRequest.isNull()) {
-        NetworkLoadMetrics emptyMetrics;
-        didCompleteWithError(cancelledError(m_currentRequest), emptyMetrics);
+        didCompleteWithError(cancelledError(m_currentRequest));
         if (redirectCompletionHandler)
             redirectCompletionHandler({ });
         return;
@@ -409,7 +408,7 @@ void NetworkLoad::didReceiveData(Ref<SharedBuffer>&& buffer)
     m_client.get().didReceiveBuffer(WTFMove(buffer), size);
 }
 
-void NetworkLoad::didCompleteWithError(const ResourceError& error, const WebCore::NetworkLoadMetrics& networkLoadMetrics)
+void NetworkLoad::didCompleteWithError(const ResourceError& error)
 {
     ASSERT(!m_throttle);
 
@@ -419,7 +418,7 @@ void NetworkLoad::didCompleteWithError(const ResourceError& error, const WebCore
 #endif
 
     if (error.isNull())
-        m_client.get().didFinishLoading(networkLoadMetrics);
+        m_client.get().didFinishLoading(WTF::monotonicallyIncreasingTime());
     else
         m_client.get().didFailLoading(error);
 }
@@ -470,11 +469,10 @@ void NetworkLoad::didReceiveBuffer(ResourceHandle* handle, Ref<SharedBuffer>&& b
     m_client.get().didReceiveBuffer(WTFMove(buffer), reportedEncodedDataLength);
 }
 
-void NetworkLoad::didFinishLoading(ResourceHandle* handle)
+void NetworkLoad::didFinishLoading(ResourceHandle* handle, double finishTime)
 {
     ASSERT_UNUSED(handle, handle == m_handle);
-    NetworkLoadMetrics emptyMetrics;
-    m_client.get().didFinishLoading(emptyMetrics);
+    m_client.get().didFinishLoading(finishTime);
 }
 
 void NetworkLoad::didFail(ResourceHandle* handle, const ResourceError& error)
index ef72522..b252a0c 100644 (file)
@@ -118,7 +118,7 @@ private:
     void didReceiveResponseAsync(WebCore::ResourceHandle*, WebCore::ResourceResponse&&) final;
     void didReceiveData(WebCore::ResourceHandle*, const char*, unsigned, int encodedDataLength) final;
     void didReceiveBuffer(WebCore::ResourceHandle*, Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) final;
-    void didFinishLoading(WebCore::ResourceHandle*) final;
+    void didFinishLoading(WebCore::ResourceHandle*, double finishTime) final;
     void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) final;
     void wasBlocked(WebCore::ResourceHandle*) final;
     void cannotShowURL(WebCore::ResourceHandle*) final;
@@ -133,7 +133,7 @@ private:
     void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&) final;
     void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler&&) final;
     void didReceiveData(Ref<WebCore::SharedBuffer>&&) final;
-    void didCompleteWithError(const WebCore::ResourceError&, const WebCore::NetworkLoadMetrics&) final;
+    void didCompleteWithError(const WebCore::ResourceError&) final;
     void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) final;
     void wasBlocked() final;
     void cannotShowURL() final;
index e589e3a..87a52d2 100644 (file)
@@ -35,7 +35,6 @@ typedef const struct _CFCachedURLResponse* CFCachedURLResponseRef;
 #endif
 
 namespace WebCore {
-class NetworkLoadMetrics;
 class ProtectionSpace;
 class SharedBuffer;
 }
@@ -56,7 +55,7 @@ public:
     enum class ShouldContinueDidReceiveResponse { No, Yes };
     virtual ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) = 0;
     virtual void didReceiveBuffer(Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) = 0;
-    virtual void didFinishLoading(const WebCore::NetworkLoadMetrics&) = 0;
+    virtual void didFinishLoading(double finishTime) = 0;
     virtual void didFailLoading(const WebCore::ResourceError&) = 0;
 };
 
index 241aac3..bab56b3 100644 (file)
@@ -42,7 +42,6 @@
 #include <WebCore/CertificateInfo.h>
 #include <WebCore/DiagnosticLoggingKeys.h>
 #include <WebCore/HTTPHeaderNames.h>
-#include <WebCore/NetworkLoadMetrics.h>
 #include <WebCore/ProtectionSpace.h>
 #include <WebCore/SharedBuffer.h>
 #include <WebCore/SynchronousLoaderClient.h>
@@ -391,7 +390,7 @@ void NetworkResourceLoader::didReceiveBuffer(Ref<SharedBuffer>&& buffer, int rep
     sendBuffer(buffer, encodedDataLength);
 }
 
-void NetworkResourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMetrics)
+void NetworkResourceLoader::didFinishLoading(double finishTime)
 {
     RELEASE_LOG_IF_ALLOWED("didFinishLoading: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_parameters.webPageID, m_parameters.webFrameID, m_parameters.identifier);
 
@@ -412,7 +411,7 @@ void NetworkResourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLo
             // FIXME: Pass a real value or remove the encoded data size feature.
             sendBuffer(*m_bufferedData, -1);
         }
-        send(Messages::WebResourceLoader::DidFinishResourceLoad(networkLoadMetrics));
+        send(Messages::WebResourceLoader::DidFinishResourceLoad(finishTime));
     }
 
 #if ENABLE(NETWORK_CACHE)
@@ -607,16 +606,13 @@ void NetworkResourceLoader::sendResultForCacheEntry(std::unique_ptr<NetworkCache
 {
 #if ENABLE(SHAREABLE_RESOURCE)
     if (!entry->shareableResourceHandle().isNull()) {
-        send(Messages::WebResourceLoader::DidReceiveResource(entry->shareableResourceHandle()));
+        send(Messages::WebResourceLoader::DidReceiveResource(entry->shareableResourceHandle(), currentTime()));
         return;
     }
 #endif
 
-    WebCore::NetworkLoadMetrics networkLoadMetrics;
-    networkLoadMetrics.markComplete();
-
     sendBuffer(*entry->buffer(), entry->buffer()->size());
-    send(Messages::WebResourceLoader::DidFinishResourceLoad(networkLoadMetrics));
+    send(Messages::WebResourceLoader::DidFinishResourceLoad(currentTime()));
 }
 
 void NetworkResourceLoader::validateCacheEntry(std::unique_ptr<NetworkCache::Entry> entry)
index e46cd91..fe93ee0 100644 (file)
@@ -94,7 +94,7 @@ public:
     void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&&) override;
     ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) override;
     void didReceiveBuffer(Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) override;
-    void didFinishLoading(const WebCore::NetworkLoadMetrics&) override;
+    void didFinishLoading(double finishTime) override;
     void didFailLoading(const WebCore::ResourceError&) override;
 
     void convertToDownload(DownloadID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
index f0144d6..300c308 100644 (file)
@@ -65,7 +65,7 @@ private:
         delete this;
     }
     void didReceiveData(Ref<WebCore::SharedBuffer>&&) final { ASSERT_NOT_REACHED(); }
-    void didCompleteWithError(const WebCore::ResourceError&, const WebCore::NetworkLoadMetrics&) final { delete this; }
+    void didCompleteWithError(const WebCore::ResourceError&) final { delete this; }
     void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend) final { }
     void wasBlocked() final { delete this; }
     void cannotShowURL() final { delete this; }
index dc060e7..c90f58f 100644 (file)
@@ -116,7 +116,7 @@ void SpeculativeLoad::didReceiveBuffer(Ref<SharedBuffer>&& buffer, int reportedE
     }
 }
 
-void SpeculativeLoad::didFinishLoading(const WebCore::NetworkLoadMetrics&)
+void SpeculativeLoad::didFinishLoading(double finishTime)
 {
     if (m_didComplete)
         return;
index a3fe906..3bc2d2e 100644 (file)
@@ -61,7 +61,7 @@ private:
     void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse) override;
     ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) override;
     void didReceiveBuffer(Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) override;
-    void didFinishLoading(const WebCore::NetworkLoadMetrics&) override;
+    void didFinishLoading(double finishTime) override;
     void didFailLoading(const WebCore::ResourceError&) override;
 
     void didComplete();
index ceb5963..cc63727 100644 (file)
@@ -28,7 +28,6 @@
 #if USE(NETWORK_SESSION)
 
 #include "NetworkDataTask.h"
-#include <WebCore/NetworkLoadMetrics.h>
 #include <wtf/RetainPtr.h>
 
 OBJC_CLASS NSURLSessionDataTask;
@@ -51,7 +50,7 @@ public:
 
     void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend);
     void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&);
-    void didCompleteWithError(const WebCore::ResourceError&, const WebCore::NetworkLoadMetrics&);
+    void didCompleteWithError(const WebCore::ResourceError&);
     void didReceiveData(Ref<WebCore::SharedBuffer>&&);
 
     void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&&);
@@ -68,8 +67,6 @@ public:
 
     bool allowsSpecificHTTPSCertificateForHost(const WebCore::AuthenticationChallenge&) override;
 
-    WebCore::NetworkLoadMetrics& networkLoadMetrics() { return m_networkLoadMetrics; }
-
 private:
     NetworkDataTaskCocoa(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ContentSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect);
 
@@ -77,7 +74,6 @@ private:
 
     RefPtr<SandboxExtension> m_sandboxExtension;
     RetainPtr<NSURLSessionDataTask> m_task;
-    WebCore::NetworkLoadMetrics m_networkLoadMetrics;
 };
 
 WebCore::Credential serverTrustCredential(const WebCore::AuthenticationChallenge&);
index d447ea2..2f0471b 100644 (file)
@@ -150,10 +150,10 @@ void NetworkDataTaskCocoa::didReceiveChallenge(const WebCore::AuthenticationChal
     }
 }
 
-void NetworkDataTaskCocoa::didCompleteWithError(const WebCore::ResourceError& error, const WebCore::NetworkLoadMetrics& networkLoadMetrics)
+void NetworkDataTaskCocoa::didCompleteWithError(const WebCore::ResourceError& error)
 {
     if (m_client)
-        m_client->didCompleteWithError(error, networkLoadMetrics);
+        m_client->didCompleteWithError(error);
 }
 
 void NetworkDataTaskCocoa::didReceiveData(Ref<WebCore::SharedBuffer>&& data)
index dfeaf03..c6b2dd8 100644 (file)
@@ -34,7 +34,6 @@ OBJC_CLASS WKNetworkSessionDelegate;
 #include "DownloadID.h"
 #include "NetworkDataTaskCocoa.h"
 #include "NetworkSession.h"
-#include <WebCore/NetworkLoadMetrics.h>
 #include <wtf/HashMap.h>
 
 namespace WebKit {
index 9d7680d..fdf1ec0 100644 (file)
@@ -41,6 +41,7 @@
 #import <WebCore/CFNetworkSPI.h>
 #import <WebCore/Credential.h>
 #import <WebCore/FrameLoaderTypes.h>
+#import <WebCore/NetworkLoadTiming.h>
 #import <WebCore/NetworkStorageSession.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/ResourceError.h>
@@ -241,7 +242,7 @@ static NSURLSessionAuthChallengeDisposition toNSURLSessionAuthChallengeDispositi
     LOG(NetworkSession, "%llu didCompleteWithError %@", task.taskIdentifier, error);
     auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
     if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials))
-        networkDataTask->didCompleteWithError(error, networkDataTask->networkLoadMetrics());
+        networkDataTask->didCompleteWithError(error);
     else if (error) {
         auto downloadID = _session->takeDownloadID(task.taskIdentifier);
         if (downloadID.downloadID()) {
@@ -261,39 +262,6 @@ static NSURLSessionAuthChallengeDisposition toNSURLSessionAuthChallengeDispositi
     }
 }
 
-- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics
-{
-    if (!_session)
-        return;
-
-    LOG(NetworkSession, "%llu didFinishCollectingMetrics", task.taskIdentifier);
-    auto storedCredentials = _withCredentials ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
-    if (auto* networkDataTask = _session->dataTaskForIdentifier(task.taskIdentifier, storedCredentials)) {
-        NSURLSessionTaskTransactionMetrics *m = metrics.transactionMetrics.lastObject;
-        NSDate *fetchStartDate = m.fetchStartDate;
-        NSTimeInterval domainLookupStartInterval = m.domainLookupStartDate ? [m.domainLookupStartDate timeIntervalSinceDate:fetchStartDate] : -1;
-        NSTimeInterval domainLookupEndInterval = m.domainLookupEndDate ? [m.domainLookupEndDate timeIntervalSinceDate:fetchStartDate] : -1;
-        NSTimeInterval connectStartInterval = m.connectStartDate ? [m.connectStartDate timeIntervalSinceDate:fetchStartDate] : -1;
-        NSTimeInterval secureConnectionStartInterval = m.secureConnectionStartDate ? [m.secureConnectionStartDate timeIntervalSinceDate:fetchStartDate] : -1;
-        NSTimeInterval connectEndInterval = m.connectEndDate ? [m.connectEndDate timeIntervalSinceDate:fetchStartDate] : -1;
-        NSTimeInterval requestStartInterval = [m.requestStartDate timeIntervalSinceDate:fetchStartDate];
-        NSTimeInterval responseStartInterval = [m.responseStartDate timeIntervalSinceDate:fetchStartDate];
-        NSTimeInterval responseEndInterval = [m.responseEndDate timeIntervalSinceDate:fetchStartDate];
-
-        auto& networkLoadMetrics = networkDataTask->networkLoadMetrics();
-        networkLoadMetrics.domainLookupStart = Seconds(domainLookupStartInterval);
-        networkLoadMetrics.domainLookupEnd = Seconds(domainLookupEndInterval);
-        networkLoadMetrics.connectStart = Seconds(connectStartInterval);
-        networkLoadMetrics.secureConnectionStart = Seconds(secureConnectionStartInterval);
-        networkLoadMetrics.connectEnd = Seconds(connectEndInterval);
-        networkLoadMetrics.requestStart = Seconds(requestStartInterval);
-        networkLoadMetrics.responseStart = Seconds(responseStartInterval);
-        networkLoadMetrics.responseEnd = Seconds(responseEndInterval);
-        networkLoadMetrics.markComplete();
-        networkLoadMetrics.protocol = String(m.networkProtocolName);
-    }
-}
-
 - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler
 {
     if (!_session) {
@@ -319,10 +287,7 @@ static NSURLSessionAuthChallengeDisposition toNSURLSessionAuthChallengeDispositi
         // all the fields when sending the response to the WebContent process over IPC.
         resourceResponse.disableLazyInitialization();
 
-        // FIXME: This cannot be eliminated until other code no longer relies on ResourceResponse's
-        // NetworkLoadMetrics. For example, PerformanceTiming.
-        copyTimingData([dataTask _timingData], resourceResponse.deprecatedNetworkLoadMetrics());
-
+        copyTimingData([dataTask _timingData], resourceResponse.networkLoadTiming());
         auto completionHandlerCopy = Block_copy(completionHandler);
         networkDataTask->didReceiveResponse(WTFMove(resourceResponse), [completionHandlerCopy, taskIdentifier](WebCore::PolicyAction policyAction) {
             LOG(NetworkSession, "%llu didReceiveResponse completionHandler (%d)", taskIdentifier, policyAction);
index 41d926e..9d61be2 100644 (file)
@@ -60,7 +60,7 @@ NetworkDataTaskSoup::NetworkDataTaskSoup(NetworkSession& session, NetworkDataTas
     auto request = requestWithCredentials;
     if (request.url().protocolIsInHTTPFamily()) {
 #if ENABLE(WEB_TIMING)
-        m_startTime = MonotonicTime::now();
+        m_startTime = monotonicallyIncreasingTimeMS();
 #endif
         auto url = request.url();
         if (m_storedCredentials == AllowStoredCredentials) {
@@ -283,7 +283,7 @@ void NetworkDataTaskSoup::timeoutFired()
 
     RefPtr<NetworkDataTaskSoup> protectedThis(this);
     invalidateAndCancel();
-    dispatchDidCompleteWithError(ResourceError::timeoutError(m_firstRequest.url()));
+    m_client->didCompleteWithError(ResourceError::timeoutError(m_firstRequest.url()));
 }
 
 void NetworkDataTaskSoup::startTimeout()
@@ -341,7 +341,7 @@ void NetworkDataTaskSoup::didSendRequest(GRefPtr<GInputStream>&& inputStream)
             m_inputStream = WTFMove(inputStream);
 
 #if ENABLE(WEB_TIMING)
-        m_networkLoadMetrics.responseStart = MonotonicTime::now() - m_startTime;
+        m_response.networkLoadTiming().responseStart = monotonicallyIncreasingTimeMS() - m_startTime;
 #endif
     } else {
         m_response.setURL(m_firstRequest.url());
@@ -362,19 +362,6 @@ void NetworkDataTaskSoup::dispatchDidReceiveResponse()
 {
     ASSERT(!m_response.isNull());
 
-#if ENABLE(WEB_TIMING)
-    // FIXME: Remove this once nobody depends on deprecatedNetworkLoadMetrics.
-    NetworkLoadMetrics& deprecatedResponseMetrics = m_response.deprecatedNetworkLoadMetrics();
-    deprecatedResponseMetrics.responseStart = m_networkLoadMetrics.responseStart;
-    deprecatedResponseMetrics.domainLookupStart = m_networkLoadMetrics.domainLookupStart;
-    deprecatedResponseMetrics.domainLookupEnd = m_networkLoadMetrics.domainLookupEnd;
-    deprecatedResponseMetrics.connectStart = m_networkLoadMetrics.connectStart;
-    deprecatedResponseMetrics.secureConnectionStart = m_networkLoadMetrics.secureConnectionStart;
-    deprecatedResponseMetrics.connectEnd = m_networkLoadMetrics.connectEnd;
-    deprecatedResponseMetrics.requestStart = m_networkLoadMetrics.requestStart;
-    deprecatedResponseMetrics.responseStart = m_networkLoadMetrics.responseStart;
-#endif
-
     didReceiveResponse(ResourceResponse(m_response), [this, protectedThis = makeRef(*this)](PolicyAction policyAction) {
         if (m_state == State::Canceling || m_state == State::Completed) {
             clearRequest();
@@ -401,16 +388,6 @@ void NetworkDataTaskSoup::dispatchDidReceiveResponse()
     });
 }
 
-void NetworkDataTaskSoup::dispatchDidCompleteWithError(const ResourceError& error)
-{
-#if ENABLE(WEB_TIMING)
-    m_networkLoadMetrics.responseEnd = MonotonicTime::now() - m_startTime;
-    m_networkLoadMetrics.markComplete();
-#endif
-
-    m_client->didCompleteWithError(error, m_networkLoadMetrics);
-}
-
 void NetworkDataTaskSoup::tlsErrorsChangedCallback(SoupMessage* soupMessage, GParamSpec*, NetworkDataTaskSoup* task)
 {
     if (task->state() == State::Canceling || task->state() == State::Completed || !task->m_client) {
@@ -431,7 +408,7 @@ void NetworkDataTaskSoup::tlsErrorsChanged()
 
         RefPtr<NetworkDataTaskSoup> protectedThis(this);
         invalidateAndCancel();
-        dispatchDidCompleteWithError(error);
+        m_client->didCompleteWithError(error);
     });
 }
 
@@ -683,10 +660,8 @@ void NetworkDataTaskSoup::continueHTTPRedirection()
         auto request = newRequest;
         if (request.url().protocolIsInHTTPFamily()) {
 #if ENABLE(WEB_TIMING)
-            if (isCrossOrigin) {
-                m_startTime = MonotonicTime::now();
-                m_networkLoadMetrics.reset();
-            }
+            if (isCrossOrigin)
+                m_startTime = monotonicallyIncreasingTimeMS();
 #endif
             applyAuthenticationToRequest(request);
         }
@@ -762,7 +737,7 @@ void NetworkDataTaskSoup::didFinishRead()
 
     clearRequest();
     ASSERT(m_client);
-    dispatchDidCompleteWithError({ });
+    m_client->didCompleteWithError({ });
 }
 
 void NetworkDataTaskSoup::requestNextPartCallback(SoupMultipartInputStream* multipartInputStream, GAsyncResult* result, NetworkDataTaskSoup* task)
@@ -815,7 +790,7 @@ void NetworkDataTaskSoup::didFinishRequestNextPart()
     ASSERT(m_multipartInputStream);
     g_input_stream_close(G_INPUT_STREAM(m_multipartInputStream.get()), nullptr, nullptr);
     clearRequest();
-    dispatchDidCompleteWithError({ });
+    m_client->didCompleteWithError({ });
 }
 
 void NetworkDataTaskSoup::gotHeadersCallback(SoupMessage* soupMessage, NetworkDataTaskSoup* task)
@@ -999,7 +974,7 @@ void NetworkDataTaskSoup::didFailDownload(const ResourceError& error)
     clearRequest();
     cleanDownloadFiles();
     if (m_client)
-        dispatchDidCompleteWithError(error);
+        m_client->didCompleteWithError(error);
     else {
         auto* download = NetworkProcess::singleton().downloadManager().download(m_pendingDownloadID);
         ASSERT(download);
@@ -1028,7 +1003,7 @@ void NetworkDataTaskSoup::didFail(const ResourceError& error)
 
     clearRequest();
     ASSERT(m_client);
-    dispatchDidCompleteWithError(error);
+    m_client->didCompleteWithError(error);
 }
 
 #if ENABLE(WEB_TIMING)
@@ -1043,16 +1018,17 @@ void NetworkDataTaskSoup::networkEventCallback(SoupMessage* soupMessage, GSocket
 
 void NetworkDataTaskSoup::networkEvent(GSocketClientEvent event)
 {
-    Seconds deltaTime = MonotonicTime::now() - m_startTime;
+    double deltaTime = monotonicallyIncreasingTimeMS() - m_startTime;
+    auto& loadTiming = m_response.networkLoadTiming();
     switch (event) {
     case G_SOCKET_CLIENT_RESOLVING:
-        m_networkLoadMetrics.domainLookupStart = deltaTime;
+        loadTiming.domainLookupStart = deltaTime;
         break;
     case G_SOCKET_CLIENT_RESOLVED:
-        m_networkLoadMetrics.domainLookupEnd = deltaTime;
+        loadTiming.domainLookupEnd = deltaTime;
         break;
     case G_SOCKET_CLIENT_CONNECTING:
-        m_networkLoadMetrics.connectStart = deltaTime;
+        loadTiming.connectStart = deltaTime;
         break;
     case G_SOCKET_CLIENT_CONNECTED:
         // Web Timing considers that connection time involves dns, proxy & TLS negotiation...
@@ -1063,12 +1039,12 @@ void NetworkDataTaskSoup::networkEvent(GSocketClientEvent event)
     case G_SOCKET_CLIENT_PROXY_NEGOTIATED:
         break;
     case G_SOCKET_CLIENT_TLS_HANDSHAKING:
-        m_networkLoadMetrics.secureConnectionStart = deltaTime;
+        loadTiming.secureConnectionStart = deltaTime;
         break;
     case G_SOCKET_CLIENT_TLS_HANDSHAKED:
         break;
     case G_SOCKET_CLIENT_COMPLETE:
-        m_networkLoadMetrics.connectEnd = deltaTime;
+        loadTiming.connectEnd = deltaTime;
         break;
     default:
         ASSERT_NOT_REACHED();
@@ -1101,7 +1077,7 @@ void NetworkDataTaskSoup::requestStartedCallback(SoupSession* session, SoupMessa
 
 void NetworkDataTaskSoup::didStartRequest()
 {
-    m_networkLoadMetrics.requestStart = MonotonicTime::now() - m_startTime;
+    m_response.networkLoadTiming().requestStart = monotonicallyIncreasingTimeMS() - m_startTime;
 }
 
 void NetworkDataTaskSoup::restartedCallback(SoupMessage* soupMessage, NetworkDataTaskSoup* task)
@@ -1117,8 +1093,7 @@ void NetworkDataTaskSoup::restartedCallback(SoupMessage* soupMessage, NetworkDat
 
 void NetworkDataTaskSoup::didRestart()
 {
-    m_startTime = MonotonicTime::now();
-    m_networkLoadMetrics.reset();
+    m_startTime = monotonicallyIncreasingTimeMS();
 }
 #endif // ENABLE(WEB_TIMING)
 
index 71bd735..9a15532 100644 (file)
@@ -26,7 +26,6 @@
 #pragma once
 
 #include "NetworkDataTask.h"
-#include <WebCore/NetworkLoadMetrics.h>
 #include <WebCore/ProtectionSpace.h>
 #include <WebCore/ResourceResponse.h>
 #include <wtf/RunLoop.h>
@@ -64,7 +63,6 @@ private:
     static void sendRequestCallback(SoupRequest*, GAsyncResult*, NetworkDataTaskSoup*);
     void didSendRequest(GRefPtr<GInputStream>&&);
     void dispatchDidReceiveResponse();
-    void dispatchDidCompleteWithError(const WebCore::ResourceError&);
 
     static void tlsErrorsChangedCallback(SoupMessage*, GParamSpec*, NetworkDataTaskSoup*);
     void tlsErrorsChanged();
@@ -138,8 +136,7 @@ private:
     GRefPtr<GOutputStream> m_downloadOutputStream;
     bool m_allowOverwriteDownload { false };
 #if ENABLE(WEB_TIMING)
-    WebCore::NetworkLoadMetrics m_networkLoadMetrics;
-    MonotonicTime m_startTime;
+    double m_startTime { 0 };
 #endif
     RunLoop::Timer<NetworkDataTaskSoup> m_timeoutSource;
 };
index 55019d5..ec2e1f5 100644 (file)
@@ -143,16 +143,12 @@ void WebResourceLoader::didRetrieveDerivedData(const String& type, const IPC::Da
     m_coreLoader->didRetrieveDerivedDataFromCache(type, buffer.get());
 }
 
-void WebResourceLoader::didFinishResourceLoad(const NetworkLoadMetrics& networkLoadMetrics)
+void WebResourceLoader::didFinishResourceLoad(double finishTime)
 {
     LOG(Network, "(WebProcess) WebResourceLoader::didFinishResourceLoad for '%s'", m_coreLoader->url().string().latin1().data());
     RELEASE_LOG_IF_ALLOWED("didFinishResourceLoad: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_trackingParameters.pageID, m_trackingParameters.frameID, m_trackingParameters.resourceID);
 
-#if USE(NETWORK_SESSION)
-    ASSERT(networkLoadMetrics.isComplete());
-#endif
-
-    m_coreLoader->didFinishLoading(networkLoadMetrics);
+    m_coreLoader->didFinishLoading(finishTime);
 }
 
 void WebResourceLoader::didFailResourceLoad(const ResourceError& error)
@@ -166,7 +162,7 @@ void WebResourceLoader::didFailResourceLoad(const ResourceError& error)
 }
 
 #if ENABLE(SHAREABLE_RESOURCE)
-void WebResourceLoader::didReceiveResource(const ShareableResource::Handle& handle)
+void WebResourceLoader::didReceiveResource(const ShareableResource::Handle& handle, double finishTime)
 {
     LOG(Network, "(WebProcess) WebResourceLoader::didReceiveResource for '%s'", m_coreLoader->url().string().latin1().data());
     RELEASE_LOG_IF_ALLOWED("didReceiveResource: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_trackingParameters.pageID, m_trackingParameters.frameID, m_trackingParameters.resourceID);
@@ -193,8 +189,7 @@ void WebResourceLoader::didReceiveResource(const ShareableResource::Handle& hand
     if (!m_coreLoader)
         return;
 
-    NetworkLoadMetrics emptyMetrics;
-    m_coreLoader->didFinishLoading(emptyMetrics);
+    m_coreLoader->didFinishLoading(finishTime);
 }
 #endif
 
index b54d2fa..9e391b5 100644 (file)
@@ -23,7 +23,8 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#pragma once
+#ifndef WebResourceLoader_h
+#define WebResourceLoader_h
 
 #include "Connection.h"
 #include "MessageSender.h"
@@ -36,7 +37,6 @@ class DataReference;
 }
 
 namespace WebCore {
-class NetworkLoadMetrics;
 class ResourceError;
 class ResourceLoader;
 class ResourceRequest;
@@ -79,10 +79,10 @@ private:
     void didReceiveResponse(const WebCore::ResourceResponse&, bool needsContinueDidReceiveResponseMessage);
     void didReceiveData(const IPC::DataReference&, int64_t encodedDataLength);
     void didRetrieveDerivedData(const String& type, const IPC::DataReference&);
-    void didFinishResourceLoad(const WebCore::NetworkLoadMetrics&);
+    void didFinishResourceLoad(double finishTime);
     void didFailResourceLoad(const WebCore::ResourceError&);
 #if ENABLE(SHAREABLE_RESOURCE)
-    void didReceiveResource(const ShareableResource::Handle&);
+    void didReceiveResource(const ShareableResource::Handle&, double finishTime);
 #endif
 
     RefPtr<WebCore::ResourceLoader> m_coreLoader;
@@ -91,3 +91,5 @@ private:
 };
 
 } // namespace WebKit
+
+#endif // WebResourceLoader_h
index 335e3b2..842e0a4 100644 (file)
@@ -25,12 +25,12 @@ messages -> WebResourceLoader LegacyReceiver {
     DidSendData(uint64_t bytesSent, uint64_t totalBytesToBeSent)
     DidReceiveResponse(WebCore::ResourceResponse response, bool needsContinueDidReceiveResponseMessage)
     DidReceiveData(IPC::DataReference data, int64_t encodedDataLength)
-    DidFinishResourceLoad(WebCore::NetworkLoadMetrics networkLoadMetrics)
+    DidFinishResourceLoad(double finishTime)
     DidRetrieveDerivedData(String type, IPC::DataReference data)
     DidFailResourceLoad(WebCore::ResourceError error)
 
 #if ENABLE(SHAREABLE_RESOURCE)
     // DidReceiveResource is for when we have the entire resource data available at once, such as when the resource is cached in memory
-    DidReceiveResource(WebKit::ShareableResource::Handle resource)
+    DidReceiveResource(WebKit::ShareableResource::Handle resource, double finishTime)
 #endif
 }