| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "platform/Timer.h" | 42 #include "platform/Timer.h" |
| 43 #include "platform/heap/Handle.h" | 43 #include "platform/heap/Handle.h" |
| 44 #include "wtf/Forward.h" | 44 #include "wtf/Forward.h" |
| 45 #include "wtf/HashSet.h" | 45 #include "wtf/HashSet.h" |
| 46 #include "wtf/ListHashSet.h" | 46 #include "wtf/ListHashSet.h" |
| 47 #include "wtf/Vector.h" | 47 #include "wtf/Vector.h" |
| 48 | 48 |
| 49 namespace blink { | 49 namespace blink { |
| 50 | 50 |
| 51 class ExceptionState; | 51 class ExceptionState; |
| 52 class LocalFrame; | |
| 53 class PerformanceObserver; | 52 class PerformanceObserver; |
| 54 class PerformanceTiming; | 53 class PerformanceTiming; |
| 55 class ResourceResponse; | 54 class ResourceResponse; |
| 56 class ResourceTimingInfo; | 55 class ResourceTimingInfo; |
| 57 class SecurityOrigin; | 56 class SecurityOrigin; |
| 58 class UserTiming; | 57 class UserTiming; |
| 59 | 58 |
| 60 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; | 59 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; |
| 61 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>; | 60 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>; |
| 62 | 61 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 82 | 81 |
| 83 // Translate given platform monotonic time in seconds into a high resolution | 82 // Translate given platform monotonic time in seconds into a high resolution |
| 84 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to | 83 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to |
| 85 // document's time origin and has a time resolution that is safe for | 84 // document's time origin and has a time resolution that is safe for |
| 86 // exposing to web. | 85 // exposing to web. |
| 87 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; | 86 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; |
| 88 DOMHighResTimeStamp now() const; | 87 DOMHighResTimeStamp now() const; |
| 89 | 88 |
| 90 double timeOrigin() const { return m_timeOrigin; } | 89 double timeOrigin() const { return m_timeOrigin; } |
| 91 | 90 |
| 92 PerformanceEntryVector getEntries() const; | 91 PerformanceEntryVector getEntries(); |
| 93 PerformanceEntryVector getEntriesByType(const String& entryType); | 92 PerformanceEntryVector getEntriesByType(const String& entryType); |
| 94 PerformanceEntryVector getEntriesByName(const String& name, | 93 PerformanceEntryVector getEntriesByName(const String& name, |
| 95 const String& entryType); | 94 const String& entryType); |
| 96 | 95 |
| 97 void clearResourceTimings(); | 96 void clearResourceTimings(); |
| 98 void setResourceTimingBufferSize(unsigned); | 97 void setResourceTimingBufferSize(unsigned); |
| 99 | 98 |
| 100 DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull); | 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull); |
| 101 | 100 |
| 102 void clearFrameTimings(); | 101 void clearFrameTimings(); |
| 103 void setFrameTimingBufferSize(unsigned); | 102 void setFrameTimingBufferSize(unsigned); |
| 104 | 103 |
| 105 DEFINE_ATTRIBUTE_EVENT_LISTENER(frametimingbufferfull); | 104 DEFINE_ATTRIBUTE_EVENT_LISTENER(frametimingbufferfull); |
| 106 | 105 |
| 107 void addLongTaskTiming(double startTime, | 106 void addLongTaskTiming(double startTime, |
| 108 double endTime, | 107 double endTime, |
| 109 const String& name, | 108 const String& name, |
| 110 const String& culpritFrameSrc, | 109 const String& culpritFrameSrc, |
| 111 const String& culpritFrameId, | 110 const String& culpritFrameId, |
| 112 const String& culpritFrameName); | 111 const String& culpritFrameName); |
| 113 | 112 |
| 114 void addResourceTiming(const ResourceTimingInfo&); | 113 void addResourceTiming(const ResourceTimingInfo&); |
| 115 | 114 |
| 116 void addNavigationTiming(LocalFrame*); | 115 void notifyNavigationTimingToObservers(); |
| 117 | 116 |
| 118 void addFirstPaintTiming(double startTime); | 117 void addFirstPaintTiming(double startTime); |
| 119 | 118 |
| 120 void addFirstContentfulPaintTiming(double startTime); | 119 void addFirstContentfulPaintTiming(double startTime); |
| 121 | 120 |
| 122 void mark(const String& markName, ExceptionState&); | 121 void mark(const String& markName, ExceptionState&); |
| 123 void clearMarks(const String& markName); | 122 void clearMarks(const String& markName); |
| 124 | 123 |
| 125 void measure(const String& measureName, | 124 void measure(const String& measureName, |
| 126 const String& startMark, | 125 const String& startMark, |
| 127 const String& endMark, | 126 const String& endMark, |
| 128 ExceptionState&); | 127 ExceptionState&); |
| 129 void clearMeasures(const String& measureName); | 128 void clearMeasures(const String& measureName); |
| 130 | 129 |
| 131 void unregisterPerformanceObserver(PerformanceObserver&); | 130 void unregisterPerformanceObserver(PerformanceObserver&); |
| 132 void registerPerformanceObserver(PerformanceObserver&); | 131 void registerPerformanceObserver(PerformanceObserver&); |
| 133 void updatePerformanceObserverFilterOptions(); | 132 void updatePerformanceObserverFilterOptions(); |
| 134 void activateObserver(PerformanceObserver&); | 133 void activateObserver(PerformanceObserver&); |
| 135 void resumeSuspendedObservers(); | 134 void resumeSuspendedObservers(); |
| 136 | 135 |
| 137 DECLARE_VIRTUAL_TRACE(); | |
| 138 | |
| 139 private: | |
| 140 static PerformanceNavigationTiming::NavigationType getNavigationType( | |
| 141 NavigationType, | |
| 142 const Document*); | |
| 143 | |
| 144 static bool allowsTimingRedirect(const Vector<ResourceResponse>&, | 136 static bool allowsTimingRedirect(const Vector<ResourceResponse>&, |
| 145 const ResourceResponse&, | 137 const ResourceResponse&, |
| 146 const SecurityOrigin&, | 138 const SecurityOrigin&, |
| 147 ExecutionContext*); | 139 ExecutionContext*); |
| 148 | 140 |
| 141 DECLARE_VIRTUAL_TRACE(); |
| 142 |
| 143 private: |
| 149 static bool passesTimingAllowCheck(const ResourceResponse&, | 144 static bool passesTimingAllowCheck(const ResourceResponse&, |
| 150 const SecurityOrigin&, | 145 const SecurityOrigin&, |
| 151 const AtomicString&, | 146 const AtomicString&, |
| 152 ExecutionContext*); | 147 ExecutionContext*); |
| 153 | 148 |
| 154 void addPaintTiming(PerformancePaintTiming::PaintType, double startTime); | 149 void addPaintTiming(PerformancePaintTiming::PaintType, double startTime); |
| 155 | 150 |
| 156 protected: | 151 protected: |
| 157 explicit PerformanceBase(double timeOrigin, RefPtr<WebTaskRunner>); | 152 explicit PerformanceBase(double timeOrigin, RefPtr<WebTaskRunner>); |
| 158 | 153 |
| 154 // Expect Performance to override this method, |
| 155 // WorkerPerformance doesn't have to override this. |
| 156 virtual PerformanceNavigationTiming* createNavigationTimingInstance() { |
| 157 return nullptr; |
| 158 } |
| 159 |
| 159 bool isResourceTimingBufferFull(); | 160 bool isResourceTimingBufferFull(); |
| 160 void addResourceTimingBuffer(PerformanceEntry&); | 161 void addResourceTimingBuffer(PerformanceEntry&); |
| 161 | 162 |
| 162 bool isFrameTimingBufferFull(); | 163 bool isFrameTimingBufferFull(); |
| 163 void addFrameTimingBuffer(PerformanceEntry&); | 164 void addFrameTimingBuffer(PerformanceEntry&); |
| 164 | 165 |
| 165 void notifyObserversOfEntry(PerformanceEntry&); | 166 void notifyObserversOfEntry(PerformanceEntry&); |
| 166 bool hasObserverFor(PerformanceEntry::EntryType) const; | 167 bool hasObserverFor(PerformanceEntry::EntryType) const; |
| 167 | 168 |
| 168 void deliverObservationsTimerFired(TimerBase*); | 169 void deliverObservationsTimerFired(TimerBase*); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 179 PerformanceEntryTypeMask m_observerFilterOptions; | 180 PerformanceEntryTypeMask m_observerFilterOptions; |
| 180 PerformanceObservers m_observers; | 181 PerformanceObservers m_observers; |
| 181 PerformanceObservers m_activeObservers; | 182 PerformanceObservers m_activeObservers; |
| 182 PerformanceObservers m_suspendedObservers; | 183 PerformanceObservers m_suspendedObservers; |
| 183 TaskRunnerTimer<PerformanceBase> m_deliverObservationsTimer; | 184 TaskRunnerTimer<PerformanceBase> m_deliverObservationsTimer; |
| 184 }; | 185 }; |
| 185 | 186 |
| 186 } // namespace blink | 187 } // namespace blink |
| 187 | 188 |
| 188 #endif // PerformanceBase_h | 189 #endif // PerformanceBase_h |
| OLD | NEW |