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

Side by Side Diff: third_party/protobuf/js/binary/reader.js

Issue 1983203003: Update third_party/protobuf to protobuf-v3.0.0-beta-3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: owners Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 * Returns the internal read cursor. 173 * Returns the internal read cursor.
174 * @return {number} The internal read cursor. 174 * @return {number} The internal read cursor.
175 */ 175 */
176 jspb.BinaryReader.prototype.getCursor = function() { 176 jspb.BinaryReader.prototype.getCursor = function() {
177 return this.decoder_.getCursor(); 177 return this.decoder_.getCursor();
178 }; 178 };
179 179
180 180
181 /** 181 /**
182 * Returns the raw buffer. 182 * Returns the raw buffer.
183 * @return {Uint8Array} The raw buffer. 183 * @return {?Uint8Array} The raw buffer.
184 */ 184 */
185 jspb.BinaryReader.prototype.getBuffer = function() { 185 jspb.BinaryReader.prototype.getBuffer = function() {
186 return this.decoder_.getBuffer(); 186 return this.decoder_.getBuffer();
187 }; 187 };
188 188
189 189
190 /** 190 /**
191 * @return {number} The field number of the next field in the buffer, or 191 * @return {number} The field number of the next field in the buffer, or
192 * INVALID_FIELD_NUMBER if there is no next field. 192 * INVALID_FIELD_NUMBER if there is no next field.
193 */ 193 */
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 * @return {!jspb.BinaryDecoder} 585 * @return {!jspb.BinaryDecoder}
586 */ 586 */
587 jspb.BinaryReader.prototype.getFieldDecoder = function() { 587 jspb.BinaryReader.prototype.getFieldDecoder = function() {
588 goog.asserts.assert( 588 goog.asserts.assert(
589 this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED); 589 this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED);
590 590
591 var length = this.decoder_.readUnsignedVarint32(); 591 var length = this.decoder_.readUnsignedVarint32();
592 var start = this.decoder_.getCursor(); 592 var start = this.decoder_.getCursor();
593 var end = start + length; 593 var end = start + length;
594 594
595 var innerDecoder = jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(), 595 var innerDecoder =
596 start, length); 596 jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(), start, length);
597 this.decoder_.setCursor(end); 597 this.decoder_.setCursor(end);
598 return innerDecoder; 598 return innerDecoder;
599 }; 599 };
600 600
601 601
602 /** 602 /**
603 * Reads a signed 32-bit integer field from the binary stream, or throws an 603 * Reads a signed 32-bit integer field from the binary stream, or throws an
604 * error if the next field in the stream is not of the correct wire type. 604 * error if the next field in the stream is not of the correct wire type.
605 * 605 *
606 * @return {number} The value of the signed 32-bit integer field. 606 * @return {number} The value of the signed 32-bit integer field.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED); 862 this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED);
863 var length = this.decoder_.readUnsignedVarint32(); 863 var length = this.decoder_.readUnsignedVarint32();
864 return this.decoder_.readString(length); 864 return this.decoder_.readString(length);
865 }; 865 };
866 866
867 867
868 /** 868 /**
869 * Reads a length-prefixed block of bytes from the binary stream, or returns 869 * Reads a length-prefixed block of bytes from the binary stream, or returns
870 * null if the next field in the stream has an invalid length value. 870 * null if the next field in the stream has an invalid length value.
871 * 871 *
872 * @return {Uint8Array} The block of bytes. 872 * @return {!Uint8Array} The block of bytes.
873 */ 873 */
874 jspb.BinaryReader.prototype.readBytes = function() { 874 jspb.BinaryReader.prototype.readBytes = function() {
875 goog.asserts.assert( 875 goog.asserts.assert(
876 this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED); 876 this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED);
877 var length = this.decoder_.readUnsignedVarint32(); 877 var length = this.decoder_.readUnsignedVarint32();
878 return this.decoder_.readBytes(length); 878 return this.decoder_.readBytes(length);
879 }; 879 };
880 880
881 881
882 /** 882 /**
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1118
1119 1119
1120 /** 1120 /**
1121 * Reads a packed fixed hash64 field, which consists of a length header and a 1121 * Reads a packed fixed hash64 field, which consists of a length header and a
1122 * list of fixed hash64s. 1122 * list of fixed hash64s.
1123 * @return {!Array.<string>} 1123 * @return {!Array.<string>}
1124 */ 1124 */
1125 jspb.BinaryReader.prototype.readPackedFixedHash64 = function() { 1125 jspb.BinaryReader.prototype.readPackedFixedHash64 = function() {
1126 return this.readPackedField_(this.decoder_.readFixedHash64); 1126 return this.readPackedField_(this.decoder_.readFixedHash64);
1127 }; 1127 };
OLDNEW
« no previous file with comments | « third_party/protobuf/js/binary/proto_test.js ('k') | third_party/protobuf/js/binary/reader_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698