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

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

Issue 2684843005: Inline the V8BasedStructuredClone feature. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValueFuzzer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
index 9bc601d0ab767dd56135dc709ba7dde04909f501..84b662a55bdeffd5a37bf2c8b2c068991de43b82 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
@@ -4,17 +4,9 @@
#include "bindings/core/v8/SerializedScriptValueFactory.h"
-#include "bindings/core/v8/ExceptionState.h"
-#include "bindings/core/v8/ScriptValueSerializer.h"
-#include "bindings/core/v8/Transferables.h"
#include "bindings/core/v8/serialization/V8ScriptValueDeserializer.h"
#include "bindings/core/v8/serialization/V8ScriptValueSerializer.h"
-#include "core/dom/DOMArrayBuffer.h"
-#include "core/dom/MessagePort.h"
-#include "core/frame/ImageBitmap.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
-#include "wtf/ByteOrder.h"
-#include "wtf/text/StringBuffer.h"
namespace blink {
@@ -27,14 +19,8 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(
WebBlobInfoArray* blobInfo,
ExceptionState& exceptionState) {
TRACE_EVENT0("blink", "SerializedScriptValueFactory::create");
- if (RuntimeEnabledFeatures::v8BasedStructuredCloneEnabled()) {
- V8ScriptValueSerializer serializer(ScriptState::current(isolate));
- serializer.setBlobInfoArray(blobInfo);
- return serializer.serialize(value, transferables, exceptionState);
- }
- SerializedScriptValueWriter writer;
- ScriptValueSerializer serializer(writer, blobInfo,
- ScriptState::current(isolate));
+ V8ScriptValueSerializer serializer(ScriptState::current(isolate));
+ serializer.setBlobInfoArray(blobInfo);
return serializer.serialize(value, transferables, exceptionState);
}
@@ -44,35 +30,9 @@ v8::Local<v8::Value> SerializedScriptValueFactory::deserialize(
MessagePortArray* messagePorts,
const WebBlobInfoArray* blobInfo) {
TRACE_EVENT0("blink", "SerializedScriptValueFactory::deserialize");
- if (RuntimeEnabledFeatures::v8BasedStructuredCloneEnabled()) {
- V8ScriptValueDeserializer deserializer(ScriptState::current(isolate),
- value);
- deserializer.setTransferredMessagePorts(messagePorts);
- deserializer.setBlobInfoArray(blobInfo);
- return deserializer.deserialize();
- }
- // deserialize() can run arbitrary script (e.g., setters), which could result
- // in |this| being destroyed. Holding a RefPtr ensures we are alive (along
- // with our internal data) throughout the operation.
- RefPtr<SerializedScriptValue> protect(value);
- if (!value->dataLengthInBytes())
- return v8::Null(isolate);
- static_assert(sizeof(SerializedScriptValueWriter::BufferValueType) == 2,
- "BufferValueType should be 2 bytes");
- // FIXME: SerializedScriptValue shouldn't use String for its underlying
- // storage. Instead, it should use SharedBuffer or Vector<uint8_t>. The
- // information stored in m_data isn't even encoded in UTF-16. Instead,
- // unicode characters are encoded as UTF-8 with two code units per UChar.
- SerializedScriptValueReader reader(value->data(), value->dataLengthInBytes(),
- blobInfo, value->blobDataHandles(),
- ScriptState::current(isolate));
- ScriptValueDeserializer deserializer(reader, messagePorts,
- value->getArrayBufferContentsArray(),
- value->getImageBitmapContentsArray());
-
- // deserialize() can run arbitrary script (e.g., setters), which could result
- // in |this| being destroyed. Holding a RefPtr ensures we are alive (along
- // with our internal data) throughout the operation.
+ V8ScriptValueDeserializer deserializer(ScriptState::current(isolate), value);
+ deserializer.setTransferredMessagePorts(messagePorts);
+ deserializer.setBlobInfoArray(blobInfo);
return deserializer.deserialize();
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValueFuzzer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698