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

Unified Diff: Source/core/streams/ScriptReadableStream.cpp

Issue 1118673002: Implement ReadableStream as a V8 extra (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanups; make controller a member instead of arg Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/streams/ScriptReadableStream.h ('k') | Source/core/streams/ScriptReadableStreamController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
+
+}
« no previous file with comments | « Source/core/streams/ScriptReadableStream.h ('k') | Source/core/streams/ScriptReadableStreamController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698