| 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 15 matching lines...) Expand all Loading... |
| 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 Performance_h | 32 #ifndef Performance_h |
| 33 #define Performance_h | 33 #define Performance_h |
| 34 | 34 |
| 35 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
| 36 #include "core/events/EventTarget.h" | |
| 37 #include "core/frame/DOMWindowProperty.h" | 36 #include "core/frame/DOMWindowProperty.h" |
| 38 #include "core/timing/MemoryInfo.h" | 37 #include "core/timing/MemoryInfo.h" |
| 39 #include "core/timing/PerformanceEntry.h" | 38 #include "core/timing/PerformanceBase.h" |
| 40 #include "core/timing/PerformanceNavigation.h" | 39 #include "core/timing/PerformanceNavigation.h" |
| 41 #include "core/timing/PerformanceTiming.h" | 40 #include "core/timing/PerformanceTiming.h" |
| 42 #include "platform/heap/Handle.h" | |
| 43 #include "wtf/RefCounted.h" | |
| 44 #include "wtf/RefPtr.h" | |
| 45 #include "wtf/text/WTFString.h" | |
| 46 | 41 |
| 47 namespace blink { | 42 namespace blink { |
| 48 | 43 |
| 49 class Document; | 44 class CORE_EXPORT Performance final : public PerformanceBase, public DOMWindowPr
operty { |
| 50 class ExceptionState; | |
| 51 class ResourceTimingInfo; | |
| 52 class UserTiming; | |
| 53 | |
| 54 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; | |
| 55 | |
| 56 class CORE_EXPORT Performance final : public RefCountedGarbageCollectedEventTarg
etWithInlineData<Performance>, public DOMWindowProperty { | |
| 57 DEFINE_WRAPPERTYPEINFO(); | 45 DEFINE_WRAPPERTYPEINFO(); |
| 58 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<P
erformance>); | |
| 59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Performance); | |
| 60 public: | 46 public: |
| 61 static Performance* create(LocalFrame* frame) | 47 static Performance* create(LocalFrame* frame) |
| 62 { | 48 { |
| 63 return new Performance(frame); | 49 return new Performance(frame); |
| 64 } | 50 } |
| 65 virtual ~Performance(); | 51 virtual ~Performance(); |
| 66 | 52 |
| 67 virtual const AtomicString& interfaceName() const override; | |
| 68 virtual ExecutionContext* executionContext() const override; | 53 virtual ExecutionContext* executionContext() const override; |
| 69 | 54 |
| 70 MemoryInfo* memory(); | 55 MemoryInfo* memory(); |
| 71 PerformanceNavigation* navigation() const; | 56 PerformanceNavigation* navigation() const; |
| 72 PerformanceTiming* timing() const; | 57 PerformanceTiming* timing() const override; |
| 73 double now() const; | |
| 74 | |
| 75 PerformanceEntryVector getEntries() const; | |
| 76 PerformanceEntryVector getEntriesByType(const String& entryType); | |
| 77 PerformanceEntryVector getEntriesByName(const String& name, const String& en
tryType); | |
| 78 | |
| 79 void webkitClearResourceTimings(); | |
| 80 void webkitSetResourceTimingBufferSize(unsigned); | |
| 81 | |
| 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull); | |
| 83 | |
| 84 void clearFrameTimings(); | |
| 85 void setFrameTimingBufferSize(unsigned); | |
| 86 | |
| 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(frametimingbufferfull); | |
| 88 | |
| 89 void addResourceTiming(const ResourceTimingInfo&, Document*); | |
| 90 | |
| 91 void addRenderTiming(Document*, unsigned, double, double); | |
| 92 | |
| 93 void addCompositeTiming(Document*, unsigned, double); | |
| 94 | |
| 95 void mark(const String& markName, ExceptionState&); | |
| 96 void clearMarks(const String& markName); | |
| 97 | |
| 98 void measure(const String& measureName, const String& startMark, const Strin
g& endMark, ExceptionState&); | |
| 99 void clearMeasures(const String& measureName); | |
| 100 | 58 |
| 101 DECLARE_VIRTUAL_TRACE(); | 59 DECLARE_VIRTUAL_TRACE(); |
| 102 | 60 |
| 103 private: | 61 private: |
| 104 explicit Performance(LocalFrame*); | 62 explicit Performance(LocalFrame*); |
| 105 | 63 |
| 106 bool isResourceTimingBufferFull(); | |
| 107 void addResourceTimingBuffer(PerformanceEntry*); | |
| 108 | |
| 109 mutable Member<PerformanceNavigation> m_navigation; | 64 mutable Member<PerformanceNavigation> m_navigation; |
| 110 mutable Member<PerformanceTiming> m_timing; | 65 mutable Member<PerformanceTiming> m_timing; |
| 111 | 66 |
| 112 bool isFrameTimingBufferFull(); | |
| 113 void addFrameTimingBuffer(PerformanceEntry*); | |
| 114 | |
| 115 PerformanceEntryVector m_frameTimingBuffer; | |
| 116 unsigned m_frameTimingBufferSize; | |
| 117 PerformanceEntryVector m_resourceTimingBuffer; | |
| 118 unsigned m_resourceTimingBufferSize; | |
| 119 double m_referenceTime; | |
| 120 | |
| 121 Member<MemoryInfo> m_memoryInfo; | 67 Member<MemoryInfo> m_memoryInfo; |
| 122 Member<UserTiming> m_userTiming; | |
| 123 }; | 68 }; |
| 124 | 69 |
| 125 } // namespace blink | 70 } // namespace blink |
| 126 | 71 |
| 127 #endif // Performance_h | 72 #endif // Performance_h |
| OLD | NEW |