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

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

Issue 2305703002: Move V8-based serialization into dedicated classes and add support for ArrayBuffer transfer. (Closed)
Patch Set: reviewer comments Created 4 years, 3 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/SerializedScriptValue.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
index b2c7ce23d92aeb982d322863cf6487ea9a521718..e463aaaa9f8b5117382937e138bdf43965c6053e 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -42,6 +42,8 @@
#include "bindings/core/v8/V8MessagePort.h"
#include "bindings/core/v8/V8OffscreenCanvas.h"
#include "bindings/core/v8/V8SharedArrayBuffer.h"
+#include "bindings/core/v8/serialization/V8ScriptValueDeserializer.h"
+#include "bindings/core/v8/serialization/V8ScriptValueSerializer.h"
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/DOMSharedArrayBuffer.h"
#include "core/dom/ExceptionCode.h"
@@ -62,6 +64,12 @@ namespace blink {
PassRefPtr<SerializedScriptValue> SerializedScriptValue::serialize(v8::Isolate* isolate, v8::Local<v8::Value> value, Transferables* transferables, WebBlobInfoArray* blobInfo, ExceptionState& exception)
{
+ // TODO(jbroman): Move the V8-based structured clone invocation into
+ // SerializedScriptValueFactory.
+ if (RuntimeEnabledFeatures::v8BasedStructuredCloneEnabled()) {
+ V8ScriptValueSerializer serializer(ScriptState::current(isolate));
+ return serializer.serialize(value, transferables, exception);
+ }
return SerializedScriptValueFactory::instance().create(isolate, value, transferables, blobInfo, exception);
}
@@ -270,6 +278,12 @@ v8::Local<v8::Value> SerializedScriptValue::deserialize(MessagePortArray* messag
v8::Local<v8::Value> SerializedScriptValue::deserialize(v8::Isolate* isolate, MessagePortArray* messagePorts, const WebBlobInfoArray* blobInfo)
{
+ // TODO(jbroman): Move the V8-based structured clone invocation into
+ // SerializedScriptValueFactory.
+ if (RuntimeEnabledFeatures::v8BasedStructuredCloneEnabled()) {
+ V8ScriptValueDeserializer deserializer(ScriptState::current(isolate), this);
+ return deserializer.deserialize();
+ }
return SerializedScriptValueFactory::instance().deserialize(this, isolate, messagePorts, blobInfo);
}

Powered by Google App Engine
This is Rietveld 408576698