OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart core library. | 5 // Dart core library. |
6 | 6 |
7 class PromiseImpl<T> implements Promise<T> { | 7 class PromiseImpl<T> implements Promise<T> { |
8 | 8 |
9 // Enumeration of possible states: | 9 // Enumeration of possible states: |
10 static final int CREATED = 0; | 10 static final int CREATED = 0; |
(...skipping 27 matching lines...) Expand all Loading... |
38 Queue<Function> _cancelListeners; | 38 Queue<Function> _cancelListeners; |
39 | 39 |
40 PromiseImpl() | 40 PromiseImpl() |
41 : _state = CREATED, | 41 : _state = CREATED, |
42 _value = null, | 42 _value = null, |
43 _error = null, | 43 _error = null, |
44 _normalListeners = null, | 44 _normalListeners = null, |
45 _errorListeners = null, | 45 _errorListeners = null, |
46 _cancelListeners = null {} | 46 _cancelListeners = null {} |
47 | 47 |
48 PromiseImpl.fromValue(val) | 48 PromiseImpl.fromValue(T val) |
49 : _state = COMPLETE_NORMAL, | 49 : _state = COMPLETE_NORMAL, |
50 _value = val, | 50 _value = val, |
51 _error = null, | 51 _error = null, |
52 _normalListeners = null, | 52 _normalListeners = null, |
53 _errorListeners = null, | 53 _errorListeners = null, |
54 _cancelListeners = null {} | 54 _cancelListeners = null {} |
55 | 55 |
56 // Properties and methods from Promise: | 56 // Properties and methods from Promise: |
57 | 57 |
58 T get value() { | 58 T get value() { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 } | 370 } |
371 } | 371 } |
372 return process(marshalled); | 372 return process(marshalled); |
373 }).flatten(); | 373 }).flatten(); |
374 } | 374 } |
375 | 375 |
376 Promise<SendPort> _promise; | 376 Promise<SendPort> _promise; |
377 static Map<SendPort, Dispatcher> _dispatchers; | 377 static Map<SendPort, Dispatcher> _dispatchers; |
378 | 378 |
379 } | 379 } |
OLD | NEW |