| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.generated.utilities_general; | 5 library analyzer.src.generated.utilities_general; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:developer' show UserTag; | 8 import 'dart:developer' show UserTag; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 /** | 139 /** |
| 140 * Make this the current tag for the isolate, and return the previous tag. | 140 * Make this the current tag for the isolate, and return the previous tag. |
| 141 */ | 141 */ |
| 142 PerformanceTag makeCurrent(); | 142 PerformanceTag makeCurrent(); |
| 143 | 143 |
| 144 /** | 144 /** |
| 145 * Make this the current tag for the isolate, run [f], and restore the | 145 * Make this the current tag for the isolate, run [f], and restore the |
| 146 * previous tag. Returns the result of invoking [f]. | 146 * previous tag. Returns the result of invoking [f]. |
| 147 */ | 147 */ |
| 148 makeCurrentWhile(f()); | 148 dynamic/*=E*/ makeCurrentWhile/*<E>*/(dynamic/*=E*/ f()); |
| 149 | 149 |
| 150 /** | 150 /** |
| 151 * Reset the total time tracked by all [PerformanceTag]s to zero. | 151 * Reset the total time tracked by all [PerformanceTag]s to zero. |
| 152 */ | 152 */ |
| 153 static void reset() { | 153 static void reset() { |
| 154 for (_PerformanceTagImpl tag in _PerformanceTagImpl.all) { | 154 for (_PerformanceTagImpl tag in _PerformanceTagImpl.all) { |
| 155 tag.stopwatch.reset(); | 155 tag.stopwatch.reset(); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 } | 158 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return current; | 199 return current; |
| 200 } | 200 } |
| 201 _PerformanceTagImpl previous = current; | 201 _PerformanceTagImpl previous = current; |
| 202 previous.stopwatch.stop(); | 202 previous.stopwatch.stop(); |
| 203 stopwatch.start(); | 203 stopwatch.start(); |
| 204 current = this; | 204 current = this; |
| 205 userTag.makeCurrent(); | 205 userTag.makeCurrent(); |
| 206 return previous; | 206 return previous; |
| 207 } | 207 } |
| 208 | 208 |
| 209 makeCurrentWhile(f()) { | 209 dynamic/*=E*/ makeCurrentWhile/*<E>*/(dynamic/*=E*/ f()) { |
| 210 PerformanceTag prevTag = makeCurrent(); | 210 PerformanceTag prevTag = makeCurrent(); |
| 211 try { | 211 try { |
| 212 return f(); | 212 return f(); |
| 213 } finally { | 213 } finally { |
| 214 prevTag.makeCurrent(); | 214 prevTag.makeCurrent(); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 } | 217 } |
| OLD | NEW |