Chromium Code Reviews| 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"; |
| 11 Error _loadError() native "LibraryPrefix_loadError"; | 11 Error _loadError() native "LibraryPrefix_loadError"; |
| 12 bool isLoaded() native "LibraryPrefix_isLoaded"; | 12 bool isLoaded() native "LibraryPrefix_isLoaded"; |
| 13 bool hasError() native "LibraryPrefix_hasError"; | |
| 13 bool _invalidateDependentCode() | 14 bool _invalidateDependentCode() |
| 14 native "LibraryPrefix_invalidateDependentCode"; | 15 native "LibraryPrefix_invalidateDependentCode"; |
| 15 | 16 |
| 16 loadLibrary() { | 17 loadLibrary() { |
| 17 for (int i = 0; i < _outstandingLoadRequests.length; i++) { | 18 for (int i = 0; i < _outstandingLoadRequests.length; i++) { |
| 18 if (_outstandingLoadRequests[i][0] == this) { | 19 if (_outstandingLoadRequests[i][0] == this) { |
| 19 return _outstandingLoadRequests[i][1].future; | 20 return _outstandingLoadRequests[i][1].future; |
| 20 } | 21 } |
| 21 } | 22 } |
| 22 | 23 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 48 | 49 |
| 49 // Called from the VM when an outstanding load request has finished. | 50 // Called from the VM when an outstanding load request has finished. |
| 50 _completeDeferredLoads() { | 51 _completeDeferredLoads() { |
| 51 // Determine which outstanding load requests have completed and complete | 52 // Determine which outstanding load requests have completed and complete |
| 52 // their completer (with an error or true). For outstanding load requests | 53 // their completer (with an error or true). For outstanding load requests |
| 53 // which have not completed, remember them for next time in | 54 // which have not completed, remember them for next time in |
| 54 // stillOutstandingLoadRequests. | 55 // stillOutstandingLoadRequests. |
| 55 var stillOutstandingLoadRequests = new List<List>(); | 56 var stillOutstandingLoadRequests = new List<List>(); |
| 56 for (int i = 0; i < _outstandingLoadRequests.length; i++) { | 57 for (int i = 0; i < _outstandingLoadRequests.length; i++) { |
| 57 var prefix = _outstandingLoadRequests[i][0]; | 58 var prefix = _outstandingLoadRequests[i][0]; |
| 58 if (prefix._load()) { | 59 var completer = _outstandingLoadRequests[i][1]; |
| 59 var completer = _outstandingLoadRequests[i][1]; | 60 if (prefix.hasError()) { |
|
hausner
2016/06/07 21:47:05
I think you should use prefix._loadError() to dete
Cutch
2016/06/07 22:29:26
Done.
| |
| 60 var error = prefix._loadError(); | 61 var error = prefix._loadError(); |
| 61 if (error != null) { | 62 assert(error != null); |
| 62 completer.completeError(error); | 63 completer.completeError(error); |
| 63 } else { | 64 } else if (prefix._load()) { |
| 64 prefix._invalidateDependentCode(); | 65 prefix._invalidateDependentCode(); |
| 65 completer.complete(true); | 66 completer.complete(true); |
| 66 } | |
| 67 } else { | 67 } else { |
| 68 stillOutstandingLoadRequests.add(_outstandingLoadRequests[i]); | 68 stillOutstandingLoadRequests.add(_outstandingLoadRequests[i]); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 _outstandingLoadRequests = stillOutstandingLoadRequests; | 71 _outstandingLoadRequests = stillOutstandingLoadRequests; |
| 72 } | 72 } |
| OLD | NEW |