 Chromium Code Reviews
 Chromium Code Reviews Issue 1167343002:
  Add methods for creating V8 extras-based ReadableStreams from C++  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 1167343002:
  Add methods for creating V8 extras-based ReadableStreams from C++  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| 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 36590becef6a1678e29cdf02e7882008aaee6b30..fd8ec52d030b97b149859346d17b6e0938056e46 100644 | 
| --- a/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp | 
| +++ b/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp | 
| @@ -6,10 +6,38 @@ | 
| #include "bindings/core/v8/ExceptionState.h" | 
| #include "bindings/core/v8/ScriptState.h" | 
| +#include "bindings/core/v8/ToV8.h" | 
| #include "bindings/core/v8/V8Binding.h" | 
| +#include "bindings/core/v8/V8RecursionScope.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(); | 
| + | 
| + V8RecursionScope::MicrotaskSuppression mtsScope(scriptState->isolate()); | 
| 
haraken
2016/01/25 00:13:29
Maybe it would make sense to create another versio
 
domenic
2016/02/02 22:59:55
Aren't all V8 extra functions internal functions?
 | 
| + v8::Local<v8::Value> args[] = { jsUnderlyingSource, jsStrategy }; | 
| + v8::Local<v8::Value> jsStream = v8CallExtraOrCrash(scriptState, "createReadableStreamWithExternalController", args); | 
| + | 
| + return ScriptValue(scriptState, jsStream); | 
| +} | 
| + | 
| +ScriptValue ReadableStreamOperations::createCountQueuingStrategy(ScriptState* scriptState, size_t highWaterMark) | 
| +{ | 
| + ScriptState::Scope scope(scriptState); | 
| + v8::Isolate* isolate = scriptState->isolate(); | 
| + | 
| + v8::Local<v8::Value> args[] = { v8::Number::New(isolate, highWaterMark) }; | 
| + v8::Local<v8::Value> jsStrategy = v8CallExtraOrCrash(scriptState, "createBuiltInCountQueuingStrategy", args); | 
| + | 
| + return ScriptValue(scriptState, jsStrategy); | 
| +} | 
| + | 
| ScriptValue ReadableStreamOperations::getReader(ScriptState* scriptState, ScriptValue stream, ExceptionState& es) | 
| { | 
| ASSERT(isReadableStream(scriptState, stream)); |