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