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

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

Issue 1060193002: Provide mechanism to close immediately to Dart bindings (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « mojo/public/dart/src/event_stream.dart ('k') | mojo/public/dart/src/stub.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class ProxyCloseException { 7 class ProxyCloseException {
8 final String message; 8 final String message;
9 ProxyCloseException(this.message); 9 ProxyCloseException(this.message);
10 String toString() => message; 10 String toString() => message;
(...skipping 29 matching lines...) Expand all
40 assert(result.status.isOk || result.status.isResourceExhausted); 40 assert(result.status.isOk || result.status.isResourceExhausted);
41 var message = new ServiceMessage.fromMessage(new Message(bytes, handles)); 41 var message = new ServiceMessage.fromMessage(new Message(bytes, handles));
42 handleResponse(message); 42 handleResponse(message);
43 } 43 }
44 44
45 void handleWrite() { 45 void handleWrite() {
46 throw 'Unexpected write signal in proxy.'; 46 throw 'Unexpected write signal in proxy.';
47 } 47 }
48 48
49 @override 49 @override
50 Future close({bool nodefer: false}) { 50 Future close({bool immediate: false}) {
51 for (var completer in _completerMap.values) { 51 for (var completer in _completerMap.values) {
52 completer.completeError(new ProxyCloseException('Proxy closed')); 52 completer.completeError(new ProxyCloseException('Proxy closed'));
53 } 53 }
54 _completerMap.clear(); 54 _completerMap.clear();
55 return super.close(nodefer: nodefer); 55 return super.close(immediate: immediate);
56 } 56 }
57 57
58 void sendMessage(Struct message, int name) { 58 void sendMessage(Struct message, int name) {
59 if (!isOpen) { 59 if (!isOpen) {
60 listen(); 60 listen();
61 } 61 }
62 var header = new MessageHeader(name); 62 var header = new MessageHeader(name);
63 var serviceMessage = message.serializeWithHeader(header); 63 var serviceMessage = message.serializeWithHeader(header);
64 endpoint.write(serviceMessage.buffer, 64 endpoint.write(serviceMessage.buffer,
65 serviceMessage.buffer.lengthInBytes, serviceMessage.handles); 65 serviceMessage.buffer.lengthInBytes, serviceMessage.handles);
(...skipping 30 matching lines...) Expand all
96 var superString = super.toString(); 96 var superString = super.toString();
97 return "Proxy(${superString})"; 97 return "Proxy(${superString})";
98 } 98 }
99 } 99 }
100 100
101 // Generated Proxy classes implement this interface. 101 // Generated Proxy classes implement this interface.
102 abstract class ProxyBase { 102 abstract class ProxyBase {
103 final Proxy impl = null; 103 final Proxy impl = null;
104 final String name = null; 104 final String name = null;
105 } 105 }
OLDNEW
« no previous file with comments | « mojo/public/dart/src/event_stream.dart ('k') | mojo/public/dart/src/stub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698