| OLD | NEW |
| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 WebKit::Platform::current()->histogramCustomCounts("PLT.UserTiming_Mark", st
atic_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& es) |
| 120 { | 120 { |
| 121 if (m_marksMap.contains(markName)) | 121 if (m_marksMap.contains(markName)) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 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 WebKit::Platform::current()->histogramCustomCounts("PLT.UserTiming_Measu
reDuration", 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 { |
| 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 Loading... |
| 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 |
| OLD | NEW |