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

Side by Side Diff: mojo/public/dart/src/stub.dart

Issue 968243003: Dart: Adds optional named arguments for creating bindings. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Format 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 part of bindings; 5 part of bindings;
6 6
7 abstract class Stub extends core.MojoEventStreamListener { 7 abstract class Stub extends core.MojoEventStreamListener {
8 int _outstandingResponseFutures = 0; 8 int _outstandingResponseFutures = 0;
9 bool _isClosing = false; 9 bool _isClosing = false;
10 10
11 Stub(core.MojoMessagePipeEndpoint endpoint) : super(endpoint); 11 Stub.fromEndpoint(core.MojoMessagePipeEndpoint endpoint, {bool doListen: true,
12 Function onClosed})
13 : super.fromEndpoint(endpoint, doListen: doListen, onClosed: onClosed);
12 14
13 Stub.fromHandle(core.MojoHandle handle) : super.fromHandle(handle); 15 Stub.fromHandle(core.MojoHandle handle, {bool doListen: true,
16 Function onClosed})
17 : super.fromHandle(handle, doListen: doListen, onClosed: onClosed);
14 18
15 Stub.unbound() : super.unbound(); 19 Stub.unbound() : super.unbound();
16 20
17 Future<Message> handleMessage(ServiceMessage message); 21 Future<Message> handleMessage(ServiceMessage message);
18 22
19 void handleRead() { 23 void handleRead() {
20 // Query how many bytes are available. 24 // Query how many bytes are available.
21 var result = endpoint.query(); 25 var result = endpoint.query();
22 assert(result.status.isOk || result.status.isResourceExhausted); 26 assert(result.status.isOk || result.status.isResourceExhausted);
23 if (result.bytesRead == 0) { 27 if (result.bytesRead == 0) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 Message buildResponse(Struct response, int name) { 91 Message buildResponse(Struct response, int name) {
88 var header = new MessageHeader(name); 92 var header = new MessageHeader(name);
89 return response.serializeWithHeader(header); 93 return response.serializeWithHeader(header);
90 } 94 }
91 95
92 Message buildResponseWithId(Struct response, int name, int id, int flags) { 96 Message buildResponseWithId(Struct response, int name, int id, int flags) {
93 var header = new MessageHeader.withRequestId(name, flags, id); 97 var header = new MessageHeader.withRequestId(name, flags, id);
94 return response.serializeWithHeader(header); 98 return response.serializeWithHeader(header);
95 } 99 }
96 } 100 }
OLDNEW
« no previous file with comments | « mojo/public/dart/src/proxy.dart ('k') | mojo/public/tools/bindings/generators/dart_templates/interface_definition.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698