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

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

Issue 2509143002: Add Prerender type to NavigationType for nav timing 2 (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/timing/PerformanceBase.cpp
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
index d9bd2f9e556066685350bd0a5888ab3be0c74bca..58bd4526a8ec2bc0d26e7c4c51e1598ecb9ebafe 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -51,6 +51,24 @@
namespace blink {
+namespace {
panicker 2016/11/18 21:01:05 nit: add blank line
sunjian 2016/11/18 21:17:58 Done.
+PerformanceNavigationTiming::PerformanceNavigationType getNavigationType(NavigationType type,
+ Document* document) {
+ if (document &&
+ document->pageVisibilityState() == PageVisibilityStatePrerender) {
+ return PerformanceNavigationTiming::KTypePrerender;
+ }
+ switch (type) {
+ case NavigationTypeReload:
+ return PerformanceNavigationTiming::KTypeReload;
+ case NavigationTypeBackForward:
+ return PerformanceNavigationTiming::KTypeBackForward;
+ default:
+ return PerformanceNavigationTiming::KTypeNavigate;
+ }
+}
+}
+
using PerformanceObserverVector = HeapVector<Member<PerformanceObserver>>;
static const size_t defaultResourceTimingBufferSize = 150;
@@ -335,6 +353,8 @@ void PerformanceBase::addNavigationTiming(LocalFrame* frame) {
unsigned long long encodedBodyLength = finalResponse.encodedBodyLength();
unsigned long long decodedBodyLength = finalResponse.decodedBodyLength();
bool didReuseConnection = finalResponse.connectionReused();
+ PerformanceNavigationTiming::PerformanceNavigationType type =
+ getNavigationType(documentLoader->getNavigationType(), frame->document());
m_navigationTiming = new PerformanceNavigationTiming(
timeOrigin(), documentLoadTiming.unloadEventStart(),
@@ -343,10 +363,9 @@ void PerformanceBase::addNavigationTiming(LocalFrame* frame) {
documentTiming ? documentTiming->domInteractive() : 0,
documentTiming ? documentTiming->domContentLoadedEventStart() : 0,
documentTiming ? documentTiming->domContentLoadedEventEnd() : 0,
- documentTiming ? documentTiming->domComplete() : 0,
- documentLoader->getNavigationType(), documentLoadTiming.redirectStart(),
- documentLoadTiming.redirectEnd(), documentLoadTiming.fetchStart(),
- documentLoadTiming.responseEnd(),
+ documentTiming ? documentTiming->domComplete() : 0, type,
+ documentLoadTiming.redirectStart(), documentLoadTiming.redirectEnd(),
+ documentLoadTiming.fetchStart(), documentLoadTiming.responseEnd(),
documentLoadTiming.hasCrossOriginRedirect(),
documentLoadTiming.hasSameOriginAsPreviousDocument(), resourceLoadTiming,
lastRedirectEndTime, finishTime, transferSize, encodedBodyLength,
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698