| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Implementation of WritableStream for Blink. See | 5 // Implementation of WritableStream for Blink. See |
| 6 // https://streams.spec.whatwg.org/#ws. The implementation closely follows the | 6 // https://streams.spec.whatwg.org/#ws. The implementation closely follows the |
| 7 // standard, except where required for performance or integration with Blink. In | 7 // standard, except where required for performance or integration with Blink. In |
| 8 // particular, classes, methods and abstract operations are implemented in the | 8 // particular, classes, methods and abstract operations are implemented in the |
| 9 // same order as in the standard, to simplify side-by-side reading. | 9 // same order as in the standard, to simplify side-by-side reading. |
| 10 | 10 |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 // TODO(ricea): Share this operation with ReadableStream.js. | 1034 // TODO(ricea): Share this operation with ReadableStream.js. |
| 1035 function ValidateAndNormalizeQueuingStrategy(size, highWaterMark) { | 1035 function ValidateAndNormalizeQueuingStrategy(size, highWaterMark) { |
| 1036 if (size !== undefined && typeof size !== 'function') { | 1036 if (size !== undefined && typeof size !== 'function') { |
| 1037 throw new TypeError(streamErrors.sizeNotAFunction); | 1037 throw new TypeError(streamErrors.sizeNotAFunction); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 highWaterMark = Number(highWaterMark); | 1040 highWaterMark = Number(highWaterMark); |
| 1041 if (Number_isNaN(highWaterMark)) { | 1041 if (Number_isNaN(highWaterMark)) { |
| 1042 throw new RangeError(streamErrors.errInvalidHWM); | 1042 throw new RangeError(streamErrors.invalidHWM); |
| 1043 } | 1043 } |
| 1044 if (highWaterMark < 0) { | 1044 if (highWaterMark < 0) { |
| 1045 throw new RangeError(streamErrors.invalidHWM); | 1045 throw new RangeError(streamErrors.invalidHWM); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 return {size, highWaterMark}; | 1048 return {size, highWaterMark}; |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 // | 1051 // |
| 1052 // Additions to the global object | 1052 // Additions to the global object |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1075 getWritableStreamDefaultWriterClosedPromise; | 1075 getWritableStreamDefaultWriterClosedPromise; |
| 1076 binding.WritableStreamDefaultWriterGetDesiredSize = | 1076 binding.WritableStreamDefaultWriterGetDesiredSize = |
| 1077 WritableStreamDefaultWriterGetDesiredSize; | 1077 WritableStreamDefaultWriterGetDesiredSize; |
| 1078 binding.getWritableStreamDefaultWriterReadyPromise = | 1078 binding.getWritableStreamDefaultWriterReadyPromise = |
| 1079 getWritableStreamDefaultWriterReadyPromise; | 1079 getWritableStreamDefaultWriterReadyPromise; |
| 1080 binding.WritableStreamDefaultWriterRelease = | 1080 binding.WritableStreamDefaultWriterRelease = |
| 1081 WritableStreamDefaultWriterRelease; | 1081 WritableStreamDefaultWriterRelease; |
| 1082 binding.WritableStreamDefaultWriterWrite = WritableStreamDefaultWriterWrite; | 1082 binding.WritableStreamDefaultWriterWrite = WritableStreamDefaultWriterWrite; |
| 1083 binding.getWritableStreamStoredError = getWritableStreamStoredError; | 1083 binding.getWritableStreamStoredError = getWritableStreamStoredError; |
| 1084 }); | 1084 }); |
| OLD | NEW |