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 | 12 |
13 void _invalidateDependentCode() | 13 bool _invalidateDependentCode() |
14 native "LibraryPrefix_invalidateDependentCode"; | 14 native "LibraryPrefix_invalidateDependentCode"; |
15 | 15 |
16 loadLibrary() { | 16 loadLibrary() { |
17 var completer = _outstandingLoadRequests[this]; | 17 var completer = _outstandingLoadRequests[this]; |
18 if (completer != null) { | 18 if (completer != null) { |
19 return completer.future; | 19 return completer.future; |
20 } | 20 } |
21 completer = new Completer<bool>(); | 21 completer = new Completer<bool>(); |
22 _outstandingLoadRequests[this] = completer; | 22 _outstandingLoadRequests[this] = completer; |
23 Timer.run(() { | 23 Timer.run(() { |
(...skipping 19 matching lines...) Expand all Loading... |
43 // Called from the VM when all outstanding load requests have | 43 // Called from the VM when all outstanding load requests have |
44 // finished. | 44 // finished. |
45 _completeDeferredLoads() { | 45 _completeDeferredLoads() { |
46 var lenghth = _outstandingLoadRequests; | 46 var lenghth = _outstandingLoadRequests; |
47 _outstandingLoadRequests.forEach((prefix, completer) { | 47 _outstandingLoadRequests.forEach((prefix, completer) { |
48 prefix._invalidateDependentCode(); | 48 prefix._invalidateDependentCode(); |
49 completer.complete(true); | 49 completer.complete(true); |
50 }); | 50 }); |
51 _outstandingLoadRequests.clear(); | 51 _outstandingLoadRequests.clear(); |
52 } | 52 } |
OLD | NEW |