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

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

Issue 2348263005: Eliminate one copy from ImageBitmap deserialization. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/ImageBitmap.h » ('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/ScriptValueSerializer.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
index 5fe3c4bbf2bc181f052bdd1c60396ca1b838aa15..4db5b33a8e21e1f51c8285c8633dbc79fc0dfdb9 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp
@@ -1812,10 +1812,9 @@ bool SerializedScriptValueReader::readImageBitmap(v8::Local<v8::Value>* value)
uint32_t pixelDataLength;
if (!doReadImageDataProperties(&width, &height, &pixelDataLength))
return false;
- std::unique_ptr<uint8_t[]> pixelData = wrapArrayUnique(new uint8_t[pixelDataLength]);
- memcpy(pixelData.get(), m_buffer + m_position, pixelDataLength);
+ const void* pixelData = m_buffer + m_position;
m_position += pixelDataLength;
- ImageBitmap* imageBitmap = ImageBitmap::create(std::move(pixelData), width, height, isPremultiplied, isOriginClean);
+ ImageBitmap* imageBitmap = ImageBitmap::create(pixelData, width, height, isPremultiplied, isOriginClean);
if (!imageBitmap)
return false;
*value = toV8(imageBitmap, m_scriptState->context()->Global(), isolate());
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/ImageBitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698