OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 #include "bindings/core/v8/ScriptValueSerializer.h" | 6 #include "bindings/core/v8/ScriptValueSerializer.h" |
7 | 7 |
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 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 uint32_t height; | 1393 uint32_t height; |
1394 uint32_t pixelDataLength; | 1394 uint32_t pixelDataLength; |
1395 if (!doReadUint32(&width)) | 1395 if (!doReadUint32(&width)) |
1396 return false; | 1396 return false; |
1397 if (!doReadUint32(&height)) | 1397 if (!doReadUint32(&height)) |
1398 return false; | 1398 return false; |
1399 if (!doReadUint32(&pixelDataLength)) | 1399 if (!doReadUint32(&pixelDataLength)) |
1400 return false; | 1400 return false; |
1401 if (m_position + pixelDataLength > m_length) | 1401 if (m_position + pixelDataLength > m_length) |
1402 return false; | 1402 return false; |
1403 RefPtrWillBeRawPtr<ImageData> imageData = ImageData::create(IntSize(width, h
eight)); | 1403 ImageData* imageData = ImageData::create(IntSize(width, height)); |
1404 DOMUint8ClampedArray* pixelArray = imageData->data(); | 1404 DOMUint8ClampedArray* pixelArray = imageData->data(); |
1405 ASSERT(pixelArray); | 1405 ASSERT(pixelArray); |
1406 ASSERT(pixelArray->length() >= pixelDataLength); | 1406 ASSERT(pixelArray->length() >= pixelDataLength); |
1407 memcpy(pixelArray->data(), m_buffer + m_position, pixelDataLength); | 1407 memcpy(pixelArray->data(), m_buffer + m_position, pixelDataLength); |
1408 m_position += pixelDataLength; | 1408 m_position += pixelDataLength; |
1409 *value = toV8(imageData.release(), m_scriptState->context()->Global(), isola
te()); | 1409 *value = toV8(imageData, m_scriptState->context()->Global(), isolate()); |
1410 return true; | 1410 return true; |
1411 } | 1411 } |
1412 | 1412 |
1413 bool SerializedScriptValueReader::readCompositorProxy(v8::Local<v8::Value>* valu
e) | 1413 bool SerializedScriptValueReader::readCompositorProxy(v8::Local<v8::Value>* valu
e) |
1414 { | 1414 { |
1415 uint32_t attributes; | 1415 uint32_t attributes; |
1416 uint64_t element; | 1416 uint64_t element; |
1417 if (!doReadUint64(&element)) | 1417 if (!doReadUint64(&element)) |
1418 return false; | 1418 return false; |
1419 if (!doReadUint32(&attributes)) | 1419 if (!doReadUint32(&attributes)) |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 return false; | 1934 return false; |
1935 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; | 1935 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; |
1936 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); | 1936 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); |
1937 if (objectReference >= m_objectPool.size()) | 1937 if (objectReference >= m_objectPool.size()) |
1938 return false; | 1938 return false; |
1939 *object = m_objectPool[objectReference]; | 1939 *object = m_objectPool[objectReference]; |
1940 return true; | 1940 return true; |
1941 } | 1941 } |
1942 | 1942 |
1943 } // namespace blink | 1943 } // namespace blink |
OLD | NEW |