| 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 #include "core/streams/ReadableStreamOperations.h" | 5 #include "core/streams/ReadableStreamOperations.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/ToV8.h" | 9 #include "bindings/core/v8/ToV8.h" |
| 10 #include "bindings/core/v8/V8ScriptRunner.h" | 10 #include "bindings/core/v8/V8ScriptRunner.h" |
| 11 #include "core/streams/UnderlyingSourceBase.h" | 11 #include "core/streams/UnderlyingSourceBase.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 ScriptValue ReadableStreamOperations::createReadableStream( | 15 ScriptValue ReadableStreamOperations::createReadableStream( |
| 16 ScriptState* scriptState, | 16 ScriptState* scriptState, |
| 17 UnderlyingSourceBase* underlyingSource, | 17 UnderlyingSourceBase* underlyingSource, |
| 18 ScriptValue strategy) { | 18 ScriptValue strategy) { |
| 19 ScriptState::Scope scope(scriptState); | 19 ScriptState::Scope scope(scriptState); |
| 20 | 20 |
| 21 v8::Local<v8::Value> jsUnderlyingSource = toV8(underlyingSource, scriptState); | 21 v8::Local<v8::Value> jsUnderlyingSource = ToV8(underlyingSource, scriptState); |
| 22 v8::Local<v8::Value> jsStrategy = strategy.v8Value(); | 22 v8::Local<v8::Value> jsStrategy = strategy.v8Value(); |
| 23 v8::Local<v8::Value> args[] = {jsUnderlyingSource, jsStrategy}; | 23 v8::Local<v8::Value> args[] = {jsUnderlyingSource, jsStrategy}; |
| 24 return ScriptValue( | 24 return ScriptValue( |
| 25 scriptState, | 25 scriptState, |
| 26 V8ScriptRunner::callExtraOrCrash( | 26 V8ScriptRunner::callExtraOrCrash( |
| 27 scriptState, "createReadableStreamWithExternalController", args)); | 27 scriptState, "createReadableStreamWithExternalController", args)); |
| 28 } | 28 } |
| 29 | 29 |
| 30 ScriptValue ReadableStreamOperations::createCountQueuingStrategy( | 30 ScriptValue ReadableStreamOperations::createCountQueuingStrategy( |
| 31 ScriptState* scriptState, | 31 ScriptState* scriptState, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 *newStream1 = ScriptValue( | 167 *newStream1 = ScriptValue( |
| 168 scriptState, branches->Get(scriptState->context(), 0).ToLocalChecked()); | 168 scriptState, branches->Get(scriptState->context(), 0).ToLocalChecked()); |
| 169 *newStream2 = ScriptValue( | 169 *newStream2 = ScriptValue( |
| 170 scriptState, branches->Get(scriptState->context(), 1).ToLocalChecked()); | 170 scriptState, branches->Get(scriptState->context(), 1).ToLocalChecked()); |
| 171 | 171 |
| 172 DCHECK(isReadableStream(scriptState, *newStream1)); | 172 DCHECK(isReadableStream(scriptState, *newStream1)); |
| 173 DCHECK(isReadableStream(scriptState, *newStream2)); | 173 DCHECK(isReadableStream(scriptState, *newStream2)); |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace blink | 176 } // namespace blink |
| OLD | NEW |