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 "config.h" | 5 #include "config.h" |
6 #include "bindings/core/v8/ScriptValueSerializer.h" | 6 #include "bindings/core/v8/ScriptValueSerializer.h" |
7 | 7 |
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 586 matching lines...) Loading... |
597 } | 597 } |
598 | 598 |
599 // Returns true if the provided object is to be considered a 'host object', as u
sed in the | 599 // Returns true if the provided object is to be considered a 'host object', as u
sed in the |
600 // HTML5 structured clone algorithm. | 600 // HTML5 structured clone algorithm. |
601 static bool isHostObject(v8::Local<v8::Object> object) | 601 static bool isHostObject(v8::Local<v8::Object> object) |
602 { | 602 { |
603 // If the object has any internal fields, then we won't be able to serialize
or deserialize | 603 // If the object has any internal fields, then we won't be able to serialize
or deserialize |
604 // them; conveniently, this is also a quick way to detect DOM wrapper object
s, because | 604 // them; conveniently, this is also a quick way to detect DOM wrapper object
s, because |
605 // the mechanism for these relies on data stored in these fields. We should | 605 // the mechanism for these relies on data stored in these fields. We should |
606 // catch external array data as a special case. | 606 // catch external array data as a special case. |
607 return object->InternalFieldCount() || object->HasIndexedPropertiesInExterna
lArrayData(); | 607 return object->InternalFieldCount(); |
608 } | 608 } |
609 | 609 |
610 ScriptValueSerializer::ScriptValueSerializer(SerializedScriptValueWriter& writer
, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArr
ay* blobInfo, BlobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, Script
State* scriptState) | 610 ScriptValueSerializer::ScriptValueSerializer(SerializedScriptValueWriter& writer
, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArr
ay* blobInfo, BlobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, Script
State* scriptState) |
611 : m_scriptState(scriptState) | 611 : m_scriptState(scriptState) |
612 , m_writer(writer) | 612 , m_writer(writer) |
613 , m_tryCatch(tryCatch) | 613 , m_tryCatch(tryCatch) |
614 , m_depth(0) | 614 , m_depth(0) |
615 , m_status(Success) | 615 , m_status(Success) |
616 , m_nextObjectReference(0) | 616 , m_nextObjectReference(0) |
617 , m_blobInfo(blobInfo) | 617 , m_blobInfo(blobInfo) |
(...skipping 1312 matching lines...) Loading... |
1930 return false; | 1930 return false; |
1931 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; | 1931 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe
renceStack.size() - 1]; |
1932 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); | 1932 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() -
1); |
1933 if (objectReference >= m_objectPool.size()) | 1933 if (objectReference >= m_objectPool.size()) |
1934 return false; | 1934 return false; |
1935 *object = m_objectPool[objectReference]; | 1935 *object = m_objectPool[objectReference]; |
1936 return true; | 1936 return true; |
1937 } | 1937 } |
1938 | 1938 |
1939 } // namespace blink | 1939 } // namespace blink |
OLD | NEW |