Index: Source/core/streams/ScriptReadableStream.cpp |
diff --git a/Source/core/streams/ScriptReadableStream.cpp b/Source/core/streams/ScriptReadableStream.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7c1297b07a1b0e2f760f03c5151b41da0a4c1ff6 |
--- /dev/null |
+++ b/Source/core/streams/ScriptReadableStream.cpp |
@@ -0,0 +1,31 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "config.h" |
+#include "core/streams/ScriptReadableStream.h" |
+ |
+#include "bindings/core/v8/ToV8.h" |
+ |
+namespace blink { |
+ |
+ScriptReadableStream::ScriptReadableStream(ScriptState* scriptState, ScriptUnderlyingSource* underlyingSource, ScriptQueuingStrategy* strategy) |
+{ |
+ ScriptState::Scope scope(scriptState); |
+ |
+ auto global = scriptState->context()->Global(); |
+ auto isolate = scriptState->isolate(); |
+ |
+ auto jsUnderlyingSource = toV8(underlyingSource, global, isolate); |
+ auto jsStrategy = toV8(strategy, global, isolate); |
+ |
+ auto sentinel = scriptState->getFromExtrasExports("createWithExternalControllerSentinel").v8Value(); |
+ auto constructor = scriptState->getFromExtrasExports("ReadableStream").v8Value().As<v8::Function>(); |
+ |
+ v8::Local<v8::Value> args[] = { jsUnderlyingSource, jsStrategy, sentinel }; |
+ auto jsStream = constructor->NewInstance(3, args); |
+ |
+ m_stream = ScriptValue(scriptState, jsStream); |
+} |
+ |
+} |