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

Unified Diff: third_party/mojo/src/mojo/public/dart/src/stub.dart

Issue 1019173002: Update mojo sdk to rev 7214b7ec7d27563b2666afad86cf1c5895c56c18 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep permission service alive if embedder drops requests 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
Index: third_party/mojo/src/mojo/public/dart/src/stub.dart
diff --git a/third_party/mojo/src/mojo/public/dart/src/stub.dart b/third_party/mojo/src/mojo/public/dart/src/stub.dart
index 1ce098239cec317e1093c564d98eb7a319e1f890..6695f07a3353a0cc088cc65de311b5f1a6db452e 100644
--- a/third_party/mojo/src/mojo/public/dart/src/stub.dart
+++ b/third_party/mojo/src/mojo/public/dart/src/stub.dart
@@ -7,8 +7,10 @@ part of bindings;
abstract class Stub extends core.MojoEventStreamListener {
int _outstandingResponseFutures = 0;
bool _isClosing = false;
+ Completer _closeCompleter;
- Stub(core.MojoMessagePipeEndpoint endpoint) : super(endpoint);
+ Stub.fromEndpoint(core.MojoMessagePipeEndpoint endpoint)
+ : super.fromEndpoint(endpoint);
Stub.fromHandle(core.MojoHandle handle) : super.fromHandle(handle);
@@ -41,9 +43,7 @@ abstract class Stub extends core.MojoEventStreamListener {
_outstandingResponseFutures--;
if (isOpen) {
endpoint.write(
- response.buffer,
- response.buffer.lengthInBytes,
- response.handles);
+ response.buffer, response.buffer.lengthInBytes, response.handles);
if (!endpoint.status.isOk) {
throw 'message pipe write failed: ${endpoint.status}';
}
@@ -52,6 +52,8 @@ abstract class Stub extends core.MojoEventStreamListener {
// a response. It is safe to close.
super.close();
_isClosing = false;
+ _closeCompleter.complete(null);
+ _closeCompleter = null;
}
}
});
@@ -60,6 +62,8 @@ abstract class Stub extends core.MojoEventStreamListener {
// there are no outstanding response futures. Do the close now.
super.close();
_isClosing = false;
+ _closeCompleter.complete(null);
+ _closeCompleter = null;
}
}
@@ -70,7 +74,7 @@ abstract class Stub extends core.MojoEventStreamListener {
// NB: |nodefer| should only be true when calling close() while handling an
// exception thrown from handleRead(), e.g. when we receive a malformed
// message.
- void close({bool nodefer: false}) {
+ Future close({bool nodefer: false}) {
if (isOpen &&
!nodefer &&
(isInHandler || (_outstandingResponseFutures > 0))) {
@@ -79,8 +83,10 @@ abstract class Stub extends core.MojoEventStreamListener {
// response futures. Defer the actual close until all response futures
// have been resolved.
_isClosing = true;
+ _closeCompleter = new Completer();
+ return _closeCompleter.future;
} else {
- super.close();
+ return super.close();
}
}
@@ -93,4 +99,9 @@ abstract class Stub extends core.MojoEventStreamListener {
var header = new MessageHeader.withRequestId(name, flags, id);
return response.serializeWithHeader(header);
}
+
+ String toString() {
+ var superString = super.toString();
+ return "Stub(${superString})";
+ }
}
« no previous file with comments | « third_party/mojo/src/mojo/public/dart/src/proxy.dart ('k') | third_party/mojo/src/mojo/public/dart/src/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698