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

Unified Diff: third_party/protobuf/java/core/src/main/java/com/google/protobuf/NioByteString.java

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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/protobuf/java/core/src/main/java/com/google/protobuf/NioByteString.java
diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/NioByteString.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/NioByteString.java
index 6163c7b1a81c3d0c4d35306b399322a179b948a3..76594809e8d65de45225c8ecf9ccef32c2c9a94b 100644
--- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/NioByteString.java
+++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/NioByteString.java
@@ -30,6 +30,8 @@
package com.google.protobuf;
+import static com.google.protobuf.Internal.checkNotNull;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.InvalidObjectException;
@@ -49,10 +51,9 @@ final class NioByteString extends ByteString.LeafByteString {
private final ByteBuffer buffer;
NioByteString(ByteBuffer buffer) {
- if (buffer == null) {
- throw new NullPointerException("buffer");
- }
+ checkNotNull(buffer, "buffer");
+ // Use native byte order for fast fixed32/64 operations.
this.buffer = buffer.slice().order(ByteOrder.nativeOrder());
}
@@ -266,7 +267,7 @@ final class NioByteString extends ByteString.LeafByteString {
@Override
public CodedInputStream newCodedInput() {
- return CodedInputStream.newInstance(buffer);
+ return CodedInputStream.newInstance(buffer, true);
}
/**

Powered by Google App Engine
This is Rietveld 408576698