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

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

Issue 982673002: Dart: Removes need to call listen(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 5 years, 9 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
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 int align(int size) => size + (kAlignment - (size % kAlignment)) % kAlignment; 7 int align(int size) => size + (kAlignment - (size % kAlignment)) % kAlignment;
8 8
9 const int kAlignment = 8; 9 const int kAlignment = 8;
10 const int kSerializedHandleSize = 4; 10 const int kSerializedHandleSize = 4;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 core.MojoSharedBuffer value, int offset, bool nullable) => 198 core.MojoSharedBuffer value, int offset, bool nullable) =>
199 encodeHandle(value != null ? value.handle : null, offset, nullable); 199 encodeHandle(value != null ? value.handle : null, offset, nullable);
200 200
201 void encodeInterface(Stub interface, int offset, bool nullable) { 201 void encodeInterface(Stub interface, int offset, bool nullable) {
202 if (interface == null) { 202 if (interface == null) {
203 encodeInvalideHandle(offset, nullable); 203 encodeInvalideHandle(offset, nullable);
204 return; 204 return;
205 } 205 }
206 var pipe = new core.MojoMessagePipe(); 206 var pipe = new core.MojoMessagePipe();
207 interface.bind(pipe.endpoints[0]); 207 interface.bind(pipe.endpoints[0]);
208 interface.listen();
208 encodeMessagePipeHandle(pipe.endpoints[1], offset, nullable); 209 encodeMessagePipeHandle(pipe.endpoints[1], offset, nullable);
209 } 210 }
210 211
211 void encodeInterfaceRequest(ProxyBase client, int offset, bool nullable) { 212 void encodeInterfaceRequest(ProxyBase client, int offset, bool nullable) {
212 if (client == null) { 213 if (client == null) {
213 encodeInvalideHandle(offset, nullable); 214 encodeInvalideHandle(offset, nullable);
214 return; 215 return;
215 } 216 }
216 var pipe = new core.MojoMessagePipe(); 217 var pipe = new core.MojoMessagePipe();
217 client.impl.bind(pipe.endpoints[0]); 218 client.impl.bind(pipe.endpoints[0]);
219 client.impl.listen();
218 encodeMessagePipeHandle(pipe.endpoints[1], offset, nullable); 220 encodeMessagePipeHandle(pipe.endpoints[1], offset, nullable);
219 } 221 }
220 222
221 void encodeNullPointer(int offset, bool nullable) { 223 void encodeNullPointer(int offset, bool nullable) {
222 if (!nullable) { 224 if (!nullable) {
223 throw new MojoCodecError( 225 throw new MojoCodecError(
224 'Trying to encode a null pointer for a non-nullable type'); 226 'Trying to encode a null pointer for a non-nullable type');
225 } 227 }
226 _buffer.buffer.setUint64(_base + offset, 0, Endianness.LITTLE_ENDIAN); 228 _buffer.buffer.setUint64(_base + offset, 0, Endianness.LITTLE_ENDIAN);
227 } 229 }
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 throw new MojoCodecError( 864 throw new MojoCodecError(
863 'Incorrect header for map. The size is incorrect.'); 865 'Incorrect header for map. The size is incorrect.');
864 } 866 }
865 if (header.version != kMapStructHeader.version) { 867 if (header.version != kMapStructHeader.version) {
866 throw new MojoCodecError( 868 throw new MojoCodecError(
867 'Incorrect header for map. The version is incorrect.'); 869 'Incorrect header for map. The version is incorrect.');
868 } 870 }
869 return header; 871 return header;
870 } 872 }
871 } 873 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698