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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 // Called from the VM when an outstanding load request has finished. | 49 // Called from the VM when an outstanding load request has finished. |
50 _completeDeferredLoads() { | 50 _completeDeferredLoads() { |
51 // Determine which outstanding load requests have completed and complete | 51 // Determine which outstanding load requests have completed and complete |
52 // their completer (with an error or true). For outstanding load requests | 52 // their completer (with an error or true). For outstanding load requests |
53 // which have not completed, remember them for next time in | 53 // which have not completed, remember them for next time in |
54 // stillOutstandingLoadRequests. | 54 // stillOutstandingLoadRequests. |
55 var stillOutstandingLoadRequests = new List<List>(); | 55 var stillOutstandingLoadRequests = new List<List>(); |
56 for (int i = 0; i < _outstandingLoadRequests.length; i++) { | 56 for (int i = 0; i < _outstandingLoadRequests.length; i++) { |
57 var prefix = _outstandingLoadRequests[i][0]; | 57 var prefix = _outstandingLoadRequests[i][0]; |
58 if (prefix._load()) { | 58 var completer = _outstandingLoadRequests[i][1]; |
59 var completer = _outstandingLoadRequests[i][1]; | 59 var error = prefix._loadError(); |
60 var error = prefix._loadError(); | 60 if (error != null) { |
61 if (error != null) { | 61 completer.completeError(error); |
62 completer.completeError(error); | 62 } else if (prefix._load()) { |
63 } else { | 63 prefix._invalidateDependentCode(); |
64 prefix._invalidateDependentCode(); | 64 completer.complete(true); |
65 completer.complete(true); | |
66 } | |
67 } else { | 65 } else { |
68 stillOutstandingLoadRequests.add(_outstandingLoadRequests[i]); | 66 stillOutstandingLoadRequests.add(_outstandingLoadRequests[i]); |
69 } | 67 } |
70 } | 68 } |
71 _outstandingLoadRequests = stillOutstandingLoadRequests; | 69 _outstandingLoadRequests = stillOutstandingLoadRequests; |
72 } | 70 } |
OLD | NEW |