| 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 // HTML5 structured clone algorithm. | 679 // HTML5 structured clone algorithm. |
| 680 static bool isHostObject(v8::Local<v8::Object> object) | 680 static bool isHostObject(v8::Local<v8::Object> object) |
| 681 { | 681 { |
| 682 // If the object has any internal fields, then we won't be able to serialize
or deserialize | 682 // If the object has any internal fields, then we won't be able to serialize
or deserialize |
| 683 // them; conveniently, this is also a quick way to detect DOM wrapper object
s, because | 683 // them; conveniently, this is also a quick way to detect DOM wrapper object
s, because |
| 684 // the mechanism for these relies on data stored in these fields. We should | 684 // the mechanism for these relies on data stored in these fields. We should |
| 685 // catch external array data as a special case. | 685 // catch external array data as a special case. |
| 686 return object->InternalFieldCount(); | 686 return object->InternalFieldCount(); |
| 687 } | 687 } |
| 688 | 688 |
| 689 ScriptValueSerializer::ScriptValueSerializer(SerializedScriptValueWriter& writer
, const Transferables* transferables, WebBlobInfoArray* blobInfo, BlobDataHandle
Map& blobDataHandles, v8::TryCatch& tryCatch, ScriptState* scriptState) | 689 ScriptValueSerializer::ScriptValueSerializer(SerializedScriptValueWriter& writer
, Transferables* transferables, WebBlobInfoArray* blobInfo, BlobDataHandleMap& b
lobDataHandles, v8::TryCatch& tryCatch, ScriptState* scriptState) |
| 690 : m_scriptState(scriptState) | 690 : m_scriptState(scriptState) |
| 691 , m_writer(writer) | 691 , m_writer(writer) |
| 692 , m_tryCatch(tryCatch) | 692 , m_tryCatch(tryCatch) |
| 693 , m_depth(0) | 693 , m_depth(0) |
| 694 , m_status(Success) | 694 , m_status(Success) |
| 695 , m_nextObjectReference(0) | 695 , m_nextObjectReference(0) |
| 696 , m_blobInfo(blobInfo) | 696 , m_blobInfo(blobInfo) |
| 697 , m_blobDataHandles(blobDataHandles) | 697 , m_blobDataHandles(blobDataHandles) |
| 698 { | 698 { |
| 699 ASSERT(!tryCatch.HasCaught()); | 699 ASSERT(!tryCatch.HasCaught()); |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2290 return false; | 2290 return false; |
| 2291 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; | 2291 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; |
| 2292 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); | 2292 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); |
| 2293 if (objectReference >= m_objectPool.size()) | 2293 if (objectReference >= m_objectPool.size()) |
| 2294 return false; | 2294 return false; |
| 2295 *object = m_objectPool[objectReference]; | 2295 *object = m_objectPool[objectReference]; |
| 2296 return true; | 2296 return true; |
| 2297 } | 2297 } |
| 2298 | 2298 |
| 2299 } // namespace blink | 2299 } // namespace blink |
| OLD | NEW |