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

Unified Diff: utils/kernel-service/kernel-service.dart

Issue 2655173002: Create an app snapshot of the Dart front end. (Closed)
Patch Set: . Created 3 years, 11 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 | « utils/kernel-service/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/kernel-service/kernel-service.dart
diff --git a/runtime/tools/kernel-service.dart b/utils/kernel-service/kernel-service.dart
similarity index 79%
rename from runtime/tools/kernel-service.dart
rename to utils/kernel-service/kernel-service.dart
index f473c154775f0376174f49614e7eb7ace589ec48..1351f97091ce1051bcce0b1901f8f4e92bd4f8d8 100644
--- a/runtime/tools/kernel-service.dart
+++ b/utils/kernel-service/kernel-service.dart
@@ -92,4 +92,26 @@ Future _processLoadRequest(request) async {
port.send([tag, inputFileUrl, inputFileUrl, null, result]);
}
-main() => new RawReceivePort()..handler = _processLoadRequest;
+// This entry point is used when running in the kernel isolate.
+start() => new RawReceivePort()..handler = _processLoadRequest;
+
+// This entry point is used when creating an app snapshot. The argument provides
+// a script to compile to warm-up generated code.
+main(args) {
+ var tag = 1;
+ var scriptUri = args[0];
+ var responsePort = new RawReceivePort();
+ responsePort.handler = (response) {
+ if (response[0] == tag) {
+ // Success.
+ responsePort.close();
+ } else if (response[0] == -tag) {
+ // Compilation error.
+ throw response[4];
+ } else {
+ throw "Unexpected response: $response";
+ }
+ };
+ var request = [tag, responsePort.sendPort, scriptUri];
+ _processLoadRequest(request);
+}
« no previous file with comments | « utils/kernel-service/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698