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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include <wtf/PassRefPtr.h> | 42 #include <wtf/PassRefPtr.h> |
43 #include <wtf/RefCounted.h> | 43 #include <wtf/RefCounted.h> |
44 #include <wtf/RefPtr.h> | 44 #include <wtf/RefPtr.h> |
45 #include <wtf/text/WTFString.h> | 45 #include <wtf/text/WTFString.h> |
46 | 46 |
47 namespace WebCore { | 47 namespace WebCore { |
48 | 48 |
49 class Document; | 49 class Document; |
50 class ResourceRequest; | 50 class ResourceRequest; |
51 class ResourceResponse; | 51 class ResourceResponse; |
| 52 class ResourceTimingInfo; |
52 class UserTiming; | 53 class UserTiming; |
53 | 54 |
54 class Performance : public ScriptWrappable, public RefCounted<Performance>, publ
ic DOMWindowProperty, public EventTarget { | 55 class Performance : public ScriptWrappable, public RefCounted<Performance>, publ
ic DOMWindowProperty, public EventTarget { |
55 public: | 56 public: |
56 static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Pe
rformance(frame)); } | 57 static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Pe
rformance(frame)); } |
57 ~Performance(); | 58 ~Performance(); |
58 | 59 |
59 virtual const AtomicString& interfaceName() const; | 60 virtual const AtomicString& interfaceName() const; |
60 virtual ScriptExecutionContext* scriptExecutionContext() const; | 61 virtual ScriptExecutionContext* scriptExecutionContext() const; |
61 | 62 |
62 PassRefPtr<MemoryInfo> memory() const; | 63 PassRefPtr<MemoryInfo> memory() const; |
63 PerformanceNavigation* navigation() const; | 64 PerformanceNavigation* navigation() const; |
64 PerformanceTiming* timing() const; | 65 PerformanceTiming* timing() const; |
65 double now() const; | 66 double now() const; |
66 | 67 |
67 Vector<RefPtr<PerformanceEntry> > getEntries() const; | 68 Vector<RefPtr<PerformanceEntry> > getEntries() const; |
68 Vector<RefPtr<PerformanceEntry> > getEntriesByType(const String& entryType); | 69 Vector<RefPtr<PerformanceEntry> > getEntriesByType(const String& entryType); |
69 Vector<RefPtr<PerformanceEntry> > getEntriesByName(const String& name, const
String& entryType); | 70 Vector<RefPtr<PerformanceEntry> > getEntriesByName(const String& name, const
String& entryType); |
70 | 71 |
71 void webkitClearResourceTimings(); | 72 void webkitClearResourceTimings(); |
72 void webkitSetResourceTimingBufferSize(unsigned int); | 73 void webkitSetResourceTimingBufferSize(unsigned int); |
73 | 74 |
74 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull); | 75 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull); |
75 | 76 |
76 void addResourceTiming(const String& initiatorName, Document*, const Resourc
eRequest&, const ResourceResponse&, double initiationTime, double finishTime); | 77 void addResourceTiming(const ResourceTimingInfo&, Document*); |
77 | 78 |
78 using RefCounted<Performance>::ref; | 79 using RefCounted<Performance>::ref; |
79 using RefCounted<Performance>::deref; | 80 using RefCounted<Performance>::deref; |
80 | 81 |
81 void mark(const String& markName, ExceptionCode&); | 82 void mark(const String& markName, ExceptionCode&); |
82 void clearMarks(const String& markName); | 83 void clearMarks(const String& markName); |
83 | 84 |
84 void measure(const String& measureName, const String& startMark, const Strin
g& endMark, ExceptionCode&); | 85 void measure(const String& measureName, const String& startMark, const Strin
g& endMark, ExceptionCode&); |
85 void clearMeasures(const String& measureName); | 86 void clearMeasures(const String& measureName); |
86 | 87 |
87 private: | 88 private: |
88 explicit Performance(Frame*); | 89 explicit Performance(Frame*); |
89 | 90 |
90 virtual void refEventTarget() { ref(); } | 91 virtual void refEventTarget() { ref(); } |
91 virtual void derefEventTarget() { deref(); } | 92 virtual void derefEventTarget() { deref(); } |
92 virtual EventTargetData* eventTargetData(); | 93 virtual EventTargetData* eventTargetData(); |
93 virtual EventTargetData* ensureEventTargetData(); | 94 virtual EventTargetData* ensureEventTargetData(); |
94 bool isResourceTimingBufferFull(); | 95 bool isResourceTimingBufferFull(); |
| 96 void addResourceTimingBuffer(PassRefPtr<PerformanceEntry>); |
95 | 97 |
96 EventTargetData m_eventTargetData; | 98 EventTargetData m_eventTargetData; |
97 | 99 |
98 mutable RefPtr<PerformanceNavigation> m_navigation; | 100 mutable RefPtr<PerformanceNavigation> m_navigation; |
99 mutable RefPtr<PerformanceTiming> m_timing; | 101 mutable RefPtr<PerformanceTiming> m_timing; |
100 | 102 |
101 Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer; | 103 Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer; |
102 unsigned m_resourceTimingBufferSize; | 104 unsigned m_resourceTimingBufferSize; |
103 | 105 |
104 RefPtr<UserTiming> m_userTiming; | 106 RefPtr<UserTiming> m_userTiming; |
105 }; | 107 }; |
106 | 108 |
107 } | 109 } |
108 | 110 |
109 #endif // Performance_h | 111 #endif // Performance_h |
OLD | NEW |