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

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

Issue 2761113002: Move getNavigationType logic from PerformanceBase to PerformanceNavigationTiming. (Closed)
Patch Set: sync to HEAD Created 3 years, 9 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/PerformanceNavigationTiming.cpp
diff --git a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp
index 43f9de0702627401f04a8bb513f600152682cfa3..1716fa1c894cc196bfc3d2b5ae6db4c29271a806 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp
@@ -85,6 +85,28 @@ unsigned long long PerformanceNavigationTiming::getDecodedBodySize() const {
return m_resourceTimingInfo->finalResponse().decodedBodyLength();
}
+AtomicString PerformanceNavigationTiming::getNavigationType(
+ NavigationType type,
+ const Document* document) {
+ if (document &&
+ document->pageVisibilityState() == PageVisibilityStatePrerender) {
+ return "prerender";
+ }
+ switch (type) {
+ case NavigationTypeReload:
+ return "reload";
+ case NavigationTypeBackForward:
+ return "back_forward";
+ case NavigationTypeLinkClicked:
+ case NavigationTypeFormSubmitted:
+ case NavigationTypeFormResubmitted:
+ case NavigationTypeOther:
+ return "navigate";
+ }
+ NOTREACHED();
+ return "navigate";
+}
+
AtomicString PerformanceNavigationTiming::initiatorType() const {
return "navigation";
}
@@ -177,21 +199,8 @@ DOMHighResTimeStamp PerformanceNavigationTiming::loadEventEnd() const {
AtomicString PerformanceNavigationTiming::type() const {
DocumentLoader* loader = documentLoader();
- if (!loader)
- return "navigate";
- Document* document = frame() ? frame()->document(): nullptr;
- switch (PerformanceBase::getNavigationType(loader->getNavigationType(),
- document)) {
- case NavigationType::Prerender:
- return "prerender";
- case NavigationType::Reload:
- return "reload";
- case NavigationType::BackForward:
- return "back_forward";
- case NavigationType::Navigate:
- return "navigate";
- }
- NOTREACHED();
+ if (frame() && loader)
+ return getNavigationType(loader->getNavigationType(), frame()->document());
return "navigate";
}

Powered by Google App Engine
This is Rietveld 408576698