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 6b4549c0f17b88f333c8f331616bcea357620c66..de9f18e5b9a3fa4d6ac677793d8cc3bd494430a2 100644 |
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
@@ -51,6 +51,25 @@ |
namespace blink { |
+namespace { |
Yoav Weiss
2016/11/22 10:46:32
Is there a reason you picked an extra namespace ra
panicker
2016/11/22 18:31:28
you mean a global static here? I believe anonymous
sunjian
2016/11/22 22:04:42
Acknowledged.
|
+ |
+PerformanceNavigationTiming::PerformanceNavigationType getNavigationType(NavigationType type, |
+ Document* document) { |
+ if (document && |
+ document->pageVisibilityState() == PageVisibilityStatePrerender) { |
+ return PerformanceNavigationTiming::KTypePrerender; |
+ } |
+ switch (type) { |
Yoav Weiss
2016/11/22 10:46:32
What's the reason for translating enums from Navig
panicker
2016/11/22 18:31:28
These are both defined in separate specs for NT1 a
sunjian
2016/11/22 22:04:42
Agree. So i could have added prerender type at a l
panicker
2016/11/22 22:20:50
I may have misunderstood, Yoav I think you were re
|
+ case NavigationTypeReload: |
+ return PerformanceNavigationTiming::KTypeReload; |
+ case NavigationTypeBackForward: |
+ return PerformanceNavigationTiming::KTypeBackForward; |
+ default: |
kinuko
2016/11/22 03:05:22
Prefer not using default but listing up actual enu
sunjian
2016/11/22 22:04:42
Done.
|
+ return PerformanceNavigationTiming::KTypeNavigate; |
+ } |
+} |
+} |
kinuko
2016/11/22 03:05:22
nit: } // namespace
sunjian
2016/11/22 22:04:42
Done.
|
+ |
using PerformanceObserverVector = HeapVector<Member<PerformanceObserver>>; |
static const size_t defaultResourceTimingBufferSize = 150; |
@@ -336,6 +355,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(), |
@@ -344,10 +365,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, |