Chromium Code Reviews| Index: Source/bindings/core/v8/SerializedScriptValue.cpp |
| diff --git a/Source/bindings/core/v8/SerializedScriptValue.cpp b/Source/bindings/core/v8/SerializedScriptValue.cpp |
| index 72ca9d1026e57ed5fe3525cd34bdfab62060536f..ca7b65e138c40d38da2eb94482c90759cab7776b 100644 |
| --- a/Source/bindings/core/v8/SerializedScriptValue.cpp |
| +++ b/Source/bindings/core/v8/SerializedScriptValue.cpp |
| @@ -34,84 +34,22 @@ |
| #include "bindings/core/v8/DOMDataStore.h" |
| #include "bindings/core/v8/DOMWrapperWorld.h" |
| #include "bindings/core/v8/ExceptionState.h" |
| +#include "bindings/core/v8/ScriptState.h" |
| #include "bindings/core/v8/ScriptValueSerializer.h" |
| #include "bindings/core/v8/V8ArrayBuffer.h" |
| -#include "bindings/core/v8/V8ArrayBufferView.h" |
| -#include "bindings/core/v8/V8Binding.h" |
| #include "bindings/core/v8/V8MessagePort.h" |
| -#include "core/dom/DOMArrayBuffer.h" |
| #include "core/dom/ExceptionCode.h" |
| #include "platform/SharedBuffer.h" |
| #include "platform/blob/BlobData.h" |
| #include "platform/heap/Handle.h" |
| -#include "public/platform/Platform.h" |
| -#include "wtf/ArrayBuffer.h" |
| -#include "wtf/ArrayBufferContents.h" |
| -#include "wtf/ArrayBufferView.h" |
| #include "wtf/Assertions.h" |
| #include "wtf/ByteOrder.h" |
| -#include "wtf/Uint8ClampedArray.h" |
| #include "wtf/Vector.h" |
| #include "wtf/text/StringBuffer.h" |
| #include "wtf/text/StringHash.h" |
| -#include "wtf/text/StringUTF8Adaptor.h" |
| namespace blink { |
| -PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(v8::Handle<v8::Value> value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, ExceptionState& exceptionState, v8::Isolate* isolate) |
|
tasak
2014/11/14 08:07:39
"create" methods are moved to SerializedScriptValu
|
| -{ |
| - return adoptRef(new SerializedScriptValue(value, messagePorts, arrayBuffers, 0, exceptionState, isolate)); |
| -} |
| - |
| -PassRefPtr<SerializedScriptValue> SerializedScriptValue::createAndSwallowExceptions(v8::Isolate* isolate, v8::Handle<v8::Value> value) |
| -{ |
| - TrackExceptionState exceptionState; |
| - return adoptRef(new SerializedScriptValue(value, 0, 0, 0, exceptionState, isolate)); |
| -} |
| - |
| -PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(const ScriptValue& value, WebBlobInfoArray* blobInfo, ExceptionState& exceptionState, v8::Isolate* isolate) |
| -{ |
| - ASSERT(isolate->InContext()); |
| - return adoptRef(new SerializedScriptValue(value.v8Value(), 0, 0, blobInfo, exceptionState, isolate)); |
| -} |
| - |
| -PassRefPtr<SerializedScriptValue> SerializedScriptValue::createFromWire(const String& data) |
| -{ |
| - return adoptRef(new SerializedScriptValue(data)); |
| -} |
| - |
| -PassRefPtr<SerializedScriptValue> SerializedScriptValue::createFromWireBytes(const Vector<uint8_t>& data) |
| -{ |
| - // Decode wire data from big endian to host byte order. |
| - ASSERT(!(data.size() % sizeof(UChar))); |
| - size_t length = data.size() / sizeof(UChar); |
| - StringBuffer<UChar> buffer(length); |
| - const UChar* src = reinterpret_cast<const UChar*>(data.data()); |
| - UChar* dst = buffer.characters(); |
| - for (size_t i = 0; i < length; i++) |
| - dst[i] = ntohs(src[i]); |
| - |
| - return createFromWire(String::adopt(buffer)); |
| -} |
| - |
| -PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(const String& data) |
| -{ |
| - return create(data, v8::Isolate::GetCurrent()); |
| -} |
| - |
| -PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(const String& data, v8::Isolate* isolate) |
| -{ |
| - SerializedScriptValueInternal::Writer writer; |
| - writer.writeWebCoreString(data); |
| - String wireData = writer.takeWireString(); |
| - return adoptRef(new SerializedScriptValue(wireData)); |
| -} |
| - |
| -PassRefPtr<SerializedScriptValue> SerializedScriptValue::create() |
| -{ |
| - return adoptRef(new SerializedScriptValue()); |
| -} |
| - |
| PassRefPtr<SerializedScriptValue> SerializedScriptValue::nullValue() |
| { |
| SerializedScriptValueInternal::Writer writer; |
| @@ -166,7 +104,7 @@ static void neuterArrayBufferInAllWorlds(DOMArrayBuffer* object) |
| } |
| } |
| -PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValue::transferArrayBuffers(v8::Isolate* isolate, ArrayBufferArray& arrayBuffers, ExceptionState& exceptionState) |
| +PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValue::createArrayBuffers(v8::Isolate* isolate, ArrayBufferArray& arrayBuffers, ExceptionState& exceptionState) |
| { |
| ASSERT(arrayBuffers.size()); |
| @@ -222,7 +160,7 @@ SerializedScriptValue::SerializedScriptValue(v8::Handle<v8::Value> value, Messag |
| m_data = writer.takeWireString(); |
| ASSERT(m_data.impl()->hasOneRef()); |
| if (arrayBuffers && arrayBuffers->size()) |
| - m_arrayBufferContentsArray = transferArrayBuffers(isolate, *arrayBuffers, exceptionState); |
| + transferArrayBuffers(isolate, *arrayBuffers, exceptionState); |
| return; |
| case SerializedScriptValueInternal::Serializer::JSException: |
| ASSERT_NOT_REACHED(); |
| @@ -332,4 +270,9 @@ SerializedScriptValue::~SerializedScriptValue() |
| } |
| } |
| +void SerializedScriptValue::transferArrayBuffers(v8::Isolate* isolate, ArrayBufferArray& arrayBuffers, ExceptionState& exceptionState) |
| +{ |
| + m_arrayBufferContentsArray = createArrayBuffers(isolate, arrayBuffers, exceptionState); |
| +} |
| + |
| } // namespace blink |