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

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

Issue 2799093004: Enable ServerTiming support
Patch Set: update code formatting and comments 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..b3fa8c81abaf013db1cb908ebc882c54a142888c 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,18 @@ void FrameFetchContext::dispatchDidReceiveResponse(
// It is essential that inspector gets resource response BEFORE console.
frame()->console().reportResourceResponseReceived(documentLoader, identifier,
response);
+
+ // MainResource responses were already added, skip them here.
+ if (RuntimeEnabledFeatures::serverTimingEnabled() &&
+ resource->getType() != Resource::MainResource && 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