Commit 762d005e authored by Adam Rice's avatar Adam Rice Committed by Commit Bot

Fix WritableStreamNative::CreateWithCountQueueingStrategy dep on V8 Extras

WritableStreamNative::CreateWithCountQueueingStrategy() used the V8
Extras implementation of CountQueuingStrategy. Change it to use the
native implementation instead.

BUG=982550

Change-Id: I8d407d10259b26d30b3ae6262dca31889d557d89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1700101
Commit-Queue: Adam Rice <ricea@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681254}
parent 3a04db77
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
#include "third_party/blink/renderer/core/streams/writable_stream_native.h" #include "third_party/blink/renderer/core/streams/writable_stream_native.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/core/streams/count_queuing_strategy.h"
#include "third_party/blink/renderer/core/streams/miscellaneous_operations.h" #include "third_party/blink/renderer/core/streams/miscellaneous_operations.h"
#include "third_party/blink/renderer/core/streams/promise_handler.h" #include "third_party/blink/renderer/core/streams/promise_handler.h"
#include "third_party/blink/renderer/core/streams/queuing_strategy_init.h"
#include "third_party/blink/renderer/core/streams/readable_stream_native.h" #include "third_party/blink/renderer/core/streams/readable_stream_native.h"
#include "third_party/blink/renderer/core/streams/readable_stream_operations.h"
#include "third_party/blink/renderer/core/streams/stream_promise_resolver.h" #include "third_party/blink/renderer/core/streams/stream_promise_resolver.h"
#include "third_party/blink/renderer/core/streams/transferable_streams.h" #include "third_party/blink/renderer/core/streams/transferable_streams.h"
#include "third_party/blink/renderer/core/streams/underlying_sink_base.h" #include "third_party/blink/renderer/core/streams/underlying_sink_base.h"
...@@ -225,12 +226,14 @@ WritableStreamNative* WritableStreamNative::CreateWithCountQueueingStrategy( ...@@ -225,12 +226,14 @@ WritableStreamNative* WritableStreamNative::CreateWithCountQueueingStrategy(
UnderlyingSinkBase* underlying_sink, UnderlyingSinkBase* underlying_sink,
size_t high_water_mark) { size_t high_water_mark) {
// TODO(crbug.com/902633): This method of constructing a WritableStream // TODO(crbug.com/902633): This method of constructing a WritableStream
// introduces unnecessary trips through the V8. Perhaps we should implement // introduces unnecessary trips through V8. Implement algorithms based on an
// algorithms based on an UnderlyingSinkBase, or C++ stream implementations // UnderlyingSinkBase.
// should provide the algorithms directly. auto* init = QueuingStrategyInit::Create();
ScriptValue strategy = ReadableStreamOperations::CreateCountQueuingStrategy( init->setHighWaterMark(
script_state, high_water_mark); ScriptValue::From(script_state, static_cast<double>(high_water_mark)));
if (strategy.IsEmpty()) auto* strategy = CountQueuingStrategy::Create(script_state, init);
ScriptValue strategy_value = ScriptValue::From(script_state, strategy);
if (strategy_value.IsEmpty())
return nullptr; return nullptr;
auto underlying_sink_value = ScriptValue::From(script_state, underlying_sink); auto underlying_sink_value = ScriptValue::From(script_state, underlying_sink);
...@@ -239,7 +242,7 @@ WritableStreamNative* WritableStreamNative::CreateWithCountQueueingStrategy( ...@@ -239,7 +242,7 @@ WritableStreamNative* WritableStreamNative::CreateWithCountQueueingStrategy(
ExceptionState::kConstructionContext, ExceptionState::kConstructionContext,
"WritableStream"); "WritableStream");
auto* stream = MakeGarbageCollected<WritableStreamNative>( auto* stream = MakeGarbageCollected<WritableStreamNative>(
script_state, underlying_sink_value, strategy, exception_state); script_state, underlying_sink_value, strategy_value, exception_state);
if (exception_state.HadException()) if (exception_state.HadException())
return nullptr; return nullptr;
return stream; return stream;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment