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

Unified Diff: runtime/bin/builtin.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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/builtin_natives.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin.dart
===================================================================
--- runtime/bin/builtin.dart (revision 38794)
+++ runtime/bin/builtin.dart (working copy)
@@ -108,7 +108,7 @@
}
-void _httpGet(Uri uri, loadCallback(List<int> data)) {
+void _httpGet(Uri uri, String libraryUri, loadCallback(List<int> data)) {
var httpClient = new HttpClient();
try {
httpClient.getUrl(uri)
@@ -125,7 +125,7 @@
if (response.statusCode != 200) {
var msg = 'Failure getting $uri: '
'${response.statusCode} ${response.reasonPhrase}';
- _asyncLoadError(uri.toString(), msg);
+ _asyncLoadError(uri.toString(), libraryUri, msg);
}
List<int> data = builder.takeBytes();
@@ -133,14 +133,14 @@
loadCallback(data);
},
onError: (error) {
- _asyncLoadError(uri.toString(), error);
+ _asyncLoadError(uri.toString(), libraryUri, error);
});
})
.catchError((error) {
- _asyncLoadError(uri.toString(), error);
+ _asyncLoadError(uri.toString(), libraryUri, error);
});
} catch (error) {
- _asyncLoadError(uri.toString(), error);
+ _asyncLoadError(uri.toString(), libraryUri, error);
}
// TODO(floitsch): remove this line. It's just here to push an event on the
// event loop so that we invoke the scheduled microtasks. Also remove the
@@ -329,12 +329,17 @@
}
-void _asyncLoadErrorCallback(uri, error) native "Builtin_AsyncLoadError";
+void _asyncLoadErrorCallback(uri, libraryUri, error)
+ native "Builtin_AsyncLoadError";
-void _asyncLoadError(uri, error) {
+void _asyncLoadError(uri, libraryUri, error) {
assert(_numOutstandingLoadRequests > 0);
+ _logResolution("_asyncLoadError($uri), error: $error");
_numOutstandingLoadRequests--;
- _asyncLoadErrorCallback(uri, error);
+ _asyncLoadErrorCallback(uri, libraryUri, error);
+ if (_numOutstandingLoadRequests == 0) {
+ _signalDoneLoading();
+ }
}
@@ -347,7 +352,7 @@
_logResolution("_loadDataAsync($uri), "
"${_numOutstandingLoadRequests} requests outstanding");
if (sourceUri.scheme == 'http') {
- _httpGet(sourceUri, (data) {
+ _httpGet(sourceUri, null, (data) {
_loadScript(uri, data);
});
} else {
@@ -356,7 +361,7 @@
_loadScript(uri, data);
},
onError: (e) {
- _asyncLoadError(uri, e);
+ _asyncLoadError(uri, null, e);
});
}
}
@@ -388,7 +393,7 @@
_logResolution("_loadLibrarySource($uri), "
"${_numOutstandingLoadRequests} requests outstanding");
if (sourceUri.scheme == 'http') {
- _httpGet(sourceUri, (data) {
+ _httpGet(sourceUri, libraryUri, (data) {
var text = UTF8.decode(data);
_loadLibrarySource(tag, uri, libraryUri, text);
});
@@ -398,7 +403,7 @@
_loadLibrarySource(tag, uri, libraryUri, text);
},
onError: (e) {
- _asyncLoadError(uri, e);
+ _asyncLoadError(uri, libraryUri, e);
});
}
}
« no previous file with comments | « no previous file | runtime/bin/builtin_natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698