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 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 return false; | 1627 return false; |
1628 *value = toV8(imageData, m_scriptState->context()->Global(), isolate()); | 1628 *value = toV8(imageData, m_scriptState->context()->Global(), isolate()); |
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 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(imageData,
IntRect(0, 0, imageData->width(), imageData->height())); | 1637 RawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(imageData, IntRect(0,
0, imageData->width(), imageData->height())); |
1638 if (!imageBitmap.get()) | 1638 if (!imageBitmap.get()) |
1639 return false; | 1639 return false; |
1640 *value = toV8(imageBitmap.get(), m_scriptState->context()->Global(), isolate
()); | 1640 *value = toV8(imageBitmap.get(), m_scriptState->context()->Global(), isolate
()); |
1641 return !value->IsEmpty(); | 1641 return !value->IsEmpty(); |
1642 } | 1642 } |
1643 | 1643 |
1644 bool SerializedScriptValueReader::readCompositorProxy(v8::Local<v8::Value>* valu
e) | 1644 bool SerializedScriptValueReader::readCompositorProxy(v8::Local<v8::Value>* valu
e) |
1645 { | 1645 { |
1646 uint32_t attributes; | 1646 uint32_t attributes; |
1647 uint64_t element; | 1647 uint64_t element; |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 } | 2165 } |
2166 | 2166 |
2167 bool ScriptValueDeserializer::tryGetTransferredImageBitmap(uint32_t index, v8::L
ocal<v8::Value>* object) | 2167 bool ScriptValueDeserializer::tryGetTransferredImageBitmap(uint32_t index, v8::L
ocal<v8::Value>* object) |
2168 { | 2168 { |
2169 if (!m_imageBitmapContents) | 2169 if (!m_imageBitmapContents) |
2170 return false; | 2170 return false; |
2171 if (index >= m_imageBitmaps.size()) | 2171 if (index >= m_imageBitmaps.size()) |
2172 return false; | 2172 return false; |
2173 v8::Local<v8::Value> result = m_imageBitmaps.at(index); | 2173 v8::Local<v8::Value> result = m_imageBitmaps.at(index); |
2174 if (result.IsEmpty()) { | 2174 if (result.IsEmpty()) { |
2175 RefPtrWillBeRawPtr<ImageBitmap> bitmap = ImageBitmap::create(m_imageBitm
apContents->at(index)); | 2175 RawPtr<ImageBitmap> bitmap = ImageBitmap::create(m_imageBitmapContents->
at(index)); |
2176 v8::Isolate* isolate = m_reader.getScriptState()->isolate(); | 2176 v8::Isolate* isolate = m_reader.getScriptState()->isolate(); |
2177 v8::Local<v8::Object> creationContext = m_reader.getScriptState()->conte
xt()->Global(); | 2177 v8::Local<v8::Object> creationContext = m_reader.getScriptState()->conte
xt()->Global(); |
2178 result = toV8(bitmap.get(), creationContext, isolate); | 2178 result = toV8(bitmap.get(), creationContext, isolate); |
2179 if (result.IsEmpty()) | 2179 if (result.IsEmpty()) |
2180 return false; | 2180 return false; |
2181 m_imageBitmaps[index] = result; | 2181 m_imageBitmaps[index] = result; |
2182 } | 2182 } |
2183 *object = result; | 2183 *object = result; |
2184 return true; | 2184 return true; |
2185 } | 2185 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2276 return false; | 2276 return false; |
2277 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; | 2277 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; |
2278 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); | 2278 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); |
2279 if (objectReference >= m_objectPool.size()) | 2279 if (objectReference >= m_objectPool.size()) |
2280 return false; | 2280 return false; |
2281 *object = m_objectPool[objectReference]; | 2281 *object = m_objectPool[objectReference]; |
2282 return true; | 2282 return true; |
2283 } | 2283 } |
2284 | 2284 |
2285 } // namespace blink | 2285 } // namespace blink |
OLD | NEW |