| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of html; | 5 part of html; |
| 6 | 6 |
| 7 typedef Object ComputeValue(); | 7 typedef Object ComputeValue(); |
| 8 | 8 |
| 9 class _MeasurementRequest<T> { | 9 class _MeasurementRequest<T> { |
| 10 final ComputeValue computeValue; | 10 final ComputeValue computeValue; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 final completedRequests = _pendingRequests; | 180 final completedRequests = _pendingRequests; |
| 181 final readyMeasurementFrameCallbacks = _pendingMeasurementFrameCallbacks; | 181 final readyMeasurementFrameCallbacks = _pendingMeasurementFrameCallbacks; |
| 182 _pendingRequests = null; | 182 _pendingRequests = null; |
| 183 _pendingMeasurementFrameCallbacks = null; | 183 _pendingMeasurementFrameCallbacks = null; |
| 184 if (completedRequests != null) { | 184 if (completedRequests != null) { |
| 185 for (_MeasurementRequest request in completedRequests) { | 185 for (_MeasurementRequest request in completedRequests) { |
| 186 if (request.exception) { | 186 if (request.exception) { |
| 187 request.completer.completeException(request.value); | 187 request.completer.completeError(request.value); |
| 188 } else { | 188 } else { |
| 189 request.completer.complete(request.value); | 189 request.completer.complete(request.value); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 if (readyMeasurementFrameCallbacks != null) { | 194 if (readyMeasurementFrameCallbacks != null) { |
| 195 for (TimeoutHandler handler in readyMeasurementFrameCallbacks) { | 195 for (TimeoutHandler handler in readyMeasurementFrameCallbacks) { |
| 196 // TODO(jacobr): wrap each call to a handler in a try-catch block. | 196 // TODO(jacobr): wrap each call to a handler in a try-catch block. |
| 197 handler(); | 197 handler(); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 } | 200 } |
| OLD | NEW |