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

Unified Diff: runtime/bin/main.cc

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/loader.cc ('k') | runtime/bin/vmservice/loader.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 89c752b2815a24a3d8195c704feac4f029d67bf3..c1b436e27add8ef508eb3704bd9cc7d26ea288e7 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -1043,6 +1043,22 @@ static void ServiceStreamCancelCallback(const char* stream_id) {
}
+static bool FileModifiedCallback(const char* url, int64_t since) {
+ if (strncmp(url, "file:///", 8) == 0) {
+ // If it isn't a file on local disk, we don't know if it has been
+ // modified.
+ return true;
+ }
+ int64_t data[File::kStatSize];
+ File::Stat(url + 7, data);
+ if (data[File::kType] == File::kDoesNotExist) {
+ return true;
+ }
+ bool modified = data[File::kModifiedTime] > since;
+ return modified;
+}
+
+
static void WriteSnapshotFile(const char* snapshot_directory,
const char* filename,
bool write_magic_number,
@@ -1708,6 +1724,7 @@ void main(int argc, char** argv) {
"getIO", &ServiceGetIOHandler, NULL);
Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback,
&ServiceStreamCancelCallback);
+ Dart_SetFileModifiedCallback(&FileModifiedCallback);
// Run the main isolate until we aren't told to restart.
while (RunMainIsolate(script_name, &dart_options)) {
« no previous file with comments | « runtime/bin/loader.cc ('k') | runtime/bin/vmservice/loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698