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

Unified Diff: third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.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/modules/v8/SerializedScriptValueForModulesFactory.cpp
diff --git a/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp b/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp
index 348e9e882fc5cc47d63e03969a7662893a0136c1..a1ffde32c094d34ee6f2fda4185d9a19142cf827 100644
--- a/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp
+++ b/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp
@@ -49,20 +49,17 @@ v8::Local<v8::Value> SerializedScriptValueForModulesFactory::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.
SerializedScriptValueReaderForModules reader(
- reinterpret_cast<const uint8_t*>(data.impl()->characters16()),
- 2 * data.length(), blobInfo, value->blobDataHandles(),
- ScriptState::current(isolate));
+ value->data(), value->dataLengthInBytes(), blobInfo,
+ value->blobDataHandles(), ScriptState::current(isolate));
ScriptValueDeserializerForModules deserializer(
reader, messagePorts, value->getArrayBufferContentsArray(),
value->getImageBitmapContentsArray());

Powered by Google App Engine
This is Rietveld 408576698