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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 | 81 |
82 // Translate given platform monotonic time in seconds into a high resolution | 82 // Translate given platform monotonic time in seconds into a high resolution |
83 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to | 83 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to |
84 // 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 |
85 // exposing to web. | 85 // exposing to web. |
86 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; | 86 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; |
87 DOMHighResTimeStamp now() const; | 87 DOMHighResTimeStamp now() const; |
88 | 88 |
89 double timeOrigin() const { return m_timeOrigin; } | 89 double timeOrigin() const { return m_timeOrigin; } |
90 | 90 |
91 PerformanceEntryVector getEntries() const; | 91 PerformanceEntryVector getEntries(); |
92 PerformanceEntryVector getEntriesByType(const String& entryType); | 92 PerformanceEntryVector getEntriesByType(const String& entryType); |
93 PerformanceEntryVector getEntriesByName(const String& name, | 93 PerformanceEntryVector getEntriesByName(const String& name, |
94 const String& entryType); | 94 const String& entryType); |
95 | 95 |
96 void clearResourceTimings(); | 96 void clearResourceTimings(); |
97 void setResourceTimingBufferSize(unsigned); | 97 void setResourceTimingBufferSize(unsigned); |
98 | 98 |
99 DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull); | 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull); |
100 | 100 |
101 void clearFrameTimings(); | 101 void clearFrameTimings(); |
102 void setFrameTimingBufferSize(unsigned); | 102 void setFrameTimingBufferSize(unsigned); |
103 | 103 |
104 DEFINE_ATTRIBUTE_EVENT_LISTENER(frametimingbufferfull); | 104 DEFINE_ATTRIBUTE_EVENT_LISTENER(frametimingbufferfull); |
105 | 105 |
106 void addLongTaskTiming(double startTime, | 106 void addLongTaskTiming(double startTime, |
107 double endTime, | 107 double endTime, |
108 const String& name, | 108 const String& name, |
109 const String& culpritFrameSrc, | 109 const String& culpritFrameSrc, |
110 const String& culpritFrameId, | 110 const String& culpritFrameId, |
111 const String& culpritFrameName); | 111 const String& culpritFrameName); |
112 | 112 |
113 void addResourceTiming(const ResourceTimingInfo&); | 113 void addResourceTiming(const ResourceTimingInfo&); |
114 | 114 |
115 void addNavigationTiming(LocalFrame*); | 115 void notifyNavigationTimingToObserver(); |
116 | 116 |
117 void addFirstPaintTiming(double startTime); | 117 void addFirstPaintTiming(double startTime); |
118 | 118 |
119 void addFirstContentfulPaintTiming(double startTime); | 119 void addFirstContentfulPaintTiming(double startTime); |
120 | 120 |
121 void mark(const String& markName, ExceptionState&); | 121 void mark(const String& markName, ExceptionState&); |
122 void clearMarks(const String& markName); | 122 void clearMarks(const String& markName); |
123 | 123 |
124 void measure(const String& measureName, | 124 void measure(const String& measureName, |
125 const String& startMark, | 125 const String& startMark, |
126 const String& endMark, | 126 const String& endMark, |
127 ExceptionState&); | 127 ExceptionState&); |
128 void clearMeasures(const String& measureName); | 128 void clearMeasures(const String& measureName); |
129 | 129 |
130 void unregisterPerformanceObserver(PerformanceObserver&); | 130 void unregisterPerformanceObserver(PerformanceObserver&); |
131 void registerPerformanceObserver(PerformanceObserver&); | 131 void registerPerformanceObserver(PerformanceObserver&); |
132 void updatePerformanceObserverFilterOptions(); | 132 void updatePerformanceObserverFilterOptions(); |
133 void activateObserver(PerformanceObserver&); | 133 void activateObserver(PerformanceObserver&); |
134 void resumeSuspendedObservers(); | 134 void resumeSuspendedObservers(); |
135 | 135 |
136 DECLARE_VIRTUAL_TRACE(); | |
137 | |
138 private: | |
139 static PerformanceNavigationTiming::NavigationType getNavigationType( | |
140 NavigationType, | |
141 const Document*); | |
142 | |
143 static bool allowsTimingRedirect(const Vector<ResourceResponse>&, | 136 static bool allowsTimingRedirect(const Vector<ResourceResponse>&, |
144 const ResourceResponse&, | 137 const ResourceResponse&, |
145 const SecurityOrigin&, | 138 const SecurityOrigin&, |
146 ExecutionContext*); | 139 ExecutionContext*); |
147 | 140 |
141 static SecurityOrigin* getSecurityOrigin(ExecutionContext*); | |
panicker
2017/02/03 23:53:52
Is this for calling from NT? If so, not worth maki
sunjian
2017/02/10 18:32:46
Made it inline in PerformanceNavigationTiming and
| |
142 | |
143 DECLARE_VIRTUAL_TRACE(); | |
144 | |
145 private: | |
148 static bool passesTimingAllowCheck(const ResourceResponse&, | 146 static bool passesTimingAllowCheck(const ResourceResponse&, |
149 const SecurityOrigin&, | 147 const SecurityOrigin&, |
150 const AtomicString&, | 148 const AtomicString&, |
151 ExecutionContext*); | 149 ExecutionContext*); |
152 | 150 |
153 void addPaintTiming(PerformancePaintTiming::PaintType, double startTime); | 151 void addPaintTiming(PerformancePaintTiming::PaintType, double startTime); |
154 | 152 |
155 protected: | 153 protected: |
156 explicit PerformanceBase(double timeOrigin, RefPtr<WebTaskRunner>); | 154 explicit PerformanceBase(double timeOrigin, RefPtr<WebTaskRunner>); |
157 | 155 |
156 // Expect Performance to override this method, | |
157 // WorkerPerformance doesn't have to override this. | |
158 virtual PerformanceNavigationTiming* getNavigationTimingInstance() { | |
159 return nullptr; | |
160 } | |
161 | |
158 bool isResourceTimingBufferFull(); | 162 bool isResourceTimingBufferFull(); |
159 void addResourceTimingBuffer(PerformanceEntry&); | 163 void addResourceTimingBuffer(PerformanceEntry&); |
160 | 164 |
161 bool isFrameTimingBufferFull(); | 165 bool isFrameTimingBufferFull(); |
162 void addFrameTimingBuffer(PerformanceEntry&); | 166 void addFrameTimingBuffer(PerformanceEntry&); |
163 | 167 |
164 void notifyObserversOfEntry(PerformanceEntry&); | 168 void notifyObserversOfEntry(PerformanceEntry&); |
165 bool hasObserverFor(PerformanceEntry::EntryType) const; | 169 bool hasObserverFor(PerformanceEntry::EntryType) const; |
166 | 170 |
167 void deliverObservationsTimerFired(TimerBase*); | 171 void deliverObservationsTimerFired(TimerBase*); |
(...skipping 10 matching lines...) Expand all Loading... | |
178 PerformanceEntryTypeMask m_observerFilterOptions; | 182 PerformanceEntryTypeMask m_observerFilterOptions; |
179 PerformanceObservers m_observers; | 183 PerformanceObservers m_observers; |
180 PerformanceObservers m_activeObservers; | 184 PerformanceObservers m_activeObservers; |
181 PerformanceObservers m_suspendedObservers; | 185 PerformanceObservers m_suspendedObservers; |
182 TaskRunnerTimer<PerformanceBase> m_deliverObservationsTimer; | 186 TaskRunnerTimer<PerformanceBase> m_deliverObservationsTimer; |
183 }; | 187 }; |
184 | 188 |
185 } // namespace blink | 189 } // namespace blink |
186 | 190 |
187 #endif // PerformanceBase_h | 191 #endif // PerformanceBase_h |
OLD | NEW |