Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1027)

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2799093004: Enable ServerTiming support
Patch Set: updates for Patch Set 7 Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index aad2404223ad5a4d6ec402328f81e4ac9c6f6034..8fa5497be37db5040d99ebd02a99aaab240961d4 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -64,6 +64,7 @@
#include "core/svg/graphics/SVGImageChromeClient.h"
#include "core/timing/DOMWindowPerformance.h"
#include "core/timing/Performance.h"
+#include "core/timing/PerformanceBase.h"
#include "platform/WebFrameScheduler.h"
#include "platform/exported/WrappedResourceRequest.h"
#include "platform/instrumentation/tracing/TracedValue.h"
@@ -510,6 +511,18 @@ void FrameFetchContext::DispatchDidReceiveResponse(
// It is essential that inspector gets resource response BEFORE console.
GetFrame()->Console().ReportResourceResponseReceived(document_loader,
identifier, response);
+
+ // MainResource responses were already added, skip them here.
+ if (RuntimeEnabledFeatures::serverTimingEnabled() &&
+ resource->GetType() != Resource::kMainResource &&
+ GetFrame()->GetDocument() && GetFrame()->GetDocument()->domWindow()) {
+ LocalDOMWindow* localDOMWindow = GetFrame()->GetDocument()->domWindow();
+ DOMWindowPerformance::performance(*localDOMWindow)
+ ->AddServerTiming(response,
+ localDOMWindow->HasLoadEventFired()
+ ? PerformanceBase::ShouldAddToBuffer::Never
+ : PerformanceBase::ShouldAddToBuffer::Always);
+ }
}
void FrameFetchContext::DispatchDidReceiveData(unsigned long identifier,
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.cpp ('k') | third_party/WebKit/Source/core/timing/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698