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

Side by Side Diff: samples/leap/leap_leg.dart

Issue 9652001: SendPort + ReceivePort changes: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « samples/isolate_html/IsolateSample.dart ('k') | samples/proxy/promise.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 compilerIsolate(port) { 5 compilerIsolate(port) {
6 Runner runner = new Runner(); 6 Runner runner = new Runner();
7 runner.init(); 7 runner.init();
8 8
9 port.receive((msg, replyTo) { 9 port.receive((msg, replyTo) {
10 replyTo.send(runner.update(msg)); 10 replyTo.send(runner.update(msg));
11 }); 11 });
12 } 12 }
13 13
14 main() { 14 main() {
15 dom.document.getElementById('status').innerHTML = 'Initializing compiler'; 15 dom.document.getElementById('status').innerHTML = 'Initializing compiler';
16 final iframe = dom.document.getElementById('isolate'); 16 final iframe = dom.document.getElementById('isolate');
17 setOutline(msg, _) { 17 setOutline(msg) {
18 dom.document.getElementById('out').innerHTML = msg; 18 dom.document.getElementById('out').innerHTML = msg;
19 } 19 }
20 dom.spawnDomIsolate(iframe.contentWindow, 'compilerIsolate').then((sendPort) { 20 dom.spawnDomIsolate(iframe.contentWindow, 'compilerIsolate').then((sendPort) {
21 update(_) { 21 update(_) {
22 String text = dom.document.getElementById('code').innerText; 22 String text = dom.document.getElementById('code').innerText;
23 sendPort.call(text).receive(setOutline); 23 sendPort.call(text).then(setOutline);
24 dom.document.getElementById('status').innerHTML = 'Ready'; 24 dom.document.getElementById('status').innerHTML = 'Ready';
25 } 25 }
26 update(null); 26 update(null);
27 final code = dom.document.getElementById('code'); 27 final code = dom.document.getElementById('code');
28 code.addEventListener('DOMSubtreeModified', update); 28 code.addEventListener('DOMSubtreeModified', update);
29 }); 29 });
30 } 30 }
31 31
32 class Runner { 32 class Runner {
33 final LeapCompiler compiler; 33 final LeapCompiler compiler;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 mainApp = new LibraryElement(script); 189 mainApp = new LibraryElement(script);
190 190
191 universe.libraries.remove(script.uri.toString()); 191 universe.libraries.remove(script.uri.toString());
192 Element element; 192 Element element;
193 withCurrentElement(mainApp, () { 193 withCurrentElement(mainApp, () {
194 scanner.scan(mainApp); 194 scanner.scan(mainApp);
195 }); 195 });
196 return mainApp; 196 return mainApp;
197 } 197 }
198 } 198 }
OLDNEW
« no previous file with comments | « samples/isolate_html/IsolateSample.dart ('k') | samples/proxy/promise.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698