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

Unified Diff: tests/isolate/object_leak_test.dart

Issue 742873002: Isolates: allow sending of arbitrary objects in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Support CSP mode. Created 6 years 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 | « tests/isolate/message3_test.dart ('k') | tests/isolate/serialization_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/object_leak_test.dart
diff --git a/tests/isolate/object_leak_test.dart b/tests/isolate/object_leak_test.dart
index 4511b43fd99bfe74285ccb437f40588c55e85c14..d15f2b51ca8518a3dcf6be9109e7ad3e7f2c45df 100644
--- a/tests/isolate/object_leak_test.dart
+++ b/tests/isolate/object_leak_test.dart
@@ -16,25 +16,23 @@ class A {
}
fun(msg) {
- print("received: ${msg.x}");
- msg.x = 1;
- print("done updating: ${msg.x}");
+ var a = msg[0];
+ var replyTo = msg[1];
+ print("received: ${a.x}");
+ a.x = 1;
+ print("done updating: ${a.x}");
+ replyTo.send("done");
}
main() {
asyncStart();
var a = new A();
- // Sending an A object to another isolate should not work.
- Isolate.spawn(fun, a).then((isolate) {
- new Timer(const Duration(milliseconds: 300), () {
- // Changes in other isolate must not reach here.
- Expect.equals(0, a.x);
- asyncEnd();
- });
- }, onError: (e) {
- // Sending an A isn't required to work.
- // It works in the VM, but not in dart2js.
- print("Send of A failed:\n$e");
+ ReceivePort rp = new ReceivePort();
+ Isolate.spawn(fun, [a, rp.sendPort]);
+ rp.first.then((msg) {
+ Expect.equals("done", msg);
+ // Changes in other isolate must not reach here.
+ Expect.equals(0, a.x);
asyncEnd();
});
}
« no previous file with comments | « tests/isolate/message3_test.dart ('k') | tests/isolate/serialization_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698