Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 (function(global, binding, v8) { | 5 (function(global, binding, v8) { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 const readableStreamReader = v8.createPrivateSymbol('[[reader]]'); | 8 const readableStreamReader = v8.createPrivateSymbol('[[reader]]'); |
| 9 const readableStreamStoredError = v8.createPrivateSymbol('[[storedError]]'); | 9 const readableStreamStoredError = v8.createPrivateSymbol('[[storedError]]'); |
| 10 const readableStreamController = v8.createPrivateSymbol('[[controller]]'); | 10 const readableStreamController = v8.createPrivateSymbol('[[controller]]'); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 | 165 |
| 166 return ReadableStreamCancel(this, reason); | 166 return ReadableStreamCancel(this, reason); |
| 167 } | 167 } |
| 168 | 168 |
| 169 getReader({ mode } = {}) { | 169 getReader({ mode } = {}) { |
| 170 if (IsReadableStream(this) === false) { | 170 if (IsReadableStream(this) === false) { |
| 171 throw new TypeError(errIllegalInvocation); | 171 throw new TypeError(errIllegalInvocation); |
| 172 } | 172 } |
| 173 | 173 |
| 174 if (mode === 'byob') { | 174 if (mode === 'byob') { |
| 175 if (IsReadableByteStreamDefaultController(this[readableStreamController] ) === false) { | 175 // TODO(ricea): This should be "If |
| 176 // ! IsReadableByteStreamController(this.[[readableStreamController]]) | |
| 177 // is false". | |
| 178 if (IsReadableStreamDefaultController(this[readableStreamController])) { | |
|
tyoshino (SeeGerritForStatus)
2016/10/20 10:26:01
i think it's ok not to have this if and just throw
Adam Rice
2016/10/20 10:35:34
Done.
| |
| 176 throw new TypeError(errGetReaderNotByteStream); | 179 throw new TypeError(errGetReaderNotByteStream); |
| 177 } | 180 } |
| 178 | 181 |
| 179 return AcquireReadableStreamBYOBReader(this); | 182 // TODO(ricea): "Return ? AcquireReadableStreamBYOBReader(this)." |
| 180 } | 183 } |
| 181 | 184 |
| 182 if (mode === undefined) { | 185 if (mode === undefined) { |
| 183 return AcquireReadableStreamDefaultReader(this); | 186 return AcquireReadableStreamDefaultReader(this); |
| 184 } | 187 } |
| 185 | 188 |
| 186 throw new RangeError(errGetReaderBadMode); | 189 throw new RangeError(errGetReaderBadMode); |
| 187 } | 190 } |
| 188 | 191 |
| 189 tee() { | 192 tee() { |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 920 binding.ReadableStreamDefaultControllerGetDesiredSize = ReadableStreamDefaultC ontrollerGetDesiredSize; | 923 binding.ReadableStreamDefaultControllerGetDesiredSize = ReadableStreamDefaultC ontrollerGetDesiredSize; |
| 921 binding.ReadableStreamDefaultControllerEnqueue = ReadableStreamDefaultControll erEnqueue; | 924 binding.ReadableStreamDefaultControllerEnqueue = ReadableStreamDefaultControll erEnqueue; |
| 922 binding.ReadableStreamDefaultControllerError = ReadableStreamDefaultController Error; | 925 binding.ReadableStreamDefaultControllerError = ReadableStreamDefaultController Error; |
| 923 | 926 |
| 924 binding.createReadableStreamWithExternalController = | 927 binding.createReadableStreamWithExternalController = |
| 925 (underlyingSource, strategy) => { | 928 (underlyingSource, strategy) => { |
| 926 return new ReadableStream( | 929 return new ReadableStream( |
| 927 underlyingSource, strategy, createWithExternalControllerSentinel); | 930 underlyingSource, strategy, createWithExternalControllerSentinel); |
| 928 }; | 931 }; |
| 929 }); | 932 }); |
| OLD | NEW |