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