Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |