[Resource Timing] Gather timing information with reliable responseEnd time
[WebKit-https.git] / Source / WebCore / loader / ResourceLoader.cpp
index 0fbb0c3..d65f3bf 100644 (file)
@@ -181,7 +181,8 @@ void ResourceLoader::deliverResponseAndData(const ResourceResponse& response, Re
             return;
     }
 
-    didFinishLoading(0);
+    NetworkLoadMetrics emptyMetrics;
+    didFinishLoading(emptyMetrics);
 }
 
 void ResourceLoader::start()
@@ -271,8 +272,10 @@ void ResourceLoader::loadDataURL()
         if (!protectedThis->reachedTerminalState() && dataSize)
             protectedThis->didReceiveBuffer(result.data.releaseNonNull(), dataSize, DataPayloadWholeResource);
 
-        if (!protectedThis->reachedTerminalState())
-            protectedThis->didFinishLoading(currentTime());
+        if (!protectedThis->reachedTerminalState()) {
+            NetworkLoadMetrics emptyMetrics;
+            protectedThis->didFinishLoading(emptyMetrics);
+        }
     });
 }
 
@@ -488,9 +491,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(double finishTime)
+void ResourceLoader::didFinishLoading(const NetworkLoadMetrics& networkLoadMetrics)
 {
-    didFinishLoadingOnePart(finishTime);
+    didFinishLoadingOnePart(networkLoadMetrics);
 
     // 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.
@@ -499,7 +502,7 @@ void ResourceLoader::didFinishLoading(double finishTime)
     releaseResources();
 }
 
-void ResourceLoader::didFinishLoadingOnePart(double finishTime)
+void ResourceLoader::didFinishLoadingOnePart(const NetworkLoadMetrics& networkLoadMetrics)
 {
     // If load has been cancelled after finishing (which could happen with a
     // JavaScript that changes the window location), do nothing.
@@ -511,7 +514,7 @@ void ResourceLoader::didFinishLoadingOnePart(double finishTime)
         return;
     m_notifiedLoadComplete = true;
     if (m_options.sendLoadCallbacks == SendCallbacks)
-        frameLoader()->notifier().didFinishLoad(this, finishTime);
+        frameLoader()->notifier().didFinishLoad(this, networkLoadMetrics);
 }
 
 void ResourceLoader::didFail(const ResourceError& error)
@@ -645,9 +648,10 @@ void ResourceLoader::didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&& buffe
     didReceiveBuffer(WTFMove(buffer), encodedDataLength, DataPayloadBytes);
 }
 
-void ResourceLoader::didFinishLoading(ResourceHandle*, double finishTime)
+void ResourceLoader::didFinishLoading(ResourceHandle*)
 {
-    didFinishLoading(finishTime);
+    NetworkLoadMetrics emptyMetrics;
+    didFinishLoading(emptyMetrics);
 }
 
 void ResourceLoader::didFail(ResourceHandle*, const ResourceError& error)