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

Side by Side Diff: pkg/async_helper/fletch.patch

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 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 | « pkg/async_helper/dartino.patch ('k') | pkg/async_helper/lib/async_helper.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 diff --git a/../dart/pkg/async_helper/lib/async_helper.dart b/pkg/async_helper/l ib/async_helper.dart
2 index 37496bc..1b8acf4 100644
3 --- a/../dart/pkg/async_helper/lib/async_helper.dart
4 +++ b/pkg/async_helper/lib/async_helper.dart
5 @@ -27,16 +27,22 @@ library async_helper;
6 // 'dart:isolate' (i.e. it is in particular problematic with dart2js).
7 // It would be nice if we could use a different mechanism for different
8 // runtimes.
9 -import 'dart:isolate';
10 +import 'dart:fletch';
11
12 bool _initialized = false;
13 -ReceivePort _port = null;
14 +Port _port = null;
15 int _asyncLevel = 0;
16
17 Exception _buildException(String msg) {
18 return new Exception('Fatal: $msg. This is most likely a bug in your test.');
19 }
20
21 +void _waitForMessage(Port port) {
22 + Channel channel = new Channel();
23 + port.send(new Port(channel));
24 + channel.receive();
25 +}
26 +
27 /// Call this method before an asynchronous test is created.
28 void asyncStart() {
29 if (_initialized && _asyncLevel == 0) {
30 @@ -46,7 +52,9 @@ void asyncStart() {
31 if (!_initialized) {
32 print('unittest-suite-wait-for-done');
33 _initialized = true;
34 - _port = new ReceivePort();
35 + var channel = new Channel();
36 + Process.spawn(_waitForMessage, new Port(channel));
37 + _port = channel.receive();
38 }
39 _asyncLevel++;
40 }
41 @@ -63,7 +71,7 @@ void asyncEnd() {
42 }
43 _asyncLevel--;
44 if (_asyncLevel == 0) {
45 - _port.close();
46 + _port.send(null);
47 _port = null;
48 print('unittest-suite-success');
49 }
OLDNEW
« no previous file with comments | « pkg/async_helper/dartino.patch ('k') | pkg/async_helper/lib/async_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698