| 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 "bindings/core/v8/ScriptValueSerializer.h" | 5 #include "bindings/core/v8/ScriptValueSerializer.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8ArrayBuffer.h" | 7 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 8 #include "bindings/core/v8/V8ArrayBufferView.h" | 8 #include "bindings/core/v8/V8ArrayBufferView.h" |
| 9 #include "bindings/core/v8/V8Blob.h" | 9 #include "bindings/core/v8/V8Blob.h" |
| 10 #include "bindings/core/v8/V8CompositorProxy.h" | 10 #include "bindings/core/v8/V8CompositorProxy.h" |
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 return !value->IsEmpty(); | 1629 return !value->IsEmpty(); |
| 1630 } | 1630 } |
| 1631 | 1631 |
| 1632 bool SerializedScriptValueReader::readImageBitmap(v8::Local<v8::Value>* value) | 1632 bool SerializedScriptValueReader::readImageBitmap(v8::Local<v8::Value>* value) |
| 1633 { | 1633 { |
| 1634 ImageData* imageData = doReadImageData(); | 1634 ImageData* imageData = doReadImageData(); |
| 1635 if (!imageData) | 1635 if (!imageData) |
| 1636 return false; | 1636 return false; |
| 1637 ImageBitmapOptions options; | 1637 ImageBitmapOptions options; |
| 1638 options.setPremultiplyAlpha("none"); | 1638 options.setPremultiplyAlpha("none"); |
| 1639 RawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(imageData, IntRect(0,
0, imageData->width(), imageData->height()), options, true); | 1639 ImageBitmap* imageBitmap = ImageBitmap::create(imageData, IntRect(0, 0, imag
eData->width(), imageData->height()), options, true); |
| 1640 if (!imageBitmap.get()) | 1640 if (!imageBitmap) |
| 1641 return false; | 1641 return false; |
| 1642 *value = toV8(imageBitmap.get(), m_scriptState->context()->Global(), isolate
()); | 1642 *value = toV8(imageBitmap, m_scriptState->context()->Global(), isolate()); |
| 1643 return !value->IsEmpty(); | 1643 return !value->IsEmpty(); |
| 1644 } | 1644 } |
| 1645 | 1645 |
| 1646 bool SerializedScriptValueReader::readCompositorProxy(v8::Local<v8::Value>* valu
e) | 1646 bool SerializedScriptValueReader::readCompositorProxy(v8::Local<v8::Value>* valu
e) |
| 1647 { | 1647 { |
| 1648 uint32_t attributes; | 1648 uint32_t attributes; |
| 1649 uint64_t element; | 1649 uint64_t element; |
| 1650 if (!doReadUint64(&element)) | 1650 if (!doReadUint64(&element)) |
| 1651 return false; | 1651 return false; |
| 1652 if (!doReadUint32(&attributes)) | 1652 if (!doReadUint32(&attributes)) |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2167 } | 2167 } |
| 2168 | 2168 |
| 2169 bool ScriptValueDeserializer::tryGetTransferredImageBitmap(uint32_t index, v8::L
ocal<v8::Value>* object) | 2169 bool ScriptValueDeserializer::tryGetTransferredImageBitmap(uint32_t index, v8::L
ocal<v8::Value>* object) |
| 2170 { | 2170 { |
| 2171 if (!m_imageBitmapContents) | 2171 if (!m_imageBitmapContents) |
| 2172 return false; | 2172 return false; |
| 2173 if (index >= m_imageBitmaps.size()) | 2173 if (index >= m_imageBitmaps.size()) |
| 2174 return false; | 2174 return false; |
| 2175 v8::Local<v8::Value> result = m_imageBitmaps.at(index); | 2175 v8::Local<v8::Value> result = m_imageBitmaps.at(index); |
| 2176 if (result.IsEmpty()) { | 2176 if (result.IsEmpty()) { |
| 2177 RawPtr<ImageBitmap> bitmap = ImageBitmap::create(m_imageBitmapContents->
at(index)); | 2177 ImageBitmap* bitmap = ImageBitmap::create(m_imageBitmapContents->at(inde
x)); |
| 2178 v8::Isolate* isolate = m_reader.getScriptState()->isolate(); | 2178 v8::Isolate* isolate = m_reader.getScriptState()->isolate(); |
| 2179 v8::Local<v8::Object> creationContext = m_reader.getScriptState()->conte
xt()->Global(); | 2179 v8::Local<v8::Object> creationContext = m_reader.getScriptState()->conte
xt()->Global(); |
| 2180 result = toV8(bitmap.get(), creationContext, isolate); | 2180 result = toV8(bitmap, creationContext, isolate); |
| 2181 if (result.IsEmpty()) | 2181 if (result.IsEmpty()) |
| 2182 return false; | 2182 return false; |
| 2183 m_imageBitmaps[index] = result; | 2183 m_imageBitmaps[index] = result; |
| 2184 } | 2184 } |
| 2185 *object = result; | 2185 *object = result; |
| 2186 return true; | 2186 return true; |
| 2187 } | 2187 } |
| 2188 | 2188 |
| 2189 bool ScriptValueDeserializer::tryGetTransferredSharedArrayBuffer(uint32_t index,
v8::Local<v8::Value>* object) | 2189 bool ScriptValueDeserializer::tryGetTransferredSharedArrayBuffer(uint32_t index,
v8::Local<v8::Value>* object) |
| 2190 { | 2190 { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 return false; | 2278 return false; |
| 2279 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; | 2279 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; |
| 2280 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); | 2280 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); |
| 2281 if (objectReference >= m_objectPool.size()) | 2281 if (objectReference >= m_objectPool.size()) |
| 2282 return false; | 2282 return false; |
| 2283 *object = m_objectPool[objectReference]; | 2283 *object = m_objectPool[objectReference]; |
| 2284 return true; | 2284 return true; |
| 2285 } | 2285 } |
| 2286 | 2286 |
| 2287 } // namespace blink | 2287 } // namespace blink |
| OLD | NEW |