Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: Source/core/page/Performance.h

Issue 18916003: Performance.onwebkitresourcetimingbufferfull should be a Function (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 Performance_h 32 #ifndef Performance_h
33 #define Performance_h 33 #define Performance_h
34 34
35 #include "bindings/v8/ScriptValue.h"
35 #include "bindings/v8/ScriptWrappable.h" 36 #include "bindings/v8/ScriptWrappable.h"
36 #include "core/dom/EventTarget.h" 37 #include "core/dom/ExceptionCode.h"
37 #include "core/page/DOMWindowProperty.h" 38 #include "core/page/DOMWindowProperty.h"
38 #include "core/page/MemoryInfo.h" 39 #include "core/page/MemoryInfo.h"
39 #include "core/page/PerformanceEntry.h" 40 #include "core/page/PerformanceEntry.h"
40 #include "core/page/PerformanceNavigation.h" 41 #include "core/page/PerformanceNavigation.h"
41 #include "core/page/PerformanceTiming.h" 42 #include "core/page/PerformanceTiming.h"
42 #include <wtf/PassRefPtr.h> 43 #include <wtf/PassRefPtr.h>
43 #include <wtf/RefCounted.h> 44 #include <wtf/RefCounted.h>
44 #include <wtf/RefPtr.h> 45 #include <wtf/RefPtr.h>
45 #include <wtf/text/WTFString.h> 46 #include <wtf/text/WTFString.h>
46 47
47 namespace WebCore { 48 namespace WebCore {
48 49
49 class Document; 50 class Document;
50 class ResourceRequest; 51 class ResourceRequest;
51 class ResourceResponse; 52 class ResourceResponse;
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 {
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 ScriptExecutionContext* scriptExecutionContext() const;
61
62 PassRefPtr<MemoryInfo> memory() const; 60 PassRefPtr<MemoryInfo> memory() const;
63 PerformanceNavigation* navigation() const; 61 PerformanceNavigation* navigation() const;
64 PerformanceTiming* timing() const; 62 PerformanceTiming* timing() const;
65 double now() const; 63 double now() const;
66 64
67 Vector<RefPtr<PerformanceEntry> > getEntries() const; 65 Vector<RefPtr<PerformanceEntry> > getEntries() const;
68 Vector<RefPtr<PerformanceEntry> > getEntriesByType(const String& entryType); 66 Vector<RefPtr<PerformanceEntry> > getEntriesByType(const String& entryType);
69 Vector<RefPtr<PerformanceEntry> > getEntriesByName(const String& name, const String& entryType); 67 Vector<RefPtr<PerformanceEntry> > getEntriesByName(const String& name, const String& entryType);
70 68
71 void webkitClearResourceTimings(); 69 void webkitClearResourceTimings();
72 void webkitSetResourceTimingBufferSize(unsigned int); 70 void webkitSetResourceTimingBufferSize(ScriptState*, unsigned);
73 71
74 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull); 72 const ScriptValue& onwebkitresourcetimingbufferfull() { return m_onwebkitres ourcetimingbufferfull; }
73 void setOnwebkitresourcetimingbufferfull(const ScriptValue& callback);
75 74
76 void addResourceTiming(const String& initiatorName, Document*, const Resourc eRequest&, const ResourceResponse&, double initiationTime, double finishTime); 75 void addResourceTiming(const String& initiatorName, Document*, const Resourc eRequest&, const ResourceResponse&, double initiationTime, double finishTime);
77 76
78 using RefCounted<Performance>::ref;
79 using RefCounted<Performance>::deref;
80
81 void mark(const String& markName, ExceptionCode&); 77 void mark(const String& markName, ExceptionCode&);
82 void clearMarks(const String& markName); 78 void clearMarks(const String& markName);
83 79
84 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionCode&); 80 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionCode&);
85 void clearMeasures(const String& measureName); 81 void clearMeasures(const String& measureName);
86 82
87 private: 83 private:
88 explicit Performance(Frame*); 84 explicit Performance(Frame*);
85 void callResourceTimingBufferFullCallback(ScriptState*);
89 86
90 virtual void refEventTarget() { ref(); }
91 virtual void derefEventTarget() { deref(); }
92 virtual EventTargetData* eventTargetData();
93 virtual EventTargetData* ensureEventTargetData();
94 bool isResourceTimingBufferFull(); 87 bool isResourceTimingBufferFull();
95 88
96 EventTargetData m_eventTargetData;
97
98 mutable RefPtr<PerformanceNavigation> m_navigation; 89 mutable RefPtr<PerformanceNavigation> m_navigation;
99 mutable RefPtr<PerformanceTiming> m_timing; 90 mutable RefPtr<PerformanceTiming> m_timing;
100 91
101 Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer; 92 Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer;
102 unsigned m_resourceTimingBufferSize; 93 unsigned m_resourceTimingBufferSize;
103 94
104 RefPtr<UserTiming> m_userTiming; 95 RefPtr<UserTiming> m_userTiming;
96
97 ScriptValue m_onwebkitresourcetimingbufferfull;
105 }; 98 };
106 99
107 } 100 }
108 101
109 #endif // Performance_h 102 #endif // Performance_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698