| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>; | 56 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>; |
| 57 | 57 |
| 58 class CORE_EXPORT PerformanceBase : public EventTargetWithInlineData { | 58 class CORE_EXPORT PerformanceBase : public EventTargetWithInlineData { |
| 59 public: | 59 public: |
| 60 ~PerformanceBase() override; | 60 ~PerformanceBase() override; |
| 61 | 61 |
| 62 const AtomicString& interfaceName() const override; | 62 const AtomicString& interfaceName() const override; |
| 63 | 63 |
| 64 virtual PerformanceTiming* timing() const; | 64 virtual PerformanceTiming* timing() const; |
| 65 | 65 |
| 66 virtual void enableInspectorInstrumentation() const; |
| 67 |
| 66 // Reduce the resolution to 5µs to prevent timing attacks. See: | 68 // Reduce the resolution to 5µs to prevent timing attacks. See: |
| 67 // http://www.w3.org/TR/hr-time-2/#privacy-security | 69 // http://www.w3.org/TR/hr-time-2/#privacy-security |
| 68 static double clampTimeResolution(double timeSeconds); | 70 static double clampTimeResolution(double timeSeconds); |
| 69 | 71 |
| 70 // Translate given platform monotonic time in seconds into a high resolution | 72 // Translate given platform monotonic time in seconds into a high resolution |
| 71 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to | 73 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to |
| 72 // document's time origin and has a time resolution that is safe for | 74 // document's time origin and has a time resolution that is safe for |
| 73 // exposing to web. | 75 // exposing to web. |
| 74 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; | 76 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; |
| 75 DOMHighResTimeStamp now() const; | 77 DOMHighResTimeStamp now() const; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 102 | 104 |
| 103 void measure(const String& measureName, const String& startMark, const Strin
g& endMark, ExceptionState&); | 105 void measure(const String& measureName, const String& startMark, const Strin
g& endMark, ExceptionState&); |
| 104 void clearMeasures(const String& measureName); | 106 void clearMeasures(const String& measureName); |
| 105 | 107 |
| 106 void unregisterPerformanceObserver(PerformanceObserver&); | 108 void unregisterPerformanceObserver(PerformanceObserver&); |
| 107 void registerPerformanceObserver(PerformanceObserver&); | 109 void registerPerformanceObserver(PerformanceObserver&); |
| 108 void updatePerformanceObserverFilterOptions(); | 110 void updatePerformanceObserverFilterOptions(); |
| 109 void activateObserver(PerformanceObserver&); | 111 void activateObserver(PerformanceObserver&); |
| 110 void resumeSuspendedObservers(); | 112 void resumeSuspendedObservers(); |
| 111 | 113 |
| 114 // Needed by PerformanceObserver. Make Friend class? |
| 115 bool hasObserverFor(PerformanceEntry::EntryType); |
| 116 |
| 112 DECLARE_VIRTUAL_TRACE(); | 117 DECLARE_VIRTUAL_TRACE(); |
| 113 | 118 |
| 114 protected: | 119 protected: |
| 115 explicit PerformanceBase(double timeOrigin); | 120 explicit PerformanceBase(double timeOrigin); |
| 116 | 121 |
| 117 bool isResourceTimingBufferFull(); | 122 bool isResourceTimingBufferFull(); |
| 118 void addResourceTimingBuffer(PerformanceEntry&); | 123 void addResourceTimingBuffer(PerformanceEntry&); |
| 119 | 124 |
| 120 bool isFrameTimingBufferFull(); | 125 bool isFrameTimingBufferFull(); |
| 121 void addFrameTimingBuffer(PerformanceEntry&); | 126 void addFrameTimingBuffer(PerformanceEntry&); |
| 122 | 127 |
| 123 void notifyObserversOfEntry(PerformanceEntry&); | 128 void notifyObserversOfEntry(PerformanceEntry&); |
| 124 bool hasObserverFor(PerformanceEntry::EntryType); | |
| 125 | 129 |
| 126 void deliverObservationsTimerFired(TimerBase*); | 130 void deliverObservationsTimerFired(TimerBase*); |
| 127 | 131 |
| 128 PerformanceEntryVector m_frameTimingBuffer; | 132 PerformanceEntryVector m_frameTimingBuffer; |
| 129 unsigned m_frameTimingBufferSize; | 133 unsigned m_frameTimingBufferSize; |
| 130 PerformanceEntryVector m_resourceTimingBuffer; | 134 PerformanceEntryVector m_resourceTimingBuffer; |
| 131 unsigned m_resourceTimingBufferSize; | 135 unsigned m_resourceTimingBufferSize; |
| 132 double m_timeOrigin; | 136 double m_timeOrigin; |
| 133 | 137 |
| 134 Member<UserTiming> m_userTiming; | 138 Member<UserTiming> m_userTiming; |
| 135 | 139 |
| 136 PerformanceEntryTypeMask m_observerFilterOptions; | 140 PerformanceEntryTypeMask m_observerFilterOptions; |
| 137 PerformanceObservers m_observers; | 141 PerformanceObservers m_observers; |
| 138 PerformanceObservers m_activeObservers; | 142 PerformanceObservers m_activeObservers; |
| 139 PerformanceObservers m_suspendedObservers; | 143 PerformanceObservers m_suspendedObservers; |
| 140 Timer<PerformanceBase> m_deliverObservationsTimer; | 144 Timer<PerformanceBase> m_deliverObservationsTimer; |
| 145 bool m_inspectorInstrumentationEnabled; |
| 141 }; | 146 }; |
| 142 | 147 |
| 143 } // namespace blink | 148 } // namespace blink |
| 144 | 149 |
| 145 #endif // PerformanceBase_h | 150 #endif // PerformanceBase_h |
| OLD | NEW |