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/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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 if (offscreenCanvas->isNeutered()) | 1320 if (offscreenCanvas->isNeutered()) |
1321 return handleError( | 1321 return handleError( |
1322 Status::DataCloneError, | 1322 Status::DataCloneError, |
1323 "An OffscreenCanvas is detached and could not be cloned.", next); | 1323 "An OffscreenCanvas is detached and could not be cloned.", next); |
1324 if (offscreenCanvas->renderingContext()) | 1324 if (offscreenCanvas->renderingContext()) |
1325 return handleError(Status::DataCloneError, | 1325 return handleError(Status::DataCloneError, |
1326 "An OffscreenCanvas with a context could not be cloned.", | 1326 "An OffscreenCanvas with a context could not be cloned.", |
1327 next); | 1327 next); |
1328 m_writer.writeTransferredOffscreenCanvas( | 1328 m_writer.writeTransferredOffscreenCanvas( |
1329 offscreenCanvas->width(), offscreenCanvas->height(), | 1329 offscreenCanvas->width(), offscreenCanvas->height(), |
1330 offscreenCanvas->getAssociatedCanvasId(), offscreenCanvas->clientId(), | 1330 offscreenCanvas->placeholderCanvasId(), offscreenCanvas->clientId(), |
1331 offscreenCanvas->sinkId(), offscreenCanvas->localId(), | 1331 offscreenCanvas->sinkId(), offscreenCanvas->localId(), |
1332 offscreenCanvas->nonce()); | 1332 offscreenCanvas->nonce()); |
1333 return nullptr; | 1333 return nullptr; |
1334 } | 1334 } |
1335 | 1335 |
1336 ScriptValueSerializer::StateBase* | 1336 ScriptValueSerializer::StateBase* |
1337 ScriptValueSerializer::writeTransferredSharedArrayBuffer( | 1337 ScriptValueSerializer::writeTransferredSharedArrayBuffer( |
1338 v8::Local<v8::Value> value, | 1338 v8::Local<v8::Value> value, |
1339 uint32_t index, | 1339 uint32_t index, |
1340 StateBase* next) { | 1340 StateBase* next) { |
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2589 bool ScriptValueDeserializer::tryGetTransferredOffscreenCanvas( | 2589 bool ScriptValueDeserializer::tryGetTransferredOffscreenCanvas( |
2590 uint32_t width, | 2590 uint32_t width, |
2591 uint32_t height, | 2591 uint32_t height, |
2592 uint32_t canvasId, | 2592 uint32_t canvasId, |
2593 uint32_t clientId, | 2593 uint32_t clientId, |
2594 uint32_t sinkId, | 2594 uint32_t sinkId, |
2595 uint32_t localId, | 2595 uint32_t localId, |
2596 uint64_t nonce, | 2596 uint64_t nonce, |
2597 v8::Local<v8::Value>* object) { | 2597 v8::Local<v8::Value>* object) { |
2598 OffscreenCanvas* offscreenCanvas = OffscreenCanvas::create(width, height); | 2598 OffscreenCanvas* offscreenCanvas = OffscreenCanvas::create(width, height); |
2599 offscreenCanvas->setAssociatedCanvasId(canvasId); | 2599 offscreenCanvas->setPlaceholderCanvasId(canvasId); |
2600 offscreenCanvas->setSurfaceId(clientId, sinkId, localId, nonce); | 2600 offscreenCanvas->setSurfaceId(clientId, sinkId, localId, nonce); |
2601 *object = toV8(offscreenCanvas, m_reader.getScriptState()); | 2601 *object = toV8(offscreenCanvas, m_reader.getScriptState()); |
2602 if ((*object).IsEmpty()) | 2602 if ((*object).IsEmpty()) |
2603 return false; | 2603 return false; |
2604 return true; | 2604 return true; |
2605 } | 2605 } |
2606 | 2606 |
2607 bool ScriptValueDeserializer::tryGetObjectFromObjectReference( | 2607 bool ScriptValueDeserializer::tryGetObjectFromObjectReference( |
2608 uint32_t reference, | 2608 uint32_t reference, |
2609 v8::Local<v8::Value>* object) { | 2609 v8::Local<v8::Value>* object) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2676 m_openCompositeReferenceStack[m_openCompositeReferenceStack.size() - 1]; | 2676 m_openCompositeReferenceStack[m_openCompositeReferenceStack.size() - 1]; |
2677 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - | 2677 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - |
2678 1); | 2678 1); |
2679 if (objectReference >= m_objectPool.size()) | 2679 if (objectReference >= m_objectPool.size()) |
2680 return false; | 2680 return false; |
2681 *object = m_objectPool[objectReference]; | 2681 *object = m_objectPool[objectReference]; |
2682 return true; | 2682 return true; |
2683 } | 2683 } |
2684 | 2684 |
2685 } // namespace blink | 2685 } // namespace blink |
OLD | NEW |