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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/ImageBitmap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptValueSerializer.h" 5 #include "bindings/core/v8/ScriptValueSerializer.h"
6 6
7 #include "bindings/core/v8/Transferables.h" 7 #include "bindings/core/v8/Transferables.h"
8 #include "bindings/core/v8/V8ArrayBuffer.h" 8 #include "bindings/core/v8/V8ArrayBuffer.h"
9 #include "bindings/core/v8/V8ArrayBufferView.h" 9 #include "bindings/core/v8/V8ArrayBufferView.h"
10 #include "bindings/core/v8/V8Blob.h" 10 #include "bindings/core/v8/V8Blob.h"
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 if (!doReadUint32(&isOriginClean)) 1805 if (!doReadUint32(&isOriginClean))
1806 return false; 1806 return false;
1807 uint32_t isPremultiplied; 1807 uint32_t isPremultiplied;
1808 if (!doReadUint32(&isPremultiplied)) 1808 if (!doReadUint32(&isPremultiplied))
1809 return false; 1809 return false;
1810 uint32_t width; 1810 uint32_t width;
1811 uint32_t height; 1811 uint32_t height;
1812 uint32_t pixelDataLength; 1812 uint32_t pixelDataLength;
1813 if (!doReadImageDataProperties(&width, &height, &pixelDataLength)) 1813 if (!doReadImageDataProperties(&width, &height, &pixelDataLength))
1814 return false; 1814 return false;
1815 std::unique_ptr<uint8_t[]> pixelData = wrapArrayUnique(new uint8_t[pixelData Length]); 1815 const void* pixelData = m_buffer + m_position;
1816 memcpy(pixelData.get(), m_buffer + m_position, pixelDataLength);
1817 m_position += pixelDataLength; 1816 m_position += pixelDataLength;
1818 ImageBitmap* imageBitmap = ImageBitmap::create(std::move(pixelData), width, height, isPremultiplied, isOriginClean); 1817 ImageBitmap* imageBitmap = ImageBitmap::create(pixelData, width, height, isP remultiplied, isOriginClean);
1819 if (!imageBitmap) 1818 if (!imageBitmap)
1820 return false; 1819 return false;
1821 *value = toV8(imageBitmap, m_scriptState->context()->Global(), isolate()); 1820 *value = toV8(imageBitmap, m_scriptState->context()->Global(), isolate());
1822 return !value->IsEmpty(); 1821 return !value->IsEmpty();
1823 } 1822 }
1824 1823
1825 bool SerializedScriptValueReader::readCompositorProxy(v8::Local<v8::Value>* valu e) 1824 bool SerializedScriptValueReader::readCompositorProxy(v8::Local<v8::Value>* valu e)
1826 { 1825 {
1827 uint32_t attributes; 1826 uint32_t attributes;
1828 uint64_t element; 1827 uint64_t element;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 return false; 2492 return false;
2494 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1]; 2493 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1];
2495 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1); 2494 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1);
2496 if (objectReference >= m_objectPool.size()) 2495 if (objectReference >= m_objectPool.size())
2497 return false; 2496 return false;
2498 *object = m_objectPool[objectReference]; 2497 *object = m_objectPool[objectReference];
2499 return true; 2498 return true;
2500 } 2499 }
2501 2500
2502 } // namespace blink 2501 } // namespace blink
OLDNEW
« 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