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

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

Issue 2494823002: V8ScriptValueSerializer: Use PartitionAlloc for the buffer, and avoid copying it into a String. (Closed)
Patch Set: initialize SerializedScriptValue::m_dataBufferSize Created 4 years, 1 month 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/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 a1cf3967eac7c0cfaf79442f1833ee7c84e69cf8..5e2d7c5293820c4022e23d9ea46fa23569c29be2 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
@@ -55,20 +55,17 @@ v8::Local<v8::Value> SerializedScriptValueFactory::deserialize(
// in |this| being destroyed. Holding a RefPtr ensures we are alive (along
// with our internal data) throughout the operation.
RefPtr<SerializedScriptValue> protect(value);
- String& data = value->data();
- if (!data.impl())
+ if (!value->dataLengthInBytes())
return v8::Null(isolate);
static_assert(sizeof(SerializedScriptValueWriter::BufferValueType) == 2,
"BufferValueType should be 2 bytes");
- data.ensure16Bit();
// 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(
- reinterpret_cast<const uint8_t*>(data.impl()->characters16()),
- 2 * data.length(), blobInfo, value->blobDataHandles(),
- ScriptState::current(isolate));
+ SerializedScriptValueReader reader(value->data(), value->dataLengthInBytes(),
+ blobInfo, value->blobDataHandles(),
+ ScriptState::current(isolate));
ScriptValueDeserializer deserializer(reader, messagePorts,
value->getArrayBufferContentsArray(),
value->getImageBitmapContentsArray());

Powered by Google App Engine
This is Rietveld 408576698