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 39a7e3029048b737b9dd46be61be55e16c9c23ef..fdf6d454012e2353ad6299b342697162202dac5b 100644 |
| --- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
| +++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp |
| @@ -336,12 +336,21 @@ void PerformanceBase::addNavigationTiming(LocalFrame* frame) { |
| DCHECK(frame); |
| const DocumentLoader* documentLoader = frame->loader().documentLoader(); |
| DCHECK(documentLoader); |
| + |
| const DocumentLoadTiming& documentLoadTiming = documentLoader->timing(); |
| const DocumentTiming* documentTiming = |
| frame->document() ? &(frame->document()->timing()) : nullptr; |
| const ResourceResponse& finalResponse = documentLoader->response(); |
| + ResourceTimingInfo* resourceTimingInfo = |
| + documentLoader->getMainResourceTimingInfo(); |
|
Nate Chapin
2016/12/06 20:07:50
Should the main resource timing info always be the
sunjian
2016/12/07 19:09:50
We need this accessor to access non-iframe main re
|
| + // Don't create navigation timing instance when resourceTimingInfo |
| + // is null, which could happen when it is an iframe navigation restored |
| + // from history, since its location may have been changed after initial |
| + // navigation. |
| + if (!resourceTimingInfo) |
| + return; |
| ResourceLoadTiming* resourceLoadTiming = finalResponse.resourceLoadTiming(); |
| // Don't create a navigation timing instance when |
| @@ -352,8 +361,7 @@ void PerformanceBase::addNavigationTiming(LocalFrame* frame) { |
| double lastRedirectEndTime = documentLoadTiming.redirectEnd(); |
| double finishTime = documentLoadTiming.loadEventEnd(); |
| - // TODO(sunjian) Implement transfer size. crbug/663187 |
| - unsigned long long transferSize = 0; |
| + unsigned long long transferSize = resourceTimingInfo->transferSize(); |
| unsigned long long encodedBodyLength = finalResponse.encodedBodyLength(); |
| unsigned long long decodedBodyLength = finalResponse.decodedBodyLength(); |
| bool didReuseConnection = finalResponse.connectionReused(); |