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

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

Issue 1157843002: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/DataHeader.java
diff --git a/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/DataHeader.java b/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/DataHeader.java
new file mode 100644
index 0000000000000000000000000000000000000000..96acec943809b20a6ec30fc02dbea572a8ad7538
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/DataHeader.java
@@ -0,0 +1,70 @@
+// Copyright 2015 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;
+
+/**
+ * The header for a mojo complex element.
+ */
+public final class DataHeader {
+ /**
+ * The size of a serialized header, in bytes.
+ */
+ public static final int HEADER_SIZE = 8;
+
+ /**
+ * The offset of the size field.
+ */
+ public static final int SIZE_OFFSET = 0;
+
+ /**
+ * The offset of the number of fields field.
+ */
+ public static final int ELEMENTS_OR_VERSION_OFFSET = 4;
+
+ /**
+ * The size of the object owning this header.
+ */
+ public final int size;
+
+ /**
+ * Number of element (for an array) or version (for a struct) of the object owning this
+ * header.
+ */
+ public final int elementsOrVersion;
+
+ /**
+ * Constructor.
+ */
+ public DataHeader(int size, int elementsOrVersion) {
+ super();
+ this.size = size;
+ this.elementsOrVersion = elementsOrVersion;
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + elementsOrVersion;
+ result = prime * result + size;
+ return result;
+ }
+
+ /**
+ * @see Object#equals(Object)
+ */
+ @Override
+ public boolean equals(Object object) {
+ if (object == this) return true;
+ if (object == null) return false;
+ if (getClass() != object.getClass()) return false;
+
+ DataHeader other = (DataHeader) object;
+ return (elementsOrVersion == other.elementsOrVersion && size == other.size);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698