Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: runtime/lib/lib_prefix.dart

Issue 419103003: Handle load errors in deferred code (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/lib/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13
13 bool _invalidateDependentCode() 14 bool _invalidateDependentCode()
14 native "LibraryPrefix_invalidateDependentCode"; 15 native "LibraryPrefix_invalidateDependentCode";
15 16
16 loadLibrary() { 17 loadLibrary() {
17 var completer = _outstandingLoadRequests[this]; 18 var completer = _outstandingLoadRequests[this];
18 if (completer != null) { 19 if (completer != null) {
19 return completer.future; 20 return completer.future;
20 } 21 }
21 completer = new Completer<bool>(); 22 completer = new Completer<bool>();
(...skipping 14 matching lines...) Expand all
36 return completer.future; 37 return completer.future;
37 } 38 }
38 } 39 }
39 40
40 var _outstandingLoadRequests = new Map<_LibraryPrefix, Completer>(); 41 var _outstandingLoadRequests = new Map<_LibraryPrefix, Completer>();
41 42
42 43
43 // Called from the VM when all outstanding load requests have 44 // Called from the VM when all outstanding load requests have
44 // finished. 45 // finished.
45 _completeDeferredLoads() { 46 _completeDeferredLoads() {
46 var lenghth = _outstandingLoadRequests;
47 _outstandingLoadRequests.forEach((prefix, completer) { 47 _outstandingLoadRequests.forEach((prefix, completer) {
48 prefix._invalidateDependentCode(); 48 var error = prefix._loadError();
49 completer.complete(true); 49 if (error != null) {
50 completer.completeError(error);
51 } else {
52 prefix._invalidateDependentCode();
53 completer.complete(true);
54 }
50 }); 55 });
51 _outstandingLoadRequests.clear(); 56 _outstandingLoadRequests.clear();
52 } 57 }
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/lib/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698