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

Unified Diff: tests/isolate/object_leak_test.dart

Issue 296513012: Dart2js: Fix object leaking between isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
Index: tests/isolate/object_leak_test.dart
diff --git a/tests/isolate/object_leak_test.dart b/tests/isolate/object_leak_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4511b43fd99bfe74285ccb437f40588c55e85c14
--- /dev/null
+++ b/tests/isolate/object_leak_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for http://dartbug.com/18942
+
+library LeakTest;
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+import 'dart:isolate';
+import 'dart:async';
+
+
+class A {
+ var x = 0;
+}
+
+fun(msg) {
+ print("received: ${msg.x}");
+ msg.x = 1;
+ print("done updating: ${msg.x}");
+}
+
+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");
+ asyncEnd();
+ });
+}
« sdk/lib/_internal/lib/isolate_helper.dart ('K') | « sdk/lib/_internal/lib/isolate_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698