Commit 1300b578 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Used the passed in isolate in SerializedScriptValue

... instead of v8::Isolate::Current() which is discouraged.

Bug: 954679
Change-Id: I0b27a84f7da62a8dcd8b8851ccdbe61c8662799d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2104771Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750477}
parent 72b58157
......@@ -532,6 +532,9 @@ bool SerializedScriptValue::ExtractTransferables(
ExceptionState& exception_state) {
// Validate the passed array of transferables.
wtf_size_t i = 0;
bool transferable_streams_enabled =
RuntimeEnabledFeatures::TransferableStreamsEnabled(
CurrentExecutionContext(isolate));
for (const auto& script_value : object_sequence) {
v8::Local<v8::Value> transferable_object = script_value.V8Value();
// Validation of non-null objects, per HTML5 spec 10.3.3.
......@@ -611,7 +614,7 @@ bool SerializedScriptValue::ExtractTransferables(
return false;
}
transferables.offscreen_canvases.push_back(offscreen_canvas);
} else if (TransferableStreamsEnabled() &&
} else if (transferable_streams_enabled &&
V8ReadableStream::HasInstance(transferable_object, isolate)) {
ReadableStream* stream = V8ReadableStream::ToImpl(
v8::Local<v8::Object>::Cast(transferable_object));
......@@ -623,7 +626,7 @@ bool SerializedScriptValue::ExtractTransferables(
return false;
}
transferables.readable_streams.push_back(stream);
} else if (TransferableStreamsEnabled() &&
} else if (transferable_streams_enabled &&
V8WritableStream::HasInstance(transferable_object, isolate)) {
WritableStream* stream = V8WritableStream::ToImpl(
v8::Local<v8::Object>::Cast(transferable_object));
......@@ -635,7 +638,7 @@ bool SerializedScriptValue::ExtractTransferables(
return false;
}
transferables.writable_streams.push_back(stream);
} else if (TransferableStreamsEnabled() &&
} else if (transferable_streams_enabled &&
V8TransformStream::HasInstance(transferable_object, isolate)) {
TransformStream* stream = V8TransformStream::ToImpl(
v8::Local<v8::Object>::Cast(transferable_object));
......@@ -773,9 +776,4 @@ bool SerializedScriptValue::IsOriginCheckRequired() const {
return native_file_system_tokens_.size() > 0;
}
bool SerializedScriptValue::TransferableStreamsEnabled() {
return RuntimeEnabledFeatures::TransferableStreamsEnabled(
ExecutionContext::From(v8::Isolate::GetCurrent()->GetCurrentContext()));
}
} // namespace blink
......@@ -326,8 +326,6 @@ class CORE_EXPORT SerializedScriptValue
void CloneSharedArrayBuffers(SharedArrayBufferArray&);
static bool TransferableStreamsEnabled();
DataBufferPtr data_buffer_;
size_t data_buffer_size_ = 0;
......
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