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

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

Issue 795593004: Update mojo sdk to rev cc531b32182099a5a034a99daff35ed5d38a61c8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More workarounds for MSVC 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 | « mojo/public/dart/src/handle.dart ('k') | mojo/public/go/system/core.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/dart/src/interface.dart
diff --git a/mojo/public/dart/src/interface.dart b/mojo/public/dart/src/interface.dart
index 76807ed7fe4bc888a85a94a7591f667b9c73c53c..8d8970a0d4b3a28ad2cea1da0b9ce7afc8ecf416 100644
--- a/mojo/public/dart/src/interface.dart
+++ b/mojo/public/dart/src/interface.dart
@@ -8,15 +8,18 @@ abstract class Interface {
core.MojoMessagePipeEndpoint _endpoint;
core.MojoHandle _handle;
List _sendQueue;
+ bool _isOpen;
- Message handleMessage(MessageReader reader, Function messageHandler);
+ Message handleMessage(MessageReader reader);
Interface(this._endpoint) {
_sendQueue = [];
_handle = new core.MojoHandle(_endpoint.handle);
+ _isOpen = false;
}
- StreamSubscription<int> listen(Function messageHandler) {
+ StreamSubscription<int> listen() {
+ _isOpen = true;
return _handle.listen((int mojoSignal) {
if (core.MojoHandleSignals.isReadable(mojoSignal)) {
// Query how many bytes are available.
@@ -42,10 +45,10 @@ abstract class Interface {
var reader = new MessageReader(message);
// Prepare the response.
- var response_message = handleMessage(reader, messageHandler);
+ var responseMessage = handleMessage(reader);
// If there's a response, queue it up for sending.
- if (response_message != null) {
- _sendQueue.add(response_message);
+ if (responseMessage != null) {
+ _sendQueue.add(responseMessage);
if ((_sendQueue.length > 0) && !_handle.writeEnabled()) {
_handle.enableWriteEvents();
}
@@ -53,8 +56,10 @@ abstract class Interface {
}
if (core.MojoHandleSignals.isWritable(mojoSignal)) {
if (_sendQueue.length > 0) {
- var response_message = _sendQueue.removeAt(0);
- _endpoint.write(response_message.buffer);
+ var responseMessage = _sendQueue.removeAt(0);
+ _endpoint.write(responseMessage.buffer,
+ responseMessage.buffer.lengthInBytes,
+ responseMessage.handles);
if (!_endpoint.status.isOk) {
throw new Exception("message pipe write failed");
}
@@ -77,10 +82,27 @@ abstract class Interface {
return builder.finish();
}
- Message buildResponseWithID(Type t, int name, int id, Object response) {
+ Message buildResponseWithID(
+ Type t, int name, int id, int flags, Object response) {
var builder = new MessageWithRequestIDBuilder(
- name, align(getEncodedSize(t)), id);
+ name, align(getEncodedSize(t)), id, flags);
builder.encodeStruct(t, response);
return builder.finish();
}
+
+ void enqueueMessage(Type t, int name, Object msg) {
+ var builder = new MessageBuilder(name, align(getEncodedSize(t)));
+ builder.encodeStruct(t, msg);
+ var message = builder.finish();
+ _sendQueue.add(message);
+ if (!_handle.writeEnabled()) {
+ _handle.enableWriteEvents();
+ }
+ }
+
+ Future enqueueMessageWithRequestID(Type t, int name, int id, Object msg) {
+ throw new Exception("The client Mixin should not expect a response");
+ }
+
+ bool get isOpen => _isOpen;
}
« no previous file with comments | « mojo/public/dart/src/handle.dart ('k') | mojo/public/go/system/core.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698