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 16 matching lines...) Expand all Loading... | |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #include "core/timing/PerformanceBase.h" | 32 #include "core/timing/PerformanceBase.h" |
33 | 33 |
34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
35 #include "core/events/Event.h" | 35 #include "core/events/Event.h" |
36 #include "core/frame/UseCounter.h" | 36 #include "core/frame/UseCounter.h" |
37 #include "core/timing/PerformanceCompositeTiming.h" | |
38 #include "core/timing/PerformanceLongTaskTiming.h" | 37 #include "core/timing/PerformanceLongTaskTiming.h" |
39 #include "core/timing/PerformanceObserver.h" | 38 #include "core/timing/PerformanceObserver.h" |
40 #include "core/timing/PerformanceRenderTiming.h" | |
41 #include "core/timing/PerformanceResourceTiming.h" | 39 #include "core/timing/PerformanceResourceTiming.h" |
42 #include "core/timing/PerformanceUserTiming.h" | 40 #include "core/timing/PerformanceUserTiming.h" |
43 #include "platform/network/ResourceTimingInfo.h" | 41 #include "platform/network/ResourceTimingInfo.h" |
44 #include "platform/weborigin/SecurityOrigin.h" | 42 #include "platform/weborigin/SecurityOrigin.h" |
45 #include "wtf/CurrentTime.h" | 43 #include "wtf/CurrentTime.h" |
46 #include <algorithm> | 44 #include <algorithm> |
47 | 45 |
48 namespace blink { | 46 namespace blink { |
49 | 47 |
50 using PerformanceObserverVector = HeapVector<Member<PerformanceObserver>>; | 48 using PerformanceObserverVector = HeapVector<Member<PerformanceObserver>>; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 dispatchEvent(Event::create(EventTypeNames::resourcetimingbufferfull)); | 299 dispatchEvent(Event::create(EventTypeNames::resourcetimingbufferfull)); |
302 dispatchEvent( | 300 dispatchEvent( |
303 Event::create(EventTypeNames::webkitresourcetimingbufferfull)); | 301 Event::create(EventTypeNames::webkitresourcetimingbufferfull)); |
304 } | 302 } |
305 } | 303 } |
306 | 304 |
307 bool PerformanceBase::isResourceTimingBufferFull() { | 305 bool PerformanceBase::isResourceTimingBufferFull() { |
308 return m_resourceTimingBuffer.size() >= m_resourceTimingBufferSize; | 306 return m_resourceTimingBuffer.size() >= m_resourceTimingBufferSize; |
309 } | 307 } |
310 | 308 |
311 void PerformanceBase::addRenderTiming(Document* initiatorDocument, | 309 void PerformanceBase::addRenderTiming(Document* initiatorDocument, |
Stephen Chennney
2016/10/17 17:42:50
These can just always immediately return without d
panicker
2016/10/17 17:50:20
Yes addRenderTiming and addCompositeTiming should
| |
312 unsigned sourceFrame, | 310 unsigned sourceFrame, |
313 double startTime, | 311 double startTime, |
314 double finishTime) { | 312 double finishTime) { |
315 if (isFrameTimingBufferFull() && !hasObserverFor(PerformanceEntry::Render)) | 313 if (isFrameTimingBufferFull() && !hasObserverFor(PerformanceEntry::Render)) |
316 return; | 314 return; |
317 | |
318 PerformanceEntry* entry = PerformanceRenderTiming::create( | |
319 initiatorDocument, sourceFrame, startTime, finishTime); | |
320 notifyObserversOfEntry(*entry); | |
321 if (!isFrameTimingBufferFull()) | |
322 addFrameTimingBuffer(*entry); | |
323 } | 315 } |
324 | 316 |
325 void PerformanceBase::addCompositeTiming(Document* initiatorDocument, | 317 void PerformanceBase::addCompositeTiming(Document* initiatorDocument, |
Stephen Chennney
2016/10/17 17:42:50
This one also always does nothing.
| |
326 unsigned sourceFrame, | 318 unsigned sourceFrame, |
327 double startTime) { | 319 double startTime) { |
328 if (isFrameTimingBufferFull() && !hasObserverFor(PerformanceEntry::Composite)) | 320 if (isFrameTimingBufferFull() && !hasObserverFor(PerformanceEntry::Composite)) |
329 return; | 321 return; |
330 | |
331 PerformanceEntry* entry = PerformanceCompositeTiming::create( | |
332 initiatorDocument, sourceFrame, startTime); | |
333 notifyObserversOfEntry(*entry); | |
334 if (!isFrameTimingBufferFull()) | |
335 addFrameTimingBuffer(*entry); | |
336 } | 322 } |
337 | 323 |
338 void PerformanceBase::addFrameTimingBuffer(PerformanceEntry& entry) { | 324 void PerformanceBase::addFrameTimingBuffer(PerformanceEntry& entry) { |
339 m_frameTimingBuffer.append(&entry); | 325 m_frameTimingBuffer.append(&entry); |
340 | 326 |
341 if (isFrameTimingBufferFull()) | 327 if (isFrameTimingBufferFull()) |
342 dispatchEvent(Event::create(EventTypeNames::frametimingbufferfull)); | 328 dispatchEvent(Event::create(EventTypeNames::frametimingbufferfull)); |
343 } | 329 } |
344 | 330 |
345 bool PerformanceBase::isFrameTimingBufferFull() { | 331 bool PerformanceBase::isFrameTimingBufferFull() { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 visitor->trace(m_frameTimingBuffer); | 480 visitor->trace(m_frameTimingBuffer); |
495 visitor->trace(m_resourceTimingBuffer); | 481 visitor->trace(m_resourceTimingBuffer); |
496 visitor->trace(m_userTiming); | 482 visitor->trace(m_userTiming); |
497 visitor->trace(m_observers); | 483 visitor->trace(m_observers); |
498 visitor->trace(m_activeObservers); | 484 visitor->trace(m_activeObservers); |
499 visitor->trace(m_suspendedObservers); | 485 visitor->trace(m_suspendedObservers); |
500 EventTargetWithInlineData::trace(visitor); | 486 EventTargetWithInlineData::trace(visitor); |
501 } | 487 } |
502 | 488 |
503 } // namespace blink | 489 } // namespace blink |
OLD | NEW |