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

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

Issue 648683003: mojo: Add maps to java bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Follow review Created 6 years, 2 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: mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java
index efb984264e7f9b5e910cb11f5a457187f0fe6f56..80ed9d1f20e76b1ea562796bfe97503f33390a6c 100644
--- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java
+++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java
@@ -145,6 +145,21 @@ public class Decoder {
}
/**
+ * Deserializes a {@link DataHeader} at the given offset and checks if it is correct for a map.
+ */
+ public void readDataHeaderForMap() {
+ DataHeader si = readDataHeader();
+ if (si.size != BindingsHelper.MAP_STRUCT_HEADER.size) {
+ throw new DeserializationException(
+ "Incorrect header for map. The size is incorrect.");
+ }
+ if (si.numFields != BindingsHelper.MAP_STRUCT_HEADER.numFields) {
+ throw new DeserializationException(
+ "Incorrect header for map. The number of fields is incorrect.");
+ }
+ }
+
+ /**
* Deserializes a byte at the given offset.
*/
public byte readByte(int offset) {

Powered by Google App Engine
This is Rietveld 408576698