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

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

Issue 26878003: Reduce repetitive EventTarget subclassing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit Created 7 years, 2 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
« no previous file with comments | « Source/core/page/EventSource.cpp ('k') | Source/core/page/Performance.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 namespace WebCore { 47 namespace WebCore {
48 48
49 class Document; 49 class Document;
50 class ExceptionState; 50 class ExceptionState;
51 class ResourceRequest; 51 class ResourceRequest;
52 class ResourceResponse; 52 class ResourceResponse;
53 class ResourceTimingInfo; 53 class ResourceTimingInfo;
54 class UserTiming; 54 class UserTiming;
55 55
56 class Performance : public ScriptWrappable, public RefCounted<Performance>, publ ic DOMWindowProperty, public EventTarget { 56 class Performance : public ScriptWrappable, public RefCounted<Performance>, publ ic DOMWindowProperty, public EventTargetWithInlineData {
57 public: 57 public:
58 static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Pe rformance(frame)); } 58 static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Pe rformance(frame)); }
59 ~Performance(); 59 ~Performance();
60 60
61 virtual const AtomicString& interfaceName() const; 61 virtual const AtomicString& interfaceName() const OVERRIDE;
62 virtual ScriptExecutionContext* scriptExecutionContext() const; 62 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
63 63
64 PassRefPtr<MemoryInfo> memory() const; 64 PassRefPtr<MemoryInfo> memory() const;
65 PerformanceNavigation* navigation() const; 65 PerformanceNavigation* navigation() const;
66 PerformanceTiming* timing() const; 66 PerformanceTiming* timing() const;
67 double now() const; 67 double now() const;
68 68
69 Vector<RefPtr<PerformanceEntry> > getEntries() const; 69 Vector<RefPtr<PerformanceEntry> > getEntries() const;
70 Vector<RefPtr<PerformanceEntry> > getEntriesByType(const String& entryType); 70 Vector<RefPtr<PerformanceEntry> > getEntriesByType(const String& entryType);
71 Vector<RefPtr<PerformanceEntry> > getEntriesByName(const String& name, const String& entryType); 71 Vector<RefPtr<PerformanceEntry> > getEntriesByName(const String& name, const String& entryType);
72 72
73 void webkitClearResourceTimings(); 73 void webkitClearResourceTimings();
74 void webkitSetResourceTimingBufferSize(unsigned int); 74 void webkitSetResourceTimingBufferSize(unsigned int);
75 75
76 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull); 76 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull);
77 77
78 void addResourceTiming(const ResourceTimingInfo&, Document*); 78 void addResourceTiming(const ResourceTimingInfo&, Document*);
79 79
80 using RefCounted<Performance>::ref; 80 using RefCounted<Performance>::ref;
81 using RefCounted<Performance>::deref; 81 using RefCounted<Performance>::deref;
82 82
83 void mark(const String& markName, ExceptionState&); 83 void mark(const String& markName, ExceptionState&);
84 void clearMarks(const String& markName); 84 void clearMarks(const String& markName);
85 85
86 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionState&); 86 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionState&);
87 void clearMeasures(const String& measureName); 87 void clearMeasures(const String& measureName);
88 88
89 private: 89 private:
90 explicit Performance(Frame*); 90 explicit Performance(Frame*);
91 91
92 virtual void refEventTarget() { ref(); } 92 virtual void refEventTarget() OVERRIDE { ref(); }
93 virtual void derefEventTarget() { deref(); } 93 virtual void derefEventTarget() OVERRIDE { deref(); }
94 virtual EventTargetData* eventTargetData(); 94
95 virtual EventTargetData* ensureEventTargetData();
96 bool isResourceTimingBufferFull(); 95 bool isResourceTimingBufferFull();
97 void addResourceTimingBuffer(PassRefPtr<PerformanceEntry>); 96 void addResourceTimingBuffer(PassRefPtr<PerformanceEntry>);
98 97
99 EventTargetData m_eventTargetData;
100
101 mutable RefPtr<PerformanceNavigation> m_navigation; 98 mutable RefPtr<PerformanceNavigation> m_navigation;
102 mutable RefPtr<PerformanceTiming> m_timing; 99 mutable RefPtr<PerformanceTiming> m_timing;
103 100
104 Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer; 101 Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer;
105 unsigned m_resourceTimingBufferSize; 102 unsigned m_resourceTimingBufferSize;
106 double m_referenceTime; 103 double m_referenceTime;
107 104
108 RefPtr<UserTiming> m_userTiming; 105 RefPtr<UserTiming> m_userTiming;
109 }; 106 };
110 107
111 } 108 }
112 109
113 #endif // Performance_h 110 #endif // Performance_h
OLDNEW
« no previous file with comments | « Source/core/page/EventSource.cpp ('k') | Source/core/page/Performance.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698