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

Unified Diff: runtime/bin/main.cc

Issue 2433573002: GN: Build app snapshots for the SDK tools. (Closed)
Patch Set: Created 4 years, 2 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/isolate_data.h ('k') | runtime/bin/process.cc » ('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 10861340c162816ac3e1d4c67d8264fb2068cce5..8546f2b0a72cc14aa6bc781e223a4a44be93e417 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -775,6 +775,9 @@ static Dart_Handle EnvironmentCallback(Dart_Handle name) {
} \
+static void SnapshotOnExitHook(int64_t exit_code);
+
+
// Returns true on success, false on failure.
static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
const char* main,
@@ -801,6 +804,10 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
IsolateData* isolate_data = new IsolateData(script_uri,
package_root,
packages_config);
+ if ((gen_snapshot_kind == kAppAfterRun) ||
+ (gen_snapshot_kind == kAppJITAfterRun)) {
+ isolate_data->set_exit_hook(SnapshotOnExitHook);
+ }
Dart_Isolate isolate = Dart_CreateIsolate(script_uri,
main,
isolate_snapshot_buffer,
@@ -1521,6 +1528,16 @@ static void GenerateFullSnapshot() {
}
+static void SnapshotOnExitHook(int64_t exit_code) {
+ if (gen_snapshot_kind == kAppAfterRun) {
+ GenerateFullSnapshot();
+ } else {
+ Dart_PrecompileJIT();
+ GeneratePrecompiledJITSnapshot();
+ }
+}
+
+
bool RunMainIsolate(const char* script_name,
CommandLineOptions* dart_options) {
// Call CreateIsolateAndSetup which creates an isolate and loads up
« no previous file with comments | « runtime/bin/isolate_data.h ('k') | runtime/bin/process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698