| 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 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2651 bool ScriptValueDeserializer::doDeserialize() { | 2651 bool ScriptValueDeserializer::doDeserialize() { |
| 2652 v8::Local<v8::Value> value; | 2652 v8::Local<v8::Value> value; |
| 2653 if (!read(&value)) | 2653 if (!read(&value)) |
| 2654 return false; | 2654 return false; |
| 2655 if (!value.IsEmpty()) | 2655 if (!value.IsEmpty()) |
| 2656 push(value); | 2656 push(value); |
| 2657 return true; | 2657 return true; |
| 2658 } | 2658 } |
| 2659 | 2659 |
| 2660 v8::Local<v8::Value> ScriptValueDeserializer::element(unsigned index) { | 2660 v8::Local<v8::Value> ScriptValueDeserializer::element(unsigned index) { |
| 2661 ASSERT_WITH_SECURITY_IMPLICATION(index < m_stack.size()); | 2661 SECURITY_DCHECK(index < m_stack.size()); |
| 2662 return m_stack[index]; | 2662 return m_stack[index]; |
| 2663 } | 2663 } |
| 2664 | 2664 |
| 2665 void ScriptValueDeserializer::openComposite( | 2665 void ScriptValueDeserializer::openComposite( |
| 2666 const v8::Local<v8::Value>& object) { | 2666 const v8::Local<v8::Value>& object) { |
| 2667 uint32_t newObjectReference = m_objectPool.size(); | 2667 uint32_t newObjectReference = m_objectPool.size(); |
| 2668 m_openCompositeReferenceStack.append(newObjectReference); | 2668 m_openCompositeReferenceStack.append(newObjectReference); |
| 2669 m_objectPool.append(object); | 2669 m_objectPool.append(object); |
| 2670 } | 2670 } |
| 2671 | 2671 |
| 2672 bool ScriptValueDeserializer::closeComposite(v8::Local<v8::Value>* object) { | 2672 bool ScriptValueDeserializer::closeComposite(v8::Local<v8::Value>* object) { |
| 2673 if (!m_openCompositeReferenceStack.size()) | 2673 if (!m_openCompositeReferenceStack.size()) |
| 2674 return false; | 2674 return false; |
| 2675 uint32_t objectReference = | 2675 uint32_t objectReference = |
| 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 |