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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « utils/kernel-service/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This is an interface to the Dart Kernel parser and Kernel binary generator. 5 // This is an interface to the Dart Kernel parser and Kernel binary generator.
6 // It is used by the kernel-isolate to load Dart source code and generate 6 // It is used by the kernel-isolate to load Dart source code and generate
7 // Kernel binary format. 7 // Kernel binary format.
8 8
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 try { 85 try {
86 result = await parseScript(scriptUri, packagesUri.path, patchedSdk.path); 86 result = await parseScript(scriptUri, packagesUri.path, patchedSdk.path);
87 } catch (error) { 87 } catch (error) {
88 tag = -tag; // Mark reply as an exception. 88 tag = -tag; // Mark reply as an exception.
89 result = error.toString(); 89 result = error.toString();
90 } 90 }
91 91
92 port.send([tag, inputFileUrl, inputFileUrl, null, result]); 92 port.send([tag, inputFileUrl, inputFileUrl, null, result]);
93 } 93 }
94 94
95 main() => new RawReceivePort()..handler = _processLoadRequest; 95 // This entry point is used when running in the kernel isolate.
96 start() => new RawReceivePort()..handler = _processLoadRequest;
97
98 // This entry point is used when creating an app snapshot. The argument provides
99 // a script to compile to warm-up generated code.
100 main(args) {
101 var tag = 1;
102 var scriptUri = args[0];
103 var responsePort = new RawReceivePort();
104 responsePort.handler = (response) {
105 if (response[0] == tag) {
106 // Success.
107 responsePort.close();
108 } else if (response[0] == -tag) {
109 // Compilation error.
110 throw response[4];
111 } else {
112 throw "Unexpected response: $response";
113 }
114 };
115 var request = [tag, responsePort.sendPort, scriptUri];
116 _processLoadRequest(request);
117 }
OLDNEW
« 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