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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 break; | 151 break; |
152 case PerformanceEntry::Mark: | 152 case PerformanceEntry::Mark: |
153 if (m_userTiming) | 153 if (m_userTiming) |
154 entries.appendVector(m_userTiming->getMarks()); | 154 entries.appendVector(m_userTiming->getMarks()); |
155 break; | 155 break; |
156 case PerformanceEntry::Measure: | 156 case PerformanceEntry::Measure: |
157 if (m_userTiming) | 157 if (m_userTiming) |
158 entries.appendVector(m_userTiming->getMeasures()); | 158 entries.appendVector(m_userTiming->getMeasures()); |
159 break; | 159 break; |
160 // Unsupported for LongTask, TaskAttribution. | 160 // Unsupported for Paint, LongTask, TaskAttribution. |
161 // Per the spec, these entries can only be accessed via | 161 // Per the spec, these entries can only be accessed via |
162 // Performance Observer. No separate buffer is maintained. | 162 // Performance Observer. No separate buffer is maintained. |
| 163 case PerformanceEntry::Paint: |
| 164 break; |
163 case PerformanceEntry::LongTask: | 165 case PerformanceEntry::LongTask: |
164 break; | 166 break; |
165 case PerformanceEntry::TaskAttribution: | 167 case PerformanceEntry::TaskAttribution: |
166 break; | 168 break; |
167 case PerformanceEntry::Invalid: | 169 case PerformanceEntry::Invalid: |
168 break; | 170 break; |
169 } | 171 } |
170 | 172 |
171 std::sort(entries.begin(), entries.end(), | 173 std::sort(entries.begin(), entries.end(), |
172 PerformanceEntry::startTimeCompareLessThan); | 174 PerformanceEntry::startTimeCompareLessThan); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 documentTiming ? documentTiming->domComplete() : 0, type, | 398 documentTiming ? documentTiming->domComplete() : 0, type, |
397 documentLoadTiming.redirectStart(), documentLoadTiming.redirectEnd(), | 399 documentLoadTiming.redirectStart(), documentLoadTiming.redirectEnd(), |
398 documentLoadTiming.fetchStart(), documentLoadTiming.responseEnd(), | 400 documentLoadTiming.fetchStart(), documentLoadTiming.responseEnd(), |
399 allowRedirectDetails, | 401 allowRedirectDetails, |
400 documentLoadTiming.hasSameOriginAsPreviousDocument(), resourceLoadTiming, | 402 documentLoadTiming.hasSameOriginAsPreviousDocument(), resourceLoadTiming, |
401 lastRedirectEndTime, finishTime, transferSize, encodedBodyLength, | 403 lastRedirectEndTime, finishTime, transferSize, encodedBodyLength, |
402 decodedBodyLength, didReuseConnection); | 404 decodedBodyLength, didReuseConnection); |
403 notifyObserversOfEntry(*m_navigationTiming); | 405 notifyObserversOfEntry(*m_navigationTiming); |
404 } | 406 } |
405 | 407 |
| 408 void PerformanceBase::addFirstPaintTiming(double startTime) { |
| 409 addPaintTiming(PerformancePaintTiming::PaintType::FirstPaint, startTime); |
| 410 } |
| 411 |
| 412 void PerformanceBase::addFirstContentfulPaintTiming(double startTime) { |
| 413 addPaintTiming(PerformancePaintTiming::PaintType::FirstContentfulPaint, |
| 414 startTime); |
| 415 } |
| 416 |
| 417 void PerformanceBase::addPaintTiming(PerformancePaintTiming::PaintType type, |
| 418 double startTime) { |
| 419 if (!RuntimeEnabledFeatures::performancePaintTimingEnabled()) |
| 420 return; |
| 421 PerformanceEntry* entry = new PerformancePaintTiming( |
| 422 type, monotonicTimeToDOMHighResTimeStamp(startTime)); |
| 423 notifyObserversOfEntry(*entry); |
| 424 } |
| 425 |
406 void PerformanceBase::addResourceTimingBuffer(PerformanceEntry& entry) { | 426 void PerformanceBase::addResourceTimingBuffer(PerformanceEntry& entry) { |
407 m_resourceTimingBuffer.append(&entry); | 427 m_resourceTimingBuffer.append(&entry); |
408 | 428 |
409 if (isResourceTimingBufferFull()) { | 429 if (isResourceTimingBufferFull()) { |
410 dispatchEvent(Event::create(EventTypeNames::resourcetimingbufferfull)); | 430 dispatchEvent(Event::create(EventTypeNames::resourcetimingbufferfull)); |
411 dispatchEvent( | 431 dispatchEvent( |
412 Event::create(EventTypeNames::webkitresourcetimingbufferfull)); | 432 Event::create(EventTypeNames::webkitresourcetimingbufferfull)); |
413 } | 433 } |
414 } | 434 } |
415 | 435 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 visitor->trace(m_resourceTimingBuffer); | 595 visitor->trace(m_resourceTimingBuffer); |
576 visitor->trace(m_navigationTiming); | 596 visitor->trace(m_navigationTiming); |
577 visitor->trace(m_userTiming); | 597 visitor->trace(m_userTiming); |
578 visitor->trace(m_observers); | 598 visitor->trace(m_observers); |
579 visitor->trace(m_activeObservers); | 599 visitor->trace(m_activeObservers); |
580 visitor->trace(m_suspendedObservers); | 600 visitor->trace(m_suspendedObservers); |
581 EventTargetWithInlineData::trace(visitor); | 601 EventTargetWithInlineData::trace(visitor); |
582 } | 602 } |
583 | 603 |
584 } // namespace blink | 604 } // namespace blink |
OLD | NEW |