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

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

Issue 1269633005: Code cleanup in core/timing/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | « no previous file | no next file » | 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } // namespace anonymous 77 } // namespace anonymous
78 78
79 UserTiming::UserTiming(PerformanceBase* performance) 79 UserTiming::UserTiming(PerformanceBase* performance)
80 : m_performance(performance) 80 : m_performance(performance)
81 { 81 {
82 } 82 }
83 83
84 static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, Per formanceEntry* entry) 84 static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, Per formanceEntry* entry)
85 { 85 {
86 PerformanceEntryMap::iterator it = performanceEntryMap.find(entry->name()); 86 PerformanceEntryMap::iterator it = performanceEntryMap.find(entry->name());
87 if (it != performanceEntryMap.end()) 87 if (it != performanceEntryMap.end()) {
88 it->value.append(entry); 88 it->value.append(entry);
89 else { 89 } else {
90 PerformanceEntryVector vector(1); 90 PerformanceEntryVector vector(1);
91 vector[0] = entry; 91 vector[0] = entry;
92 performanceEntryMap.set(entry->name(), vector); 92 performanceEntryMap.set(entry->name(), vector);
93 } 93 }
94 } 94 }
95 95
96 static void clearPeformanceEntries(PerformanceEntryMap& performanceEntryMap, con st String& name) 96 static void clearPeformanceEntries(PerformanceEntryMap& performanceEntryMap, con st String& name)
97 { 97 {
98 if (name.isNull()) { 98 if (name.isNull()) {
99 performanceEntryMap.clear(); 99 performanceEntryMap.clear();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 exceptionState.throwDOMException(SyntaxError, "The mark '" + markName + "' d oes not exist."); 139 exceptionState.throwDOMException(SyntaxError, "The mark '" + markName + "' d oes not exist.");
140 return 0.0; 140 return 0.0;
141 } 141 }
142 142
143 void UserTiming::measure(const String& measureName, const String& startMark, con st String& endMark, ExceptionState& exceptionState) 143 void UserTiming::measure(const String& measureName, const String& startMark, con st String& endMark, ExceptionState& exceptionState)
144 { 144 {
145 double startTime = 0.0; 145 double startTime = 0.0;
146 double endTime = 0.0; 146 double endTime = 0.0;
147 147
148 if (startMark.isNull()) 148 if (startMark.isNull()) {
149 endTime = m_performance->now(); 149 endTime = m_performance->now();
150 else if (endMark.isNull()) { 150 } else if (endMark.isNull()) {
151 endTime = m_performance->now(); 151 endTime = m_performance->now();
152 startTime = findExistingMarkStartTime(startMark, exceptionState); 152 startTime = findExistingMarkStartTime(startMark, exceptionState);
153 if (exceptionState.hadException()) 153 if (exceptionState.hadException())
154 return; 154 return;
155 } else { 155 } else {
156 endTime = findExistingMarkStartTime(endMark, exceptionState); 156 endTime = findExistingMarkStartTime(endMark, exceptionState);
157 if (exceptionState.hadException()) 157 if (exceptionState.hadException())
158 return; 158 return;
159 startTime = findExistingMarkStartTime(startMark, exceptionState); 159 startTime = findExistingMarkStartTime(startMark, exceptionState);
160 if (exceptionState.hadException()) 160 if (exceptionState.hadException())
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 DEFINE_TRACE(UserTiming) 224 DEFINE_TRACE(UserTiming)
225 { 225 {
226 visitor->trace(m_performance); 226 visitor->trace(m_performance);
227 visitor->trace(m_marksMap); 227 visitor->trace(m_marksMap);
228 visitor->trace(m_measuresMap); 228 visitor->trace(m_measuresMap);
229 } 229 }
230 230
231 } // namespace blink 231 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698