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

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

Issue 982673002: Dart: Removes need to call listen(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge and 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.fromEndpoint(core.MojoMessagePipeEndpoint endpoint, 11 Stub.fromEndpoint(core.MojoMessagePipeEndpoint endpoint)
12 {bool doListen: true, Function onClosed}) 12 : super.fromEndpoint(endpoint);
13 : super.fromEndpoint(endpoint, doListen: doListen, onClosed: onClosed);
14 13
15 Stub.fromHandle(core.MojoHandle handle, 14 Stub.fromHandle(core.MojoHandle handle) : super.fromHandle(handle);
16 {bool doListen: true, Function onClosed})
17 : super.fromHandle(handle, doListen: doListen, onClosed: onClosed);
18 15
19 Stub.unbound() : super.unbound(); 16 Stub.unbound() : super.unbound();
20 17
21 Future<Message> handleMessage(ServiceMessage message); 18 Future<Message> handleMessage(ServiceMessage message);
22 19
23 void handleRead() { 20 void handleRead() {
24 // Query how many bytes are available. 21 // Query how many bytes are available.
25 var result = endpoint.query(); 22 var result = endpoint.query();
26 assert(result.status.isOk || result.status.isResourceExhausted); 23 assert(result.status.isOk || result.status.isResourceExhausted);
27 if (result.bytesRead == 0) { 24 if (result.bytesRead == 0) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 Message buildResponseWithId(Struct response, int name, int id, int flags) { 91 Message buildResponseWithId(Struct response, int name, int id, int flags) {
95 var header = new MessageHeader.withRequestId(name, flags, id); 92 var header = new MessageHeader.withRequestId(name, flags, id);
96 return response.serializeWithHeader(header); 93 return response.serializeWithHeader(header);
97 } 94 }
98 95
99 String toString() { 96 String toString() {
100 var superString = super.toString(); 97 var superString = super.toString();
101 return "Stub(${superString})"; 98 return "Stub(${superString})";
102 } 99 }
103 } 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