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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 // Reduce the resolution to 5µs to prevent timing attacks. See: | 66 // Reduce the resolution to 5µs to prevent timing attacks. See: |
67 // http://www.w3.org/TR/hr-time-2/#privacy-security | 67 // http://www.w3.org/TR/hr-time-2/#privacy-security |
68 static double clampTimeResolution(double timeSeconds); | 68 static double clampTimeResolution(double timeSeconds); |
69 | 69 |
70 // Translate given platform monotonic time in seconds into a high resolution | 70 // Translate given platform monotonic time in seconds into a high resolution |
71 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to | 71 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to |
72 // document's time origin and has a time resolution that is safe for | 72 // document's time origin and has a time resolution that is safe for |
73 // exposing to web. | 73 // exposing to web. |
74 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; | 74 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; |
| 75 double monotonicTimeToDOMHighResTimeStampInMillis(DOMHighResTimeStamp) const
; |
75 DOMHighResTimeStamp now() const; | 76 DOMHighResTimeStamp now() const; |
76 | 77 |
77 double timeOrigin() const { return m_timeOrigin; } | 78 double timeOrigin() const { return m_timeOrigin; } |
78 | 79 |
79 PerformanceEntryVector getEntries() const; | 80 PerformanceEntryVector getEntries() const; |
80 PerformanceEntryVector getEntriesByType(const String& entryType); | 81 PerformanceEntryVector getEntriesByType(const String& entryType); |
81 PerformanceEntryVector getEntriesByName(const String& name, const String& en
tryType); | 82 PerformanceEntryVector getEntriesByName(const String& name, const String& en
tryType); |
82 | 83 |
83 void clearResourceTimings(); | 84 void clearResourceTimings(); |
84 void setResourceTimingBufferSize(unsigned); | 85 void setResourceTimingBufferSize(unsigned); |
85 | 86 |
86 DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull); | 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull); |
87 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull); | 88 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull); |
88 | 89 |
89 void clearFrameTimings(); | 90 void clearFrameTimings(); |
90 void setFrameTimingBufferSize(unsigned); | 91 void setFrameTimingBufferSize(unsigned); |
91 | 92 |
92 DEFINE_ATTRIBUTE_EVENT_LISTENER(frametimingbufferfull); | 93 DEFINE_ATTRIBUTE_EVENT_LISTENER(frametimingbufferfull); |
93 | 94 |
| 95 void clearLongTaskTimings(); |
| 96 void setLongTaskTimingBufferSize(unsigned); |
| 97 |
| 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(longtasktimingbufferfull); |
| 99 |
| 100 void addLongTaskTiming(double, double, const String& frameContextUrl); |
| 101 |
94 void addResourceTiming(const ResourceTimingInfo&); | 102 void addResourceTiming(const ResourceTimingInfo&); |
95 | 103 |
96 void addRenderTiming(Document*, unsigned, double, double); | 104 void addRenderTiming(Document*, unsigned, double, double); |
97 | 105 |
98 void addCompositeTiming(Document*, unsigned, double); | 106 void addCompositeTiming(Document*, unsigned, double); |
99 | 107 |
100 void mark(const String& markName, ExceptionState&); | 108 void mark(const String& markName, ExceptionState&); |
101 void clearMarks(const String& markName); | 109 void clearMarks(const String& markName); |
102 | 110 |
103 void measure(const String& measureName, const String& startMark, const Strin
g& endMark, ExceptionState&); | 111 void measure(const String& measureName, const String& startMark, const Strin
g& endMark, ExceptionState&); |
104 void clearMeasures(const String& measureName); | 112 void clearMeasures(const String& measureName); |
105 | 113 |
106 void unregisterPerformanceObserver(PerformanceObserver&); | 114 void unregisterPerformanceObserver(PerformanceObserver&); |
107 void registerPerformanceObserver(PerformanceObserver&); | 115 void registerPerformanceObserver(PerformanceObserver&); |
108 void updatePerformanceObserverFilterOptions(); | 116 void updatePerformanceObserverFilterOptions(); |
109 void activateObserver(PerformanceObserver&); | 117 void activateObserver(PerformanceObserver&); |
110 void resumeSuspendedObservers(); | 118 void resumeSuspendedObservers(); |
111 | 119 |
112 DECLARE_VIRTUAL_TRACE(); | 120 DECLARE_VIRTUAL_TRACE(); |
113 | 121 |
114 protected: | 122 protected: |
115 explicit PerformanceBase(double timeOrigin); | 123 explicit PerformanceBase(double timeOrigin); |
116 | 124 |
117 bool isResourceTimingBufferFull(); | 125 bool isResourceTimingBufferFull(); |
118 void addResourceTimingBuffer(PerformanceEntry&); | 126 void addResourceTimingBuffer(PerformanceEntry&); |
119 | 127 |
120 bool isFrameTimingBufferFull(); | 128 bool isFrameTimingBufferFull(); |
121 void addFrameTimingBuffer(PerformanceEntry&); | 129 void addFrameTimingBuffer(PerformanceEntry&); |
122 | 130 |
| 131 bool isLongTaskTimingBufferFull(); |
| 132 void addLongTaskTimingBuffer(PerformanceEntry&); |
| 133 |
123 void notifyObserversOfEntry(PerformanceEntry&); | 134 void notifyObserversOfEntry(PerformanceEntry&); |
124 bool hasObserverFor(PerformanceEntry::EntryType); | 135 bool hasObserverFor(PerformanceEntry::EntryType); |
125 | 136 |
126 void deliverObservationsTimerFired(TimerBase*); | 137 void deliverObservationsTimerFired(TimerBase*); |
127 | 138 |
128 PerformanceEntryVector m_frameTimingBuffer; | 139 PerformanceEntryVector m_frameTimingBuffer; |
129 unsigned m_frameTimingBufferSize; | 140 unsigned m_frameTimingBufferSize; |
130 PerformanceEntryVector m_resourceTimingBuffer; | 141 PerformanceEntryVector m_resourceTimingBuffer; |
131 unsigned m_resourceTimingBufferSize; | 142 unsigned m_resourceTimingBufferSize; |
| 143 PerformanceEntryVector m_longTaskTimingBuffer; |
| 144 unsigned m_longTaskTimingBufferSize; |
| 145 Member<UserTiming> m_userTiming; |
| 146 |
132 double m_timeOrigin; | 147 double m_timeOrigin; |
133 | 148 |
134 Member<UserTiming> m_userTiming; | |
135 | |
136 PerformanceEntryTypeMask m_observerFilterOptions; | 149 PerformanceEntryTypeMask m_observerFilterOptions; |
137 PerformanceObservers m_observers; | 150 PerformanceObservers m_observers; |
138 PerformanceObservers m_activeObservers; | 151 PerformanceObservers m_activeObservers; |
139 PerformanceObservers m_suspendedObservers; | 152 PerformanceObservers m_suspendedObservers; |
140 Timer<PerformanceBase> m_deliverObservationsTimer; | 153 Timer<PerformanceBase> m_deliverObservationsTimer; |
141 }; | 154 }; |
142 | 155 |
143 } // namespace blink | 156 } // namespace blink |
144 | 157 |
145 #endif // PerformanceBase_h | 158 #endif // PerformanceBase_h |
OLD | NEW |