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 import "dart:async"; | 5 import "dart:async"; |
6 import "dart:isolate"; | 6 import "dart:isolate"; |
7 | 7 |
8 // This type corresponds to the VM-internal class LibraryPrefix. | 8 // This type corresponds to the VM-internal class LibraryPrefix. |
9 class _LibraryPrefix { | 9 class _LibraryPrefix { |
10 | 10 |
11 bool _load() native "LibraryPrefix_load"; | 11 bool _load() native "LibraryPrefix_load"; |
12 Error _loadError() native "LibraryPrefix_loadError"; | 12 Error _loadError() native "LibraryPrefix_loadError"; |
| 13 bool isLoaded() native "LibraryPrefix_isLoaded"; |
13 | 14 |
14 bool _invalidateDependentCode() | 15 bool _invalidateDependentCode() |
15 native "LibraryPrefix_invalidateDependentCode"; | 16 native "LibraryPrefix_invalidateDependentCode"; |
16 | 17 |
17 loadLibrary() { | 18 loadLibrary() { |
18 var completer = _outstandingLoadRequests[this]; | 19 var completer = _outstandingLoadRequests[this]; |
19 if (completer != null) { | 20 if (completer != null) { |
20 return completer.future; | 21 return completer.future; |
21 } | 22 } |
22 completer = new Completer<bool>(); | 23 completer = new Completer<bool>(); |
(...skipping 25 matching lines...) Expand all Loading... |
48 var error = prefix._loadError(); | 49 var error = prefix._loadError(); |
49 if (error != null) { | 50 if (error != null) { |
50 completer.completeError(error); | 51 completer.completeError(error); |
51 } else { | 52 } else { |
52 prefix._invalidateDependentCode(); | 53 prefix._invalidateDependentCode(); |
53 completer.complete(true); | 54 completer.complete(true); |
54 } | 55 } |
55 }); | 56 }); |
56 _outstandingLoadRequests.clear(); | 57 _outstandingLoadRequests.clear(); |
57 } | 58 } |
OLD | NEW |