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

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

Issue 663693005: Use C++11 features in core/timing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed review. Created 6 years, 2 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
« no previous file with comments | « Source/core/timing/PerformanceUserTiming.h ('k') | Source/core/timing/ResourceTimingInfo.h » ('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 19 matching lines...) Expand all
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 "public/platform/Platform.h" 34 #include "public/platform/Platform.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 namespace { 38 namespace {
39 39
40 typedef HashMap<String, NavigationTimingFunction> RestrictedKeyMap; 40 using RestrictedKeyMap = HashMap<String, NavigationTimingFunction>;
41 static RestrictedKeyMap restrictedKeyMap() 41 static RestrictedKeyMap restrictedKeyMap()
42 { 42 {
43 DEFINE_STATIC_LOCAL(RestrictedKeyMap, map, ()); 43 DEFINE_STATIC_LOCAL(RestrictedKeyMap, map, ());
44 if (map.isEmpty()) { 44 if (map.isEmpty()) {
45 map.add("navigationStart", &PerformanceTiming::navigationStart); 45 map.add("navigationStart", &PerformanceTiming::navigationStart);
46 map.add("unloadEventStart", &PerformanceTiming::unloadEventStart); 46 map.add("unloadEventStart", &PerformanceTiming::unloadEventStart);
47 map.add("unloadEventEnd", &PerformanceTiming::unloadEventEnd); 47 map.add("unloadEventEnd", &PerformanceTiming::unloadEventEnd);
48 map.add("redirectStart", &PerformanceTiming::redirectStart); 48 map.add("redirectStart", &PerformanceTiming::redirectStart);
49 map.add("redirectEnd", &PerformanceTiming::redirectEnd); 49 map.add("redirectEnd", &PerformanceTiming::redirectEnd);
50 map.add("fetchStart", &PerformanceTiming::fetchStart); 50 map.add("fetchStart", &PerformanceTiming::fetchStart);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 void UserTiming::clearMeasures(const String& measureName) 162 void UserTiming::clearMeasures(const String& measureName)
163 { 163 {
164 clearPeformanceEntries(m_measuresMap, measureName); 164 clearPeformanceEntries(m_measuresMap, measureName);
165 } 165 }
166 166
167 static PerformanceEntryVector convertToEntrySequence(const PerformanceEntryMap& performanceEntryMap) 167 static PerformanceEntryVector convertToEntrySequence(const PerformanceEntryMap& performanceEntryMap)
168 { 168 {
169 PerformanceEntryVector entries; 169 PerformanceEntryVector entries;
170 170
171 for (PerformanceEntryMap::const_iterator it = performanceEntryMap.begin(); i t != performanceEntryMap.end(); ++it) 171 for (const auto& entry : performanceEntryMap)
172 entries.appendVector(it->value); 172 entries.appendVector(entry.value);
173 173
174 return entries; 174 return entries;
175 } 175 }
176 176
177 static PerformanceEntryVector getEntrySequenceByName(const PerformanceEntryMap& performanceEntryMap, const String& name) 177 static PerformanceEntryVector getEntrySequenceByName(const PerformanceEntryMap& performanceEntryMap, const String& name)
178 { 178 {
179 PerformanceEntryVector entries; 179 PerformanceEntryVector entries;
180 180
181 PerformanceEntryMap::const_iterator it = performanceEntryMap.find(name); 181 PerformanceEntryMap::const_iterator it = performanceEntryMap.find(name);
182 if (it != performanceEntryMap.end()) 182 if (it != performanceEntryMap.end())
(...skipping 25 matching lines...) Expand all
208 void UserTiming::trace(Visitor* visitor) 208 void UserTiming::trace(Visitor* visitor)
209 { 209 {
210 #if ENABLE(OILPAN) 210 #if ENABLE(OILPAN)
211 visitor->trace(m_performance); 211 visitor->trace(m_performance);
212 visitor->trace(m_marksMap); 212 visitor->trace(m_marksMap);
213 visitor->trace(m_measuresMap); 213 visitor->trace(m_measuresMap);
214 #endif 214 #endif
215 } 215 }
216 216
217 } // namespace blink 217 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/timing/PerformanceUserTiming.h ('k') | Source/core/timing/ResourceTimingInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698