Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 double lastRedirectEndTime = lastRedirectTiming->receiveHeadersEnd(); | 302 double lastRedirectEndTime = lastRedirectTiming->receiveHeadersEnd(); |
| 303 | 303 |
| 304 PerformanceEntry* entry = PerformanceResourceTiming::create( | 304 PerformanceEntry* entry = PerformanceResourceTiming::create( |
| 305 info, timeOrigin(), startTime, lastRedirectEndTime, allowTimingDetails, | 305 info, timeOrigin(), startTime, lastRedirectEndTime, allowTimingDetails, |
| 306 allowRedirectDetails); | 306 allowRedirectDetails); |
| 307 notifyObserversOfEntry(*entry); | 307 notifyObserversOfEntry(*entry); |
| 308 if (!isResourceTimingBufferFull()) | 308 if (!isResourceTimingBufferFull()) |
| 309 addResourceTimingBuffer(*entry); | 309 addResourceTimingBuffer(*entry); |
| 310 } | 310 } |
| 311 | 311 |
| 312 void PerformanceBase::addNavigationTiming(LocalFrame* frame) { | 312 void PerformanceBase::addNavigationTiming( |
| 313 LocalFrame* frame, | |
| 314 ResourceTimingInfo* resourceTimingInfo) { | |
| 313 if (!RuntimeEnabledFeatures::performanceNavigationTiming2Enabled()) | 315 if (!RuntimeEnabledFeatures::performanceNavigationTiming2Enabled()) |
| 314 return; | 316 return; |
| 315 DCHECK(frame); | 317 DCHECK(frame); |
| 316 const DocumentLoader* documentLoader = frame->loader().documentLoader(); | 318 const DocumentLoader* documentLoader = frame->loader().documentLoader(); |
| 317 DCHECK(documentLoader); | 319 DCHECK(documentLoader); |
| 320 | |
| 318 const DocumentLoadTiming& documentLoadTiming = documentLoader->timing(); | 321 const DocumentLoadTiming& documentLoadTiming = documentLoader->timing(); |
| 319 | 322 |
| 320 const DocumentTiming* documentTiming = | 323 const DocumentTiming* documentTiming = |
| 321 frame->document() ? &(frame->document()->timing()) : nullptr; | 324 frame->document() ? &(frame->document()->timing()) : nullptr; |
| 322 | 325 |
| 323 const ResourceResponse& finalResponse = documentLoader->response(); | 326 const ResourceResponse& finalResponse = documentLoader->response(); |
| 324 | 327 |
| 325 ResourceLoadTiming* resourceLoadTiming = finalResponse.resourceLoadTiming(); | 328 ResourceLoadTiming* resourceLoadTiming = finalResponse.resourceLoadTiming(); |
| 326 // Don't create a navigation timing instance when visiting non-http sites | 329 // Don't create a navigation timing instance when visiting non-http sites |
| 327 // such as about:blank | 330 // such as about:blank |
| 328 if (!resourceLoadTiming) | 331 if (!resourceLoadTiming) |
| 329 return; | 332 return; |
| 330 double lastRedirectEndTime = documentLoadTiming.redirectEnd(); | 333 double lastRedirectEndTime = documentLoadTiming.redirectEnd(); |
| 331 double finishTime = documentLoadTiming.loadEventEnd(); | 334 double finishTime = documentLoadTiming.loadEventEnd(); |
| 332 | 335 |
| 333 // TODO(sunjian) Implement transfer size. crbug/663187 | 336 // TODO(sunjian) Implement transfer size. crbug/663187 |
|
Yoav Weiss
2016/11/18 10:06:30
You can remove the TODO
sunjian
2016/11/18 20:23:29
Done.
| |
| 334 unsigned long long transferSize = 0; | 337 unsigned long long transferSize = |
| 338 resourceTimingInfo ? resourceTimingInfo->transferSize() : 0; | |
| 335 unsigned long long encodedBodyLength = finalResponse.encodedBodyLength(); | 339 unsigned long long encodedBodyLength = finalResponse.encodedBodyLength(); |
| 336 unsigned long long decodedBodyLength = finalResponse.decodedBodyLength(); | 340 unsigned long long decodedBodyLength = finalResponse.decodedBodyLength(); |
| 337 bool didReuseConnection = finalResponse.connectionReused(); | 341 bool didReuseConnection = finalResponse.connectionReused(); |
| 338 | 342 |
| 339 m_navigationTiming = new PerformanceNavigationTiming( | 343 m_navigationTiming = new PerformanceNavigationTiming( |
| 340 timeOrigin(), documentLoadTiming.unloadEventStart(), | 344 timeOrigin(), documentLoadTiming.unloadEventStart(), |
| 341 documentLoadTiming.unloadEventEnd(), documentLoadTiming.loadEventStart(), | 345 documentLoadTiming.unloadEventEnd(), documentLoadTiming.loadEventStart(), |
| 342 documentLoadTiming.loadEventEnd(), documentLoadTiming.redirectCount(), | 346 documentLoadTiming.loadEventEnd(), documentLoadTiming.redirectCount(), |
| 343 documentTiming ? documentTiming->domInteractive() : 0, | 347 documentTiming ? documentTiming->domInteractive() : 0, |
| 344 documentTiming ? documentTiming->domContentLoadedEventStart() : 0, | 348 documentTiming ? documentTiming->domContentLoadedEventStart() : 0, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 visitor->trace(m_resourceTimingBuffer); | 532 visitor->trace(m_resourceTimingBuffer); |
| 529 visitor->trace(m_navigationTiming); | 533 visitor->trace(m_navigationTiming); |
| 530 visitor->trace(m_userTiming); | 534 visitor->trace(m_userTiming); |
| 531 visitor->trace(m_observers); | 535 visitor->trace(m_observers); |
| 532 visitor->trace(m_activeObservers); | 536 visitor->trace(m_activeObservers); |
| 533 visitor->trace(m_suspendedObservers); | 537 visitor->trace(m_suspendedObservers); |
| 534 EventTargetWithInlineData::trace(visitor); | 538 EventTargetWithInlineData::trace(visitor); |
| 535 } | 539 } |
| 536 | 540 |
| 537 } // namespace blink | 541 } // namespace blink |
| OLD | NEW |