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

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

Issue 14246023: Unprefix User Timing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix tests Created 7 years, 8 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/Performance.h ('k') | Source/core/page/Performance.idl » ('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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 PerformanceTiming* Performance::timing() const 89 PerformanceTiming* Performance::timing() const
90 { 90 {
91 if (!m_timing) 91 if (!m_timing)
92 m_timing = PerformanceTiming::create(m_frame); 92 m_timing = PerformanceTiming::create(m_frame);
93 93
94 return m_timing.get(); 94 return m_timing.get();
95 } 95 }
96 96
97 Vector<RefPtr<PerformanceEntry> > Performance::webkitGetEntries() const 97 Vector<RefPtr<PerformanceEntry> > Performance::getEntries() const
98 { 98 {
99 Vector<RefPtr<PerformanceEntry> > entries; 99 Vector<RefPtr<PerformanceEntry> > entries;
100 100
101 entries.append(m_resourceTimingBuffer); 101 entries.append(m_resourceTimingBuffer);
102 102
103 if (m_userTiming) { 103 if (m_userTiming) {
104 entries.append(m_userTiming->getMarks()); 104 entries.append(m_userTiming->getMarks());
105 entries.append(m_userTiming->getMeasures()); 105 entries.append(m_userTiming->getMeasures());
106 } 106 }
107 107
108 std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompare LessThan); 108 std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompare LessThan);
109 return entries; 109 return entries;
110 } 110 }
111 111
112 Vector<RefPtr<PerformanceEntry> > Performance::webkitGetEntriesByType(const Stri ng& entryType) 112 Vector<RefPtr<PerformanceEntry> > Performance::getEntriesByType(const String& en tryType)
113 { 113 {
114 Vector<RefPtr<PerformanceEntry> > entries; 114 Vector<RefPtr<PerformanceEntry> > entries;
115 115
116 if (equalIgnoringCase(entryType, "resource")) 116 if (equalIgnoringCase(entryType, "resource"))
117 for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_reso urceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource) 117 for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_reso urceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
118 entries.append(*resource); 118 entries.append(*resource);
119 119
120 if (m_userTiming) { 120 if (m_userTiming) {
121 if (equalIgnoringCase(entryType, "mark")) 121 if (equalIgnoringCase(entryType, "mark"))
122 entries.append(m_userTiming->getMarks()); 122 entries.append(m_userTiming->getMarks());
123 else if (equalIgnoringCase(entryType, "measure")) 123 else if (equalIgnoringCase(entryType, "measure"))
124 entries.append(m_userTiming->getMeasures()); 124 entries.append(m_userTiming->getMeasures());
125 } 125 }
126 126
127 std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompare LessThan); 127 std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompare LessThan);
128 return entries; 128 return entries;
129 } 129 }
130 130
131 Vector<RefPtr<PerformanceEntry> > Performance::webkitGetEntriesByName(const Stri ng& name, const String& entryType) 131 Vector<RefPtr<PerformanceEntry> > Performance::getEntriesByName(const String& na me, const String& entryType)
132 { 132 {
133 Vector<RefPtr<PerformanceEntry> > entries; 133 Vector<RefPtr<PerformanceEntry> > entries;
134 134
135 if (entryType.isNull() || equalIgnoringCase(entryType, "resource")) 135 if (entryType.isNull() || equalIgnoringCase(entryType, "resource"))
136 for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_reso urceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource) 136 for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_reso urceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
137 if ((*resource)->name() == name) 137 if ((*resource)->name() == name)
138 entries.append(*resource); 138 entries.append(*resource);
139 139
140 if (m_userTiming) { 140 if (m_userTiming) {
141 if (entryType.isNull() || equalIgnoringCase(entryType, "mark")) 141 if (entryType.isNull() || equalIgnoringCase(entryType, "mark"))
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 EventTargetData* Performance::eventTargetData() 181 EventTargetData* Performance::eventTargetData()
182 { 182 {
183 return &m_eventTargetData; 183 return &m_eventTargetData;
184 } 184 }
185 185
186 EventTargetData* Performance::ensureEventTargetData() 186 EventTargetData* Performance::ensureEventTargetData()
187 { 187 {
188 return &m_eventTargetData; 188 return &m_eventTargetData;
189 } 189 }
190 190
191 void Performance::webkitMark(const String& markName, ExceptionCode& ec) 191 void Performance::mark(const String& markName, ExceptionCode& ec)
192 { 192 {
193 ec = 0; 193 ec = 0;
194 if (!m_userTiming) 194 if (!m_userTiming)
195 m_userTiming = UserTiming::create(this); 195 m_userTiming = UserTiming::create(this);
196 m_userTiming->mark(markName, ec); 196 m_userTiming->mark(markName, ec);
197 } 197 }
198 198
199 void Performance::webkitClearMarks(const String& markName) 199 void Performance::clearMarks(const String& markName)
200 { 200 {
201 if (!m_userTiming) 201 if (!m_userTiming)
202 m_userTiming = UserTiming::create(this); 202 m_userTiming = UserTiming::create(this);
203 m_userTiming->clearMarks(markName); 203 m_userTiming->clearMarks(markName);
204 } 204 }
205 205
206 void Performance::webkitMeasure(const String& measureName, const String& startMa rk, const String& endMark, ExceptionCode& ec) 206 void Performance::measure(const String& measureName, const String& startMark, co nst String& endMark, ExceptionCode& ec)
207 { 207 {
208 ec = 0; 208 ec = 0;
209 if (!m_userTiming) 209 if (!m_userTiming)
210 m_userTiming = UserTiming::create(this); 210 m_userTiming = UserTiming::create(this);
211 m_userTiming->measure(measureName, startMark, endMark, ec); 211 m_userTiming->measure(measureName, startMark, endMark, ec);
212 } 212 }
213 213
214 void Performance::webkitClearMeasures(const String& measureName) 214 void Performance::clearMeasures(const String& measureName)
215 { 215 {
216 if (!m_userTiming) 216 if (!m_userTiming)
217 m_userTiming = UserTiming::create(this); 217 m_userTiming = UserTiming::create(this);
218 m_userTiming->clearMeasures(measureName); 218 m_userTiming->clearMeasures(measureName);
219 } 219 }
220 220
221 double Performance::now() const 221 double Performance::now() const
222 { 222 {
223 return 1000.0 * m_frame->document()->loader()->timing()->monotonicTimeToZero BasedDocumentTime(monotonicallyIncreasingTime()); 223 return 1000.0 * m_frame->document()->loader()->timing()->monotonicTimeToZero BasedDocumentTime(monotonicallyIncreasingTime());
224 } 224 }
225 225
226 } // namespace WebCore 226 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/Performance.h ('k') | Source/core/page/Performance.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698