Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 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 #ifndef PerformanceBase_h | 32 #ifndef PerformanceBase_h |
| 33 #define PerformanceBase_h | 33 #define PerformanceBase_h |
| 34 | 34 |
| 35 #include "bindings/core/v8/V8PerformanceObserverCallback.h" | |
| 35 #include "core/CoreExport.h" | 36 #include "core/CoreExport.h" |
| 36 #include "core/events/EventTarget.h" | 37 #include "core/events/EventTarget.h" |
| 37 #include "core/timing/PerformanceEntry.h" | 38 #include "core/timing/PerformanceEntry.h" |
| 38 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 39 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
| 40 #include "wtf/RefPtr.h" | 41 #include "wtf/RefPtr.h" |
| 41 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 class Document; | 46 class Document; |
| 46 class ExceptionState; | 47 class ExceptionState; |
| 48 class PerformanceObserver; | |
| 49 class PerformanceObserverRegistration; | |
| 47 class PerformanceTiming; | 50 class PerformanceTiming; |
| 48 class ResourceTimingInfo; | 51 class ResourceTimingInfo; |
| 49 class UserTiming; | 52 class UserTiming; |
| 50 | 53 |
| 51 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; | 54 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; |
| 55 using PerformanceObserverRegistrationVector = HeapVector<Member<PerformanceObser verRegistration>>; | |
| 56 using FilterTypeIndex = size_t; | |
| 57 using PerformanceObserverRegistrations = HeapHashMap<FilterTypeIndex, Performanc eObserverRegistrationVector>; | |
| 52 | 58 |
| 53 class CORE_EXPORT PerformanceBase : public RefCountedGarbageCollectedEventTarget WithInlineData<PerformanceBase> { | 59 class CORE_EXPORT PerformanceBase : public RefCountedGarbageCollectedEventTarget WithInlineData<PerformanceBase> { |
| 54 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PerformanceBase); | 60 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PerformanceBase); |
| 55 public: | 61 public: |
| 56 ~PerformanceBase() override; | 62 ~PerformanceBase() override; |
| 57 | 63 |
| 58 const AtomicString& interfaceName() const override; | 64 const AtomicString& interfaceName() const override; |
| 59 | 65 |
| 60 virtual PerformanceTiming* timing() const; | 66 virtual PerformanceTiming* timing() const; |
| 61 double now() const; | 67 double now() const; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 81 void addRenderTiming(Document*, unsigned, double, double); | 87 void addRenderTiming(Document*, unsigned, double, double); |
| 82 | 88 |
| 83 void addCompositeTiming(Document*, unsigned, double); | 89 void addCompositeTiming(Document*, unsigned, double); |
| 84 | 90 |
| 85 void mark(const String& markName, ExceptionState&); | 91 void mark(const String& markName, ExceptionState&); |
| 86 void clearMarks(const String& markName); | 92 void clearMarks(const String& markName); |
| 87 | 93 |
| 88 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionState&); | 94 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionState&); |
| 89 void clearMeasures(const String& measureName); | 95 void clearMeasures(const String& measureName); |
| 90 | 96 |
| 97 PerformanceObserver* createPerformanceObserver(PerformanceObserverCallback*) ; | |
| 98 void unregisterPerformanceObserver(PerformanceObserverRegistration*); | |
| 99 void registerPerformanceObserver(PerformanceObserverRegistration*); | |
| 100 | |
| 91 DECLARE_VIRTUAL_TRACE(); | 101 DECLARE_VIRTUAL_TRACE(); |
| 92 | 102 |
| 93 protected: | 103 protected: |
| 104 enum FilterType { | |
| 105 Composite = 1, | |
|
esprehn
2015/07/18 22:24:16
UnknownFilter, or maybe InvalidFilter
CompositeFil
MikeB
2015/07/20 23:06:50
Done.
| |
| 106 Mark, | |
| 107 Measure, | |
| 108 Render, | |
| 109 Resource, | |
| 110 }; | |
| 111 | |
| 94 explicit PerformanceBase(double timeOrigin); | 112 explicit PerformanceBase(double timeOrigin); |
| 95 bool isResourceTimingBufferFull(); | 113 bool isResourceTimingBufferFull(); |
| 96 void addResourceTimingBuffer(PerformanceEntry*); | 114 void addResourceTimingBuffer(PerformanceEntry*); |
| 97 | 115 |
| 98 bool isFrameTimingBufferFull(); | 116 bool isFrameTimingBufferFull(); |
| 99 void addFrameTimingBuffer(PerformanceEntry*); | 117 void addFrameTimingBuffer(PerformanceEntry*); |
| 100 | 118 |
| 119 void notifyObserversOfEntry(FilterType, PerformanceEntry*); | |
| 120 bool hasObserverFor(FilterType); | |
| 121 | |
| 101 PerformanceEntryVector m_frameTimingBuffer; | 122 PerformanceEntryVector m_frameTimingBuffer; |
| 102 unsigned m_frameTimingBufferSize; | 123 unsigned m_frameTimingBufferSize; |
| 103 PerformanceEntryVector m_resourceTimingBuffer; | 124 PerformanceEntryVector m_resourceTimingBuffer; |
| 104 unsigned m_resourceTimingBufferSize; | 125 unsigned m_resourceTimingBufferSize; |
| 105 double m_timeOrigin; | 126 double m_timeOrigin; |
| 106 | 127 |
| 107 Member<UserTiming> m_userTiming; | 128 Member<UserTiming> m_userTiming; |
| 129 | |
| 130 PerformanceObserverRegistrations m_observerRegistry; | |
| 108 }; | 131 }; |
| 109 | 132 |
| 110 } // namespace blink | 133 } // namespace blink |
| 111 | 134 |
| 112 #endif // PerformanceBase_h | 135 #endif // PerformanceBase_h |
| OLD | NEW |