OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 part of bindings; | |
6 | |
7 abstract class Struct { | |
8 final int encodedSize; | |
9 | |
10 Struct(this.encodedSize); | |
11 | |
12 void encode(Encoder encoder); | |
13 | |
14 Message serialize() { | |
15 var encoder = new Encoder(encodedSize); | |
16 encode(encoder); | |
17 return encoder.message; | |
18 } | |
19 | |
20 ServiceMessage serializeWithHeader(MessageHeader header) { | |
21 var encoder = new Encoder(encodedSize + header.size); | |
22 header.encode(encoder); | |
23 encode(encoder); | |
24 return new ServiceMessage(encoder.message, header); | |
25 } | |
26 } | |
OLD | NEW |