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

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

Issue 2799093004: Enable ServerTiming support
Patch Set: 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 c1289356bf8018e79a48e839c5387a14de0a2e52..e147911b64f37c0e6561e55ff975ee6978f999ee 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"
@@ -536,6 +537,20 @@ void FrameFetchContext::dispatchDidReceiveResponse(
// It is essential that inspector gets resource response BEFORE console.
frame()->console().reportResourceResponseReceived(documentLoader, identifier,
response);
+
+ if (RuntimeEnabledFeatures::serverTimingEnabled() &&
+ resource->getType() != Resource::MainResource && // MainResource
+ // responses were
+ // already added, skip
+ // them here
Yoav Weiss 2017/04/06 20:19:55 Nit: Maybe move the comment above the condition? F
+ frame()->document() && frame()->document()->domWindow()) {
+ LocalDOMWindow* localDOMWindow = frame()->document()->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