| 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 package org.chromium.mojo.bindings; | |
| 6 | |
| 7 import org.chromium.mojo.system.Core; | |
| 8 | |
| 9 /** | |
| 10 * Base class for all mojo unions. | |
| 11 */ | |
| 12 public abstract class Union { | |
| 13 /** | |
| 14 * Returns the serialization of the union. This method can close Handles. | |
| 15 * | |
| 16 * @param core the |Core| implementation used to generate handles. Only used
if the data | |
| 17 * structure being encoded contains interfaces, can be |null| oth
erwise. | |
| 18 */ | |
| 19 public Message serialize(Core core) { | |
| 20 Encoder encoder = new Encoder(core, BindingsHelper.UNION_SIZE); | |
| 21 encoder.claimMemory(16); | |
| 22 encode(encoder, 0); | |
| 23 return encoder.getMessage(); | |
| 24 } | |
| 25 | |
| 26 /** | |
| 27 * Serializes this data structure using the given encoder. | |
| 28 */ | |
| 29 protected abstract void encode(Encoder encoder, int offset); | |
| 30 } | |
| OLD | NEW |