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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceBase.h

Issue 2647643004: Report nav timing 2 instance as soon as it's requested. (Closed)
Patch Set: make ResourceTimingInfo ref-counted Created 3 years, 10 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
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // Translate given platform monotonic time in seconds into a high resolution 82 // Translate given platform monotonic time in seconds into a high resolution
83 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to 83 // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to
84 // document's time origin and has a time resolution that is safe for 84 // document's time origin and has a time resolution that is safe for
85 // exposing to web. 85 // exposing to web.
86 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; 86 DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const;
87 DOMHighResTimeStamp now() const; 87 DOMHighResTimeStamp now() const;
88 88
89 double timeOrigin() const { return m_timeOrigin; } 89 double timeOrigin() const { return m_timeOrigin; }
90 90
91 PerformanceEntryVector getEntries() const; 91 PerformanceEntryVector getEntries();
92 PerformanceEntryVector getEntriesByType(const String& entryType); 92 PerformanceEntryVector getEntriesByType(const String& entryType);
93 PerformanceEntryVector getEntriesByName(const String& name, 93 PerformanceEntryVector getEntriesByName(const String& name,
94 const String& entryType); 94 const String& entryType);
95 95
96 void clearResourceTimings(); 96 void clearResourceTimings();
97 void setResourceTimingBufferSize(unsigned); 97 void setResourceTimingBufferSize(unsigned);
98 98
99 DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull); 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(resourcetimingbufferfull);
100 100
101 void clearFrameTimings(); 101 void clearFrameTimings();
102 void setFrameTimingBufferSize(unsigned); 102 void setFrameTimingBufferSize(unsigned);
103 103
104 DEFINE_ATTRIBUTE_EVENT_LISTENER(frametimingbufferfull); 104 DEFINE_ATTRIBUTE_EVENT_LISTENER(frametimingbufferfull);
105 105
106 void addLongTaskTiming(double startTime, 106 void addLongTaskTiming(double startTime,
107 double endTime, 107 double endTime,
108 const String& name, 108 const String& name,
109 const String& culpritFrameSrc, 109 const String& culpritFrameSrc,
110 const String& culpritFrameId, 110 const String& culpritFrameId,
111 const String& culpritFrameName); 111 const String& culpritFrameName);
112 112
113 void addResourceTiming(const ResourceTimingInfo&); 113 void addResourceTiming(const ResourceTimingInfo&);
114 114
115 void addNavigationTiming(LocalFrame*); 115 void notifyNavigationTimingToObservers();
116 116
117 void addFirstPaintTiming(double startTime); 117 void addFirstPaintTiming(double startTime);
118 118
119 void addFirstContentfulPaintTiming(double startTime); 119 void addFirstContentfulPaintTiming(double startTime);
120 120
121 void mark(const String& markName, ExceptionState&); 121 void mark(const String& markName, ExceptionState&);
122 void clearMarks(const String& markName); 122 void clearMarks(const String& markName);
123 123
124 void measure(const String& measureName, 124 void measure(const String& measureName,
125 const String& startMark, 125 const String& startMark,
126 const String& endMark, 126 const String& endMark,
127 ExceptionState&); 127 ExceptionState&);
128 void clearMeasures(const String& measureName); 128 void clearMeasures(const String& measureName);
129 129
130 void unregisterPerformanceObserver(PerformanceObserver&); 130 void unregisterPerformanceObserver(PerformanceObserver&);
131 void registerPerformanceObserver(PerformanceObserver&); 131 void registerPerformanceObserver(PerformanceObserver&);
132 void updatePerformanceObserverFilterOptions(); 132 void updatePerformanceObserverFilterOptions();
133 void activateObserver(PerformanceObserver&); 133 void activateObserver(PerformanceObserver&);
134 void resumeSuspendedObservers(); 134 void resumeSuspendedObservers();
135 135
136 DECLARE_VIRTUAL_TRACE();
137
138 private:
139 static PerformanceNavigationTiming::NavigationType getNavigationType(
140 NavigationType,
141 const Document*);
142
143 static bool allowsTimingRedirect(const Vector<ResourceResponse>&, 136 static bool allowsTimingRedirect(const Vector<ResourceResponse>&,
144 const ResourceResponse&, 137 const ResourceResponse&,
145 const SecurityOrigin&, 138 const SecurityOrigin&,
146 ExecutionContext*); 139 ExecutionContext*);
147 140
141 DECLARE_VIRTUAL_TRACE();
142
143 private:
148 static bool passesTimingAllowCheck(const ResourceResponse&, 144 static bool passesTimingAllowCheck(const ResourceResponse&,
149 const SecurityOrigin&, 145 const SecurityOrigin&,
150 const AtomicString&, 146 const AtomicString&,
151 ExecutionContext*); 147 ExecutionContext*);
152 148
153 void addPaintTiming(PerformancePaintTiming::PaintType, double startTime); 149 void addPaintTiming(PerformancePaintTiming::PaintType, double startTime);
154 150
155 protected: 151 protected:
156 explicit PerformanceBase(double timeOrigin, RefPtr<WebTaskRunner>); 152 explicit PerformanceBase(double timeOrigin, RefPtr<WebTaskRunner>);
157 153
154 // Expect Performance to override this method,
155 // WorkerPerformance doesn't have to override this.
156 virtual PerformanceNavigationTiming* createNavigationTimingInstance() {
157 return nullptr;
158 }
159
158 bool isResourceTimingBufferFull(); 160 bool isResourceTimingBufferFull();
159 void addResourceTimingBuffer(PerformanceEntry&); 161 void addResourceTimingBuffer(PerformanceEntry&);
160 162
161 bool isFrameTimingBufferFull(); 163 bool isFrameTimingBufferFull();
162 void addFrameTimingBuffer(PerformanceEntry&); 164 void addFrameTimingBuffer(PerformanceEntry&);
163 165
164 void notifyObserversOfEntry(PerformanceEntry&); 166 void notifyObserversOfEntry(PerformanceEntry&);
165 bool hasObserverFor(PerformanceEntry::EntryType) const; 167 bool hasObserverFor(PerformanceEntry::EntryType) const;
166 168
167 void deliverObservationsTimerFired(TimerBase*); 169 void deliverObservationsTimerFired(TimerBase*);
(...skipping 10 matching lines...) Expand all
178 PerformanceEntryTypeMask m_observerFilterOptions; 180 PerformanceEntryTypeMask m_observerFilterOptions;
179 PerformanceObservers m_observers; 181 PerformanceObservers m_observers;
180 PerformanceObservers m_activeObservers; 182 PerformanceObservers m_activeObservers;
181 PerformanceObservers m_suspendedObservers; 183 PerformanceObservers m_suspendedObservers;
182 TaskRunnerTimer<PerformanceBase> m_deliverObservationsTimer; 184 TaskRunnerTimer<PerformanceBase> m_deliverObservationsTimer;
183 }; 185 };
184 186
185 } // namespace blink 187 } // namespace blink
186 188
187 #endif // PerformanceBase_h 189 #endif // PerformanceBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698