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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp

Issue 1167343002: Add methods for creating V8 extras-based ReadableStreams from C++ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Trying blindly to resolve circular dependency Created 4 years, 10 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
Index: third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp b/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp
index 024320b1d9628118c51d2d979ff1d7faa2fc397d..05b554ea1c54b58d4f2081b56ca8626485f7f809 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp
@@ -6,10 +6,34 @@
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/ToV8.h"
#include "bindings/core/v8/V8ScriptRunner.h"
+#include "core/streams/UnderlyingSourceBase.h"
namespace blink {
+ScriptValue ReadableStreamOperations::createReadableStream(ScriptState* scriptState, UnderlyingSourceBase* underlyingSource, ScriptValue strategy)
+{
+ ScriptState::Scope scope(scriptState);
+
+ v8::Local<v8::Value> jsUnderlyingSource = toV8(underlyingSource, scriptState);
+ v8::Local<v8::Value> jsStrategy = strategy.v8Value();
+ v8::Local<v8::Value> args[] = { jsUnderlyingSource, jsStrategy };
+ v8::Local<v8::Value> jsStream = V8ScriptRunner::callExtraOrCrash(scriptState, "createReadableStreamWithExternalController", args);
+
+ return ScriptValue(scriptState, jsStream);
+}
+
+ScriptValue ReadableStreamOperations::createCountQueuingStrategy(ScriptState* scriptState, size_t highWaterMark)
+{
+ ScriptState::Scope scope(scriptState);
+
+ v8::Local<v8::Value> args[] = { v8::Number::New(scriptState->isolate(), highWaterMark) };
+ v8::Local<v8::Value> jsStrategy = V8ScriptRunner::callExtraOrCrash(scriptState, "createBuiltInCountQueuingStrategy", args);
+
+ return ScriptValue(scriptState, jsStrategy);
+}
+
ScriptValue ReadableStreamOperations::getReader(ScriptState* scriptState, ScriptValue stream, ExceptionState& es)
{
ASSERT(isReadableStream(scriptState, stream));

Powered by Google App Engine
This is Rietveld 408576698