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

Unified Diff: mojo/public/dart/src/application_connection.dart

Issue 996923003: Dart: Better handle leak checks. close() is async. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/dart/src/application.dart ('k') | mojo/public/dart/src/codec.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/dart/src/application_connection.dart
diff --git a/mojo/public/dart/src/application_connection.dart b/mojo/public/dart/src/application_connection.dart
index d4d8d20152a33ae55d85e228e1e6bd131e650721..8c354ea672618106c4922223c0e76f8d539f323a 100644
--- a/mojo/public/dart/src/application_connection.dart
+++ b/mojo/public/dart/src/application_connection.dart
@@ -21,7 +21,7 @@ class LocalServiceProvider implements ServiceProvider {
_stub.onError = f;
}
- void close({bool nodefer: false}) => _stub.close(nodefer: nodefer);
+ Future close({bool nodefer: false}) => _stub.close(nodefer: nodefer);
void connectToService(
String interfaceName, core.MojoMessagePipeEndpoint pipe) {
@@ -96,18 +96,26 @@ class ApplicationConnection {
}
void _errorHandler() {
- if (onError != null) onError();
- close();
+ close().then((_) {
+ if (onError != null) onError();
+ });
}
- void close({bool nodefer: false}) {
+ Future close({bool nodefer: false}) {
+ var rspCloseFuture;
+ var lspCloseFuture;
if (remoteServiceProvider != null) {
- remoteServiceProvider.close();
+ rspCloseFuture = remoteServiceProvider.close();
remoteServiceProvider = null;
+ } else {
+ rspCloseFuture = new Future.value(null);
}
if (_localServiceProvider != null) {
- _localServiceProvider.close(nodefer: nodefer);
+ lspCloseFuture = _localServiceProvider.close(nodefer: nodefer);
_localServiceProvider = null;
+ } else {
+ lspCloseFuture = new Future.value(null);
}
+ return rspCloseFuture.then((_) => lspCloseFuture);
}
}
« no previous file with comments | « mojo/public/dart/src/application.dart ('k') | mojo/public/dart/src/codec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698