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 class ProxyError { | 7 class ProxyError { |
8 final String message; | 8 final String message; |
9 ProxyError(this.message); | 9 ProxyError(this.message); |
10 String toString() => "ProxyError: $message"; | 10 String toString() => "ProxyError: $message"; |
(...skipping 17 matching lines...) Expand all Loading... |
28 void handleResponse(ServiceMessage reader); | 28 void handleResponse(ServiceMessage reader); |
29 | 29 |
30 /// If there is an error in using this proxy, this future completes with | 30 /// If there is an error in using this proxy, this future completes with |
31 /// a ProxyError. | 31 /// a ProxyError. |
32 Future get errorFuture => _errorCompleter.future; | 32 Future get errorFuture => _errorCompleter.future; |
33 | 33 |
34 /// Version of this interface that the remote side supports. Updated when a | 34 /// Version of this interface that the remote side supports. Updated when a |
35 /// call to [queryVersion] or [requireVersion] is made. | 35 /// call to [queryVersion] or [requireVersion] is made. |
36 int get version => _version; | 36 int get version => _version; |
37 | 37 |
| 38 /// Returns a service description, which exposes the mojom type information |
| 39 /// of the service being proxied. |
| 40 /// Note: The description is null or incomplete if type info is unavailable. |
| 41 service_describer.ServiceDescription get description => null; |
| 42 |
38 void handleRead() { | 43 void handleRead() { |
39 var result = endpoint.queryAndRead(); | 44 var result = endpoint.queryAndRead(); |
40 if ((result.data == null) || (result.dataLength == 0)) { | 45 if ((result.data == null) || (result.dataLength == 0)) { |
41 proxyError("Read from message pipe endpoint failed"); | 46 proxyError("Read from message pipe endpoint failed"); |
42 return; | 47 return; |
43 } | 48 } |
44 try { | 49 try { |
45 var message = new ServiceMessage.fromMessage(new Message(result.data, | 50 var message = new ServiceMessage.fromMessage(new Message(result.data, |
46 result.handles, result.dataLength, result.handlesLength)); | 51 result.handles, result.dataLength, result.handlesLength)); |
47 _pendingCount--; | 52 _pendingCount--; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 251 |
247 /// Generated Proxy classes have a factory Proxy.connectToService which takes | 252 /// Generated Proxy classes have a factory Proxy.connectToService which takes |
248 /// a ServiceConnector, a url, and optionally a service name and returns a | 253 /// a ServiceConnector, a url, and optionally a service name and returns a |
249 /// bound Proxy. For example, every class extending the Application base class | 254 /// bound Proxy. For example, every class extending the Application base class |
250 /// in package:mojo/application.dart inherits and implementation of the | 255 /// in package:mojo/application.dart inherits and implementation of the |
251 /// ServiceConnector interface. | 256 /// ServiceConnector interface. |
252 abstract class ServiceConnector { | 257 abstract class ServiceConnector { |
253 /// Connects [proxy] to the service called [serviceName] that lives at [url]. | 258 /// Connects [proxy] to the service called [serviceName] that lives at [url]. |
254 void connectToService(String url, ProxyBase proxy, [String serviceName]); | 259 void connectToService(String url, ProxyBase proxy, [String serviceName]); |
255 } | 260 } |
OLD | NEW |