| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 if (performanceEntryMap.contains(name)) | 95 if (performanceEntryMap.contains(name)) |
| 96 performanceEntryMap.remove(name); | 96 performanceEntryMap.remove(name); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void UserTiming::mark(const String& markName, ExceptionCode& ec) | 99 void UserTiming::mark(const String& markName, ExceptionCode& ec) |
| 100 { | 100 { |
| 101 ec = 0; | 101 ec = 0; |
| 102 if (restrictedKeyMap().contains(markName)) { | 102 if (restrictedKeyMap().contains(markName)) { |
| 103 ec = SYNTAX_ERR; | 103 ec = SyntaxError; |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 | 106 |
| 107 double startTime = m_performance->now(); | 107 double startTime = m_performance->now(); |
| 108 insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTi
me)); | 108 insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTi
me)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void UserTiming::clearMarks(const String& markName) | 111 void UserTiming::clearMarks(const String& markName) |
| 112 { | 112 { |
| 113 clearPeformanceEntries(m_marksMap, markName); | 113 clearPeformanceEntries(m_marksMap, markName); |
| 114 } | 114 } |
| 115 | 115 |
| 116 double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionCo
de& ec) | 116 double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionCo
de& ec) |
| 117 { | 117 { |
| 118 ec = 0; | 118 ec = 0; |
| 119 | 119 |
| 120 if (m_marksMap.contains(markName)) | 120 if (m_marksMap.contains(markName)) |
| 121 return m_marksMap.get(markName).last()->startTime(); | 121 return m_marksMap.get(markName).last()->startTime(); |
| 122 | 122 |
| 123 if (restrictedKeyMap().contains(markName)) { | 123 if (restrictedKeyMap().contains(markName)) { |
| 124 double value = static_cast<double>((m_performance->timing()->*(restricte
dKeyMap().get(markName)))()); | 124 double value = static_cast<double>((m_performance->timing()->*(restricte
dKeyMap().get(markName)))()); |
| 125 if (!value) { | 125 if (!value) { |
| 126 ec = INVALID_ACCESS_ERR; | 126 ec = InvalidAccessError; |
| 127 return 0.0; | 127 return 0.0; |
| 128 } | 128 } |
| 129 return value - m_performance->timing()->navigationStart(); | 129 return value - m_performance->timing()->navigationStart(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 ec = SYNTAX_ERR; | 132 ec = SyntaxError; |
| 133 return 0.0; | 133 return 0.0; |
| 134 } | 134 } |
| 135 | 135 |
| 136 void UserTiming::measure(const String& measureName, const String& startMark, con
st String& endMark, ExceptionCode& ec) | 136 void UserTiming::measure(const String& measureName, const String& startMark, con
st String& endMark, ExceptionCode& ec) |
| 137 { | 137 { |
| 138 double startTime = 0.0; | 138 double startTime = 0.0; |
| 139 double endTime = 0.0; | 139 double endTime = 0.0; |
| 140 | 140 |
| 141 if (startMark.isNull()) | 141 if (startMark.isNull()) |
| 142 endTime = m_performance->now(); | 142 endTime = m_performance->now(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 { | 197 { |
| 198 return convertToEntrySequence(m_measuresMap); | 198 return convertToEntrySequence(m_measuresMap); |
| 199 } | 199 } |
| 200 | 200 |
| 201 Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) co
nst | 201 Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) co
nst |
| 202 { | 202 { |
| 203 return getEntrySequenceByName(m_measuresMap, name); | 203 return getEntrySequenceByName(m_measuresMap, name); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace WebCore | 206 } // namespace WebCore |
| OLD | NEW |