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

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

Issue 44453002: Remove HistogramSupport abstraction layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/rendering/RenderLayerStackingNode.cpp ('k') | Source/core/xml/XMLHttpRequest.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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/timing/PerformanceUserTiming.h" 27 #include "core/timing/PerformanceUserTiming.h"
28 28
29 #include "bindings/v8/ExceptionState.h" 29 #include "bindings/v8/ExceptionState.h"
30 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
31 #include "core/timing/Performance.h" 31 #include "core/timing/Performance.h"
32 #include "core/timing/PerformanceMark.h" 32 #include "core/timing/PerformanceMark.h"
33 #include "core/timing/PerformanceMeasure.h" 33 #include "core/timing/PerformanceMeasure.h"
34 #include "core/platform/HistogramSupport.h" 34 #include "public/platform/Platform.h"
35 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 namespace { 39 namespace {
40 40
41 typedef HashMap<String, NavigationTimingFunction> RestrictedKeyMap; 41 typedef HashMap<String, NavigationTimingFunction> RestrictedKeyMap;
42 static RestrictedKeyMap restrictedKeyMap() 42 static RestrictedKeyMap restrictedKeyMap()
43 { 43 {
44 DEFINE_STATIC_LOCAL(RestrictedKeyMap, map, ()); 44 DEFINE_STATIC_LOCAL(RestrictedKeyMap, map, ());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 void UserTiming::mark(const String& markName, ExceptionState& es) 102 void UserTiming::mark(const String& markName, ExceptionState& es)
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 es.throwDOMException(SyntaxError, "'" + markName + "' is part of the Per formanceTiming 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 HistogramSupport::histogramCustomCounts("PLT.UserTiming_Mark", static_cast<i nt>(startTime), 0, 600000, 100); 111 WebKit::Platform::current()->histogramCustomCounts("PLT.UserTiming_Mark", st atic_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& es)
120 { 120 {
121 if (m_marksMap.contains(markName)) 121 if (m_marksMap.contains(markName))
(...skipping 28 matching lines...) Expand all
150 endTime = findExistingMarkStartTime(endMark, es); 150 endTime = findExistingMarkStartTime(endMark, es);
151 if (es.hadException()) 151 if (es.hadException())
152 return; 152 return;
153 startTime = findExistingMarkStartTime(startMark, es); 153 startTime = findExistingMarkStartTime(startMark, es);
154 if (es.hadException()) 154 if (es.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 HistogramSupport::histogramCustomCounts("PLT.UserTiming_MeasureDuration" , static_cast<int>(endTime - startTime), 0, 600000, 100); 160 WebKit::Platform::current()->histogramCustomCounts("PLT.UserTiming_Measu reDuration", 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 {
165 clearPeformanceEntries(m_measuresMap, measureName); 165 clearPeformanceEntries(m_measuresMap, measureName);
166 } 166 }
167 167
168 static Vector<RefPtr<PerformanceEntry> > convertToEntrySequence(const Performanc eEntryMap& performanceEntryMap) 168 static Vector<RefPtr<PerformanceEntry> > convertToEntrySequence(const Performanc eEntryMap& performanceEntryMap)
169 { 169 {
170 Vector<RefPtr<PerformanceEntry> > entries; 170 Vector<RefPtr<PerformanceEntry> > entries;
(...skipping 29 matching lines...) Expand all
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/rendering/RenderLayerStackingNode.cpp ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698