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

Unified Diff: mojo/dart/apptests/test_apps/echo/lib/main.dart

Issue 1874553002: Dart: Fix bug in unbind() for Stubs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 8 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: mojo/dart/apptests/test_apps/echo/lib/main.dart
diff --git a/mojo/dart/apptests/test_apps/echo/lib/main.dart b/mojo/dart/apptests/test_apps/echo/lib/main.dart
index fba41a7275a1e31a1a7a904da6f45aa3a22f479b..4ace20ac1e70d7281482d1051c7bd2c6d68358c0 100644
--- a/mojo/dart/apptests/test_apps/echo/lib/main.dart
+++ b/mojo/dart/apptests/test_apps/echo/lib/main.dart
@@ -33,7 +33,22 @@ class EchoServiceImpl implements EchoService {
new Duration(milliseconds: millis), () => responseFactory(value));
}
+ void swap() {
+ _swapImpls(this);
+ }
+
void quit() {}
+
+ static void _swapImpls(EchoServiceImpl impl) {
+ final stub = impl._stub;
+ final app = impl._application;
+ // It is not allowed to do an unbind in the midst of handling an event, so
+ // it is delayed until popping back out to the event loop.
+ Timer.run(() {
+ final endpoint = stub.unbind();
+ new EchoServiceImpl(app, endpoint);
+ });
+ }
}
class EchoApplication extends Application {

Powered by Google App Engine
This is Rietveld 408576698