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

Side by Side Diff: Source/core/timing/PerformanceUserTiming.cpp

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month 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/timing/Performance.cpp ('k') | Source/core/workers/AbstractWorker.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) 2012 Intel Inc. All rights reserved. 2 * Copyright (C) 2012 Intel Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 { 92 {
93 if (name.isNull()) { 93 if (name.isNull()) {
94 performanceEntryMap.clear(); 94 performanceEntryMap.clear();
95 return; 95 return;
96 } 96 }
97 97
98 if (performanceEntryMap.contains(name)) 98 if (performanceEntryMap.contains(name))
99 performanceEntryMap.remove(name); 99 performanceEntryMap.remove(name);
100 } 100 }
101 101
102 void UserTiming::mark(const String& markName, ExceptionState& es) 102 void UserTiming::mark(const String& markName, ExceptionState& exceptionState)
103 { 103 {
104 if (restrictedKeyMap().contains(markName)) { 104 if (restrictedKeyMap().contains(markName)) {
105 es.throwDOMException(SyntaxError, "'" + markName + "' is part of the Per formanceTiming interface, and cannot be used as a mark name."); 105 exceptionState.throwDOMException(SyntaxError, "'" + markName + "' is par t of the PerformanceTiming interface, and cannot be used as a mark name.");
106 return; 106 return;
107 } 107 }
108 108
109 double startTime = m_performance->now(); 109 double startTime = m_performance->now();
110 insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTi me)); 110 insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTi me));
111 blink::Platform::current()->histogramCustomCounts("PLT.UserTiming_Mark", sta tic_cast<int>(startTime), 0, 600000, 100); 111 blink::Platform::current()->histogramCustomCounts("PLT.UserTiming_Mark", sta tic_cast<int>(startTime), 0, 600000, 100);
112 } 112 }
113 113
114 void UserTiming::clearMarks(const String& markName) 114 void UserTiming::clearMarks(const String& markName)
115 { 115 {
116 clearPeformanceEntries(m_marksMap, markName); 116 clearPeformanceEntries(m_marksMap, markName);
117 } 117 }
118 118
119 double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionSt ate& es) 119 double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionSt ate& exceptionState)
120 { 120 {
121 if (m_marksMap.contains(markName)) 121 if (m_marksMap.contains(markName))
122 return m_marksMap.get(markName).last()->startTime(); 122 return m_marksMap.get(markName).last()->startTime();
123 123
124 if (restrictedKeyMap().contains(markName)) { 124 if (restrictedKeyMap().contains(markName)) {
125 double value = static_cast<double>((m_performance->timing()->*(restricte dKeyMap().get(markName)))()); 125 double value = static_cast<double>((m_performance->timing()->*(restricte dKeyMap().get(markName)))());
126 if (!value) { 126 if (!value) {
127 es.throwDOMException(InvalidAccessError, "'" + markName + "' is empt y: either the event hasn't happened yet, or it would provide cross-origin timing information."); 127 exceptionState.throwDOMException(InvalidAccessError, "'" + markName + "' is empty: either the event hasn't happened yet, or it would provide cross-o rigin timing information.");
128 return 0.0; 128 return 0.0;
129 } 129 }
130 return value - m_performance->timing()->navigationStart(); 130 return value - m_performance->timing()->navigationStart();
131 } 131 }
132 132
133 es.throwDOMException(SyntaxError, "The mark '" + markName + "' does not exis t."); 133 exceptionState.throwDOMException(SyntaxError, "The mark '" + markName + "' d oes not exist.");
134 return 0.0; 134 return 0.0;
135 } 135 }
136 136
137 void UserTiming::measure(const String& measureName, const String& startMark, con st String& endMark, ExceptionState& es) 137 void UserTiming::measure(const String& measureName, const String& startMark, con st String& endMark, ExceptionState& exceptionState)
138 { 138 {
139 double startTime = 0.0; 139 double startTime = 0.0;
140 double endTime = 0.0; 140 double endTime = 0.0;
141 141
142 if (startMark.isNull()) 142 if (startMark.isNull())
143 endTime = m_performance->now(); 143 endTime = m_performance->now();
144 else if (endMark.isNull()) { 144 else if (endMark.isNull()) {
145 endTime = m_performance->now(); 145 endTime = m_performance->now();
146 startTime = findExistingMarkStartTime(startMark, es); 146 startTime = findExistingMarkStartTime(startMark, exceptionState);
147 if (es.hadException()) 147 if (exceptionState.hadException())
148 return; 148 return;
149 } else { 149 } else {
150 endTime = findExistingMarkStartTime(endMark, es); 150 endTime = findExistingMarkStartTime(endMark, exceptionState);
151 if (es.hadException()) 151 if (exceptionState.hadException())
152 return; 152 return;
153 startTime = findExistingMarkStartTime(startMark, es); 153 startTime = findExistingMarkStartTime(startMark, exceptionState);
154 if (es.hadException()) 154 if (exceptionState.hadException())
155 return; 155 return;
156 } 156 }
157 157
158 insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName , startTime, endTime)); 158 insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName , startTime, endTime));
159 if (endTime >= startTime) 159 if (endTime >= startTime)
160 blink::Platform::current()->histogramCustomCounts("PLT.UserTiming_Measur eDuration", static_cast<int>(endTime - startTime), 0, 600000, 100); 160 blink::Platform::current()->histogramCustomCounts("PLT.UserTiming_Measur eDuration", static_cast<int>(endTime - startTime), 0, 600000, 100);
161 } 161 }
162 162
163 void UserTiming::clearMeasures(const String& measureName) 163 void UserTiming::clearMeasures(const String& measureName)
164 { 164 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 { 200 {
201 return convertToEntrySequence(m_measuresMap); 201 return convertToEntrySequence(m_measuresMap);
202 } 202 }
203 203
204 Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) co nst 204 Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) co nst
205 { 205 {
206 return getEntrySequenceByName(m_measuresMap, name); 206 return getEntrySequenceByName(m_measuresMap, name);
207 } 207 }
208 208
209 } // namespace WebCore 209 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/timing/Performance.cpp ('k') | Source/core/workers/AbstractWorker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698