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

Unified Diff: third_party/WebKit/Source/core/timing/Performance.cpp

Issue 2647643004: Report nav timing 2 instance as soon as it's requested. (Closed)
Patch Set: sync Created 3 years, 10 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/timing/Performance.cpp
diff --git a/third_party/WebKit/Source/core/timing/Performance.cpp b/third_party/WebKit/Source/core/timing/Performance.cpp
index 20e24d20693b5bd6a4eb7f10a0cc1b28e6d5309b..16c5de7eabbc00feb223ffed1d8f8181bf9b6d9a 100644
--- a/third_party/WebKit/Source/core/timing/Performance.cpp
+++ b/third_party/WebKit/Source/core/timing/Performance.cpp
@@ -43,6 +43,7 @@
#include "core/loader/DocumentLoader.h"
#include "core/origin_trials/OriginTrials.h"
#include "core/timing/PerformanceTiming.h"
+#include "platform/network/ResourceTimingInfo.h"
static const double kLongTaskThreshold = 0.05;
@@ -140,6 +141,18 @@ PerformanceTiming* Performance::timing() const {
return m_timing.get();
}
+PerformanceNavigationTiming* Performance::createNavigationTimingInstance() {
+ ResourceTimingInfo* resourceTimingInfo = nullptr;
+ if (frame()) {
Kunihiko Sakamoto 2017/02/15 06:35:30 If frame() is null, can we return nullptr here? Cu
sunjian 2017/02/15 20:30:28 Agree with returning nullptr directly when frame()
panicker 2017/02/16 00:37:23 Which dchecks are being referred to here specifica
Kunihiko Sakamoto 2017/02/16 08:42:29 Ah I overlooked that m_frame is a weak pointer. S
sunjian 2017/02/16 22:30:49 Acknowledged.
+ const DocumentLoader* documentLoader = frame()->loader().documentLoader();
+ DCHECK(documentLoader);
+ resourceTimingInfo = documentLoader->getNavigationTimingInfo();
+ }
+
+ return new PerformanceNavigationTiming(frame(), resourceTimingInfo,
+ timeOrigin());
+}
+
void Performance::updateLongTaskInstrumentation() {
DCHECK(frame());
if (!frame()->document())
« no previous file with comments | « third_party/WebKit/Source/core/timing/Performance.h ('k') | third_party/WebKit/Source/core/timing/PerformanceBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698