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 bool _load() native "LibraryPrefix_load"; | 10 bool _load() native "LibraryPrefix_load"; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 // A list of two element lists. The first element is the _LibraryPrefix. The | 45 // A list of two element lists. The first element is the _LibraryPrefix. The |
46 // second element is the Completer for the load request. | 46 // second element is the Completer for the load request. |
47 var _outstandingLoadRequests = new List<List>(); | 47 var _outstandingLoadRequests = new List<List>(); |
48 | 48 |
49 // Called from the VM when all outstanding load requests have | 49 // Called from the VM when all outstanding load requests have |
50 // finished. | 50 // finished. |
51 _completeDeferredLoads() { | 51 _completeDeferredLoads() { |
52 var stillOutstandingLoadRequests = new List<List>(); | |
turnidge
2016/06/03 17:50:25
Comment?
| |
52 for (int i = 0; i < _outstandingLoadRequests.length; i++) { | 53 for (int i = 0; i < _outstandingLoadRequests.length; i++) { |
53 var prefix = _outstandingLoadRequests[i][0]; | 54 var prefix = _outstandingLoadRequests[i][0]; |
54 var completer = _outstandingLoadRequests[i][1]; | 55 if (prefix._load()) { |
55 var error = prefix._loadError(); | 56 var completer = _outstandingLoadRequests[i][1]; |
56 if (error != null) { | 57 var error = prefix._loadError(); |
57 completer.completeError(error); | 58 if (error != null) { |
59 completer.completeError(error); | |
60 } else { | |
61 prefix._invalidateDependentCode(); | |
62 completer.complete(true); | |
63 } | |
58 } else { | 64 } else { |
59 prefix._invalidateDependentCode(); | 65 stillOutstandingLoadRequests.add(_outstandingLoadRequests[i]); |
60 completer.complete(true); | |
61 } | 66 } |
62 } | 67 } |
63 _outstandingLoadRequests.clear(); | 68 _outstandingLoadRequests = stillOutstandingLoadRequests; |
64 } | 69 } |
OLD | NEW |