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

Unified Diff: runtime/bin/vmservice/loader.dart

Issue 2186423002: Only reload libraries when they may have been modified. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Code review Created 4 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 | « runtime/bin/main.cc ('k') | runtime/bin/vmservice_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/loader.dart
diff --git a/runtime/bin/vmservice/loader.dart b/runtime/bin/vmservice/loader.dart
index 7686f1c41f37d0d3307caeb4786fdad59525ad6b..389c665f979d2fbb28c0cf4ac0b2c98bf20bbc3c 100644
--- a/runtime/bin/vmservice/loader.dart
+++ b/runtime/bin/vmservice/loader.dart
@@ -319,10 +319,11 @@ var _httpClient;
void _sendResourceResponse(SendPort sp,
int tag,
Uri uri,
+ Uri resolvedUri,
String libraryUrl,
dynamic data) {
assert((data is List<int>) || (data is String));
- var msg = new List(4);
+ var msg = new List(5);
if (data is String) {
// We encountered an error, flip the sign of the tag to indicate that.
tag = -tag;
@@ -334,8 +335,9 @@ void _sendResourceResponse(SendPort sp,
}
msg[0] = tag;
msg[1] = uri.toString();
- msg[2] = libraryUrl;
- msg[3] = data;
+ msg[2] = resolvedUri.toString();
+ msg[3] = libraryUrl;
+ msg[4] = data;
sp.send(msg);
}
@@ -376,18 +378,20 @@ void _loadHttp(SendPort sp,
if (response.statusCode != 200) {
var msg = "Failure getting $resolvedUri:\n"
" ${response.statusCode} ${response.reasonPhrase}";
- _sendResourceResponse(sp, tag, uri, libraryUrl, msg);
+ _sendResourceResponse(sp, tag, uri, resolvedUri, libraryUrl, msg);
} else {
- _sendResourceResponse(sp, tag, uri, libraryUrl,
+ _sendResourceResponse(sp, tag, uri, resolvedUri, libraryUrl,
builder.takeBytes());
}
},
onError: (e) {
- _sendResourceResponse(sp, tag, uri, libraryUrl, e.toString());
+ _sendResourceResponse(
+ sp, tag, uri, resolvedUri, libraryUrl, e.toString());
});
})
.catchError((e) {
- _sendResourceResponse(sp, tag, uri, libraryUrl, e.toString());
+ _sendResourceResponse(
+ sp, tag, uri, resolvedUri, libraryUrl, e.toString());
});
// It's just here to push an event on the event loop so that we invoke the
// scheduled microtasks.
@@ -402,10 +406,10 @@ void _loadFile(SendPort sp,
var path = resolvedUri.toFilePath();
var sourceFile = new File(path);
sourceFile.readAsBytes().then((data) {
- _sendResourceResponse(sp, tag, uri, libraryUrl, data);
+ _sendResourceResponse(sp, tag, uri, resolvedUri, libraryUrl, data);
},
onError: (e) {
- _sendResourceResponse(sp, tag, uri, libraryUrl, e.toString());
+ _sendResourceResponse(sp, tag, uri, resolvedUri, libraryUrl, e.toString());
});
}
@@ -426,9 +430,10 @@ void _loadDataUri(SendPort sp,
// The C++ portion of the embedder assumes UTF-8.
throw "Only utf-8 or US-ASCII encodings are supported: $charset given.";
}
- _sendResourceResponse(sp, tag, uri, libraryUrl, uri.data.contentAsBytes());
+ _sendResourceResponse(
+ sp, tag, uri, resolvedUri, libraryUrl, uri.data.contentAsBytes());
} catch (e) {
- _sendResourceResponse(sp, tag, uri, libraryUrl,
+ _sendResourceResponse(sp, tag, uri, resolvedUri, libraryUrl,
"Invalid data uri ($uri):\n $e");
}
}
@@ -454,6 +459,7 @@ _loadPackage(IsolateLoaderState loaderState,
_sendResourceResponse(sp,
tag,
uri,
+ resolvedUri,
libraryUrl,
e.toString());
return;
@@ -517,6 +523,7 @@ _handleResourceRequest(IsolateLoaderState loaderState,
} else {
_sendResourceResponse(sp, tag,
uri,
+ resolvedUri,
libraryUrl,
'Unknown scheme (${resolvedUri.scheme}) for '
'$resolvedUri');
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/bin/vmservice_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698