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

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

Issue 851173002: Dart: Encode/Decode handle and interface types. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix Interface encode parameters Created 5 years, 11 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/buffer.dart ('k') | mojo/public/dart/src/codec.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 abstract class Client extends core.MojoEventStreamListener { 7 abstract class Client extends core.MojoEventStreamListener {
8 Map<int, Completer> _completerMap; 8 Map<int, Completer> _completerMap;
9 int _nextId = 0; 9 int _nextId = 0;
10 10
11 Client(core.MojoMessagePipeEndpoint endpoint) : 11 Client(core.MojoMessagePipeEndpoint endpoint) :
12 _completerMap = {}, 12 _completerMap = {},
13 super(endpoint); 13 super(endpoint);
14 14
15 Client.fromHandle(int handle) : 15 Client.fromHandle(core.MojoHandle handle) :
16 _completerMap = {}, 16 _completerMap = {},
17 super.fromHandle(handle); 17 super.fromHandle(handle);
18 18
19 Client.unbound() :
20 _completerMap = {},
21 super.unbound();
22
19 void handleResponse(ServiceMessage reader); 23 void handleResponse(ServiceMessage reader);
20 24
21 void handleRead() { 25 void handleRead() {
22 // Query how many bytes are available. 26 // Query how many bytes are available.
23 var result = endpoint.query(); 27 var result = endpoint.query();
24 assert(result.status.isOk || result.status.isResourceExhausted); 28 assert(result.status.isOk || result.status.isResourceExhausted);
25 29
26 // Read the data. 30 // Read the data.
27 var bytes = new ByteData(result.bytesRead); 31 var bytes = new ByteData(result.bytesRead);
28 var handles = new List<core.MojoHandle>(result.handlesRead); 32 var handles = new List<core.MojoHandle>(result.handlesRead);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 73 }
70 74
71 var completer = new Completer(); 75 var completer = new Completer();
72 _completerMap[id] = completer; 76 _completerMap[id] = completer;
73 return completer.future; 77 return completer.future;
74 } 78 }
75 79
76 // Need a getter for this for access in subclasses. 80 // Need a getter for this for access in subclasses.
77 Map<int, Completer> get completerMap => _completerMap; 81 Map<int, Completer> get completerMap => _completerMap;
78 } 82 }
OLDNEW
« no previous file with comments | « mojo/public/dart/src/buffer.dart ('k') | mojo/public/dart/src/codec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698