Chromium Code Reviews| 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, |