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

Side by Side Diff: mojo/dart/packages/mojo/lib/src/stub.dart

Issue 1439993003: Dart: Avoid MojoResult and MojoHandleSignals constructors. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Small fixes Created 5 years, 1 month 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.MojoEventHandler { 7 abstract class Stub extends core.MojoEventHandler {
8 int _outstandingResponseFutures = 0; 8 int _outstandingResponseFutures = 0;
9 bool _isClosing = false; 9 bool _isClosing = false;
10 Completer _closeCompleter; 10 Completer _closeCompleter;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 } 63 }
64 64
65 void _sendResponse(Message response) { 65 void _sendResponse(Message response) {
66 if (isOpen) { 66 if (isOpen) {
67 endpoint.write( 67 endpoint.write(
68 response.buffer, response.buffer.lengthInBytes, response.handles); 68 response.buffer, response.buffer.lengthInBytes, response.handles);
69 // FailedPrecondition is only used to indicate that the other end of 69 // FailedPrecondition is only used to indicate that the other end of
70 // the pipe has been closed. We can ignore the close here and wait for 70 // the pipe has been closed. We can ignore the close here and wait for
71 // the PeerClosed signal on the event stream. 71 // the PeerClosed signal on the event stream.
72 assert(endpoint.status.isOk || endpoint.status.isFailedPrecondition); 72 assert((endpoint.status == core.MojoResult.kOk) ||
73 (endpoint.status == core.MojoResult.kFailedPrecondition));
Cutch 2015/11/17 00:01:51 Indentation on line 73
zra 2015/11/17 14:57:29 Unfortunately, this is the result of the Dart form
73 if (_isClosing && (_outstandingResponseFutures == 0)) { 74 if (_isClosing && (_outstandingResponseFutures == 0)) {
74 // This was the final response future for which we needed to send 75 // This was the final response future for which we needed to send
75 // a response. It is safe to close. 76 // a response. It is safe to close.
76 super.close().then((_) { 77 super.close().then((_) {
77 if (_isClosing) { 78 if (_isClosing) {
78 _isClosing = false; 79 _isClosing = false;
79 _closeCompleter.complete(null); 80 _closeCompleter.complete(null);
80 _closeCompleter = null; 81 _closeCompleter = null;
81 } 82 }
82 }); 83 });
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return response.serializeWithHeader(header); 126 return response.serializeWithHeader(header);
126 } 127 }
127 128
128 String toString() { 129 String toString() {
129 var superString = super.toString(); 130 var superString = super.toString();
130 return "Stub(${superString})"; 131 return "Stub(${superString})";
131 } 132 }
132 133
133 int get version; 134 int get version;
134 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698