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

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

Issue 2839683003: Server-Timing (Closed)
Patch Set: make those robots happy, attempt #4 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 084840313156c8d0af5d142d4ad3dc055b8c58c4..478c68b83aaf5c7b9e95cac12d92357156851ae4 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -65,6 +65,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"
@@ -370,6 +371,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,

Powered by Google App Engine
This is Rietveld 408576698