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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(LocalFrame* frame) { |
313 if (!RuntimeEnabledFeatures::performanceNavigationTiming2Enabled()) | 313 if (!RuntimeEnabledFeatures::performanceNavigationTiming2Enabled()) |
314 return; | 314 return; |
315 DCHECK(frame); | 315 DCHECK(frame); |
316 const DocumentLoader* documentLoader = frame->loader().documentLoader(); | 316 const DocumentLoader* documentLoader = frame->loader().documentLoader(); |
317 DCHECK(documentLoader); | 317 DCHECK(documentLoader); |
| 318 |
318 const DocumentLoadTiming& documentLoadTiming = documentLoader->timing(); | 319 const DocumentLoadTiming& documentLoadTiming = documentLoader->timing(); |
319 | 320 |
320 const DocumentTiming* documentTiming = | 321 const DocumentTiming* documentTiming = |
321 frame->document() ? &(frame->document()->timing()) : nullptr; | 322 frame->document() ? &(frame->document()->timing()) : nullptr; |
322 | 323 |
323 const ResourceResponse& finalResponse = documentLoader->response(); | 324 const ResourceResponse& finalResponse = documentLoader->response(); |
| 325 ResourceTimingInfo* resourceTimingInfo = |
| 326 documentLoader->getMainResourceTimingInfo(); |
324 | 327 |
325 ResourceLoadTiming* resourceLoadTiming = finalResponse.resourceLoadTiming(); | 328 ResourceLoadTiming* resourceLoadTiming = finalResponse.resourceLoadTiming(); |
326 // Don't create a navigation timing instance when | 329 // Don't create a navigation timing instance when |
327 // resourceLoadTiming is null, which could happen when visiting non-http sites | 330 // resourceLoadTiming is null, which could happen when visiting non-http sites |
328 // such as about:blank or in some error cases. | 331 // such as about:blank or in some error cases. |
329 if (!resourceLoadTiming) | 332 if (!resourceLoadTiming) |
330 return; | 333 return; |
331 double lastRedirectEndTime = documentLoadTiming.redirectEnd(); | 334 double lastRedirectEndTime = documentLoadTiming.redirectEnd(); |
332 double finishTime = documentLoadTiming.loadEventEnd(); | 335 double finishTime = documentLoadTiming.loadEventEnd(); |
333 | 336 |
334 // TODO(sunjian) Implement transfer size. crbug/663187 | 337 unsigned long long transferSize = |
335 unsigned long long transferSize = 0; | 338 resourceTimingInfo ? resourceTimingInfo->transferSize() : 0; |
336 unsigned long long encodedBodyLength = finalResponse.encodedBodyLength(); | 339 unsigned long long encodedBodyLength = finalResponse.encodedBodyLength(); |
337 unsigned long long decodedBodyLength = finalResponse.decodedBodyLength(); | 340 unsigned long long decodedBodyLength = finalResponse.decodedBodyLength(); |
338 bool didReuseConnection = finalResponse.connectionReused(); | 341 bool didReuseConnection = finalResponse.connectionReused(); |
339 | 342 |
340 m_navigationTiming = new PerformanceNavigationTiming( | 343 m_navigationTiming = new PerformanceNavigationTiming( |
341 timeOrigin(), documentLoadTiming.unloadEventStart(), | 344 timeOrigin(), documentLoadTiming.unloadEventStart(), |
342 documentLoadTiming.unloadEventEnd(), documentLoadTiming.loadEventStart(), | 345 documentLoadTiming.unloadEventEnd(), documentLoadTiming.loadEventStart(), |
343 documentLoadTiming.loadEventEnd(), documentLoadTiming.redirectCount(), | 346 documentLoadTiming.loadEventEnd(), documentLoadTiming.redirectCount(), |
344 documentTiming ? documentTiming->domInteractive() : 0, | 347 documentTiming ? documentTiming->domInteractive() : 0, |
345 documentTiming ? documentTiming->domContentLoadedEventStart() : 0, | 348 documentTiming ? documentTiming->domContentLoadedEventStart() : 0, |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 visitor->trace(m_resourceTimingBuffer); | 532 visitor->trace(m_resourceTimingBuffer); |
530 visitor->trace(m_navigationTiming); | 533 visitor->trace(m_navigationTiming); |
531 visitor->trace(m_userTiming); | 534 visitor->trace(m_userTiming); |
532 visitor->trace(m_observers); | 535 visitor->trace(m_observers); |
533 visitor->trace(m_activeObservers); | 536 visitor->trace(m_activeObservers); |
534 visitor->trace(m_suspendedObservers); | 537 visitor->trace(m_suspendedObservers); |
535 EventTargetWithInlineData::trace(visitor); | 538 EventTargetWithInlineData::trace(visitor); |
536 } | 539 } |
537 | 540 |
538 } // namespace blink | 541 } // namespace blink |
OLD | NEW |