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

Unified Diff: third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Union.java

Issue 1142043005: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix type conversion errors on win64 for some msvs Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Union.java
diff --git a/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Union.java b/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Union.java
new file mode 100644
index 0000000000000000000000000000000000000000..90b40ea57b03a599ba5b2bd38ebc56afca60c592
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Union.java
@@ -0,0 +1,30 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.mojo.bindings;
+
+import org.chromium.mojo.system.Core;
+
+/**
+ * Base class for all mojo unions.
+ */
+public abstract class Union {
+ /**
+ * Returns the serialization of the union. This method can close Handles.
+ *
+ * @param core the |Core| implementation used to generate handles. Only used if the data
+ * structure being encoded contains interfaces, can be |null| otherwise.
+ */
+ public Message serialize(Core core) {
+ Encoder encoder = new Encoder(core, BindingsHelper.UNION_SIZE);
+ encoder.claimMemory(16);
+ encode(encoder, 0);
+ return encoder.getMessage();
+ }
+
+ /**
+ * Serializes this data structure using the given encoder.
+ */
+ protected abstract void encode(Encoder encoder, int offset);
+}

Powered by Google App Engine
This is Rietveld 408576698