| Index: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
|
| index c2a3783803affe335b0031070452ba096e1d9ac8..8e5e2df4b4ae423fa84669e5060f053acc882d65 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
|
| @@ -14,7 +14,7 @@ namespace blink {
|
|
|
| SerializedScriptValueFactory* SerializedScriptValueFactory::m_instance = 0;
|
|
|
| -PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isolate* isolate, v8::Local<v8::Value> value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray* blobInfo, ExceptionState& exceptionState)
|
| +PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isolate* isolate, v8::Local<v8::Value> value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, ImageBitmapArray* imageBitmaps, WebBlobInfoArray* blobInfo, ExceptionState& exceptionState)
|
| {
|
| RefPtr<SerializedScriptValue> serializedValue = create();
|
| SerializedScriptValueWriter writer;
|
| @@ -22,7 +22,7 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isola
|
| String errorMessage;
|
| {
|
| v8::TryCatch tryCatch;
|
| - status = doSerialize(value, writer, messagePorts, arrayBuffers, blobInfo, serializedValue.get(), tryCatch, errorMessage, isolate);
|
| + status = doSerialize(value, writer, messagePorts, arrayBuffers, imageBitmaps, blobInfo, serializedValue.get(), tryCatch, errorMessage, isolate);
|
| if (status == ScriptValueSerializer::JSException) {
|
| // If there was a JS exception thrown, re-throw it.
|
| exceptionState.rethrowV8Exception(tryCatch.Exception());
|
| @@ -35,7 +35,7 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isola
|
| exceptionState.throwDOMException(ScriptValueSerializer::DataCloneError, errorMessage);
|
| return serializedValue.release();
|
| case ScriptValueSerializer::Success:
|
| - transferData(serializedValue.get(), writer, arrayBuffers, exceptionState, isolate);
|
| + transferData(serializedValue.get(), writer, arrayBuffers, imageBitmaps, exceptionState, isolate);
|
| return serializedValue.release();
|
| case ScriptValueSerializer::JSException:
|
| ASSERT_NOT_REACHED();
|
| @@ -45,21 +45,21 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isola
|
| return serializedValue.release();
|
| }
|
|
|
| -PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isolate* isolate, v8::Local<v8::Value> value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, ExceptionState& exceptionState)
|
| +PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isolate* isolate, v8::Local<v8::Value> value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, ImageBitmapArray* imageBitmaps, ExceptionState& exceptionState)
|
| {
|
| - return create(isolate, value, messagePorts, arrayBuffers, 0, exceptionState);
|
| + return create(isolate, value, messagePorts, arrayBuffers, imageBitmaps, 0, exceptionState);
|
| }
|
|
|
| PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::createAndSwallowExceptions(v8::Isolate* isolate, v8::Local<v8::Value> value)
|
| {
|
| TrackExceptionState exceptionState;
|
| - return create(isolate, value, 0, 0, exceptionState);
|
| + return create(isolate, value, nullptr, nullptr, nullptr, exceptionState);
|
| }
|
|
|
| PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isolate* isolate, const ScriptValue& value, WebBlobInfoArray* blobInfo, ExceptionState& exceptionState)
|
| {
|
| ASSERT(isolate->InContext());
|
| - return create(isolate, value.v8Value(), 0, 0, blobInfo, exceptionState);
|
| + return create(isolate, value.v8Value(), nullptr, nullptr, nullptr, blobInfo, exceptionState);
|
| }
|
|
|
| PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::createFromWire(const String& data)
|
| @@ -100,23 +100,24 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create()
|
| return adoptRef(new SerializedScriptValue());
|
| }
|
|
|
| -void SerializedScriptValueFactory::transferData(SerializedScriptValue* serializedValue, SerializedScriptValueWriter& writer, ArrayBufferArray* arrayBuffers, ExceptionState& exceptionState, v8::Isolate* isolate)
|
| +void SerializedScriptValueFactory::transferData(SerializedScriptValue* serializedValue, SerializedScriptValueWriter& writer, ArrayBufferArray* arrayBuffers, ImageBitmapArray* imageBitmaps, ExceptionState& exceptionState, v8::Isolate* isolate)
|
| {
|
| serializedValue->setData(writer.takeWireString());
|
| ASSERT(serializedValue->data().impl()->hasOneRef());
|
| - if (!arrayBuffers || !arrayBuffers->size())
|
| - return;
|
| - serializedValue->transferArrayBuffers(isolate, *arrayBuffers, exceptionState);
|
| + if (imageBitmaps && imageBitmaps->size())
|
| + serializedValue->transferImageBitmaps(isolate, *imageBitmaps, exceptionState);
|
| + if (arrayBuffers && arrayBuffers->size())
|
| + serializedValue->transferArrayBuffers(isolate, *arrayBuffers, exceptionState);
|
| }
|
|
|
| -ScriptValueSerializer::Status SerializedScriptValueFactory::doSerialize(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray* blobInfo, SerializedScriptValue* serializedValue, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
|
| +ScriptValueSerializer::Status SerializedScriptValueFactory::doSerialize(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, ImageBitmapArray* imageBitmaps, WebBlobInfoArray* blobInfo, SerializedScriptValue* serializedValue, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
|
| {
|
| - return doSerialize(value, writer, messagePorts, arrayBuffers, blobInfo, serializedValue->blobDataHandles(), tryCatch, errorMessage, isolate);
|
| + return doSerialize(value, writer, messagePorts, arrayBuffers, imageBitmaps, blobInfo, serializedValue->blobDataHandles(), tryCatch, errorMessage, isolate);
|
| }
|
|
|
| -ScriptValueSerializer::Status SerializedScriptValueFactory::doSerialize(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
|
| +ScriptValueSerializer::Status SerializedScriptValueFactory::doSerialize(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, ImageBitmapArray* imageBitmaps, WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
|
| {
|
| - ScriptValueSerializer serializer(writer, messagePorts, arrayBuffers, blobInfo, blobDataHandles, tryCatch, ScriptState::current(isolate));
|
| + ScriptValueSerializer serializer(writer, messagePorts, arrayBuffers, imageBitmaps, blobInfo, blobDataHandles, tryCatch, ScriptState::current(isolate));
|
| ScriptValueSerializer::Status status = serializer.serialize(value);
|
| errorMessage = serializer.errorMessage();
|
| return status;
|
| @@ -127,10 +128,10 @@ v8::Local<v8::Value> SerializedScriptValueFactory::deserialize(SerializedScriptV
|
| // deserialize() can run arbitrary script (e.g., setters), which could result in |this| being destroyed.
|
| // Holding a RefPtr ensures we are alive (along with our internal data) throughout the operation.
|
| RefPtr<SerializedScriptValue> protect(value);
|
| - return deserialize(value->data(), value->blobDataHandles(), value->arrayBufferContentsArray(), isolate, messagePorts, blobInfo);
|
| + return deserialize(value->data(), value->blobDataHandles(), value->arrayBufferContentsArray(), value->imageBitmapContentsArray(), isolate, messagePorts, blobInfo);
|
| }
|
|
|
| -v8::Local<v8::Value> SerializedScriptValueFactory::deserialize(String& data, BlobDataHandleMap& blobDataHandles, ArrayBufferContentsArray* arrayBufferContentsArray, v8::Isolate* isolate, MessagePortArray* messagePorts, const WebBlobInfoArray* blobInfo)
|
| +v8::Local<v8::Value> SerializedScriptValueFactory::deserialize(String& data, BlobDataHandleMap& blobDataHandles, ArrayBufferContentsArray* arrayBufferContentsArray, ImageBitmapContentsArray* imageBitmapContentsArray, v8::Isolate* isolate, MessagePortArray* messagePorts, const WebBlobInfoArray* blobInfo)
|
| {
|
| if (!data.impl())
|
| return v8::Null(isolate);
|
| @@ -141,7 +142,7 @@ v8::Local<v8::Value> SerializedScriptValueFactory::deserialize(String& data, Blo
|
| // information stored in m_data isn't even encoded in UTF-16. Instead,
|
| // unicode characters are encoded as UTF-8 with two code units per UChar.
|
| SerializedScriptValueReader reader(reinterpret_cast<const uint8_t*>(data.impl()->characters16()), 2 * data.length(), blobInfo, blobDataHandles, ScriptState::current(isolate));
|
| - ScriptValueDeserializer deserializer(reader, messagePorts, arrayBufferContentsArray);
|
| + ScriptValueDeserializer deserializer(reader, messagePorts, arrayBufferContentsArray, imageBitmapContentsArray);
|
|
|
| // deserialize() can run arbitrary script (e.g., setters), which could result in |this| being destroyed.
|
| // Holding a RefPtr ensures we are alive (along with our internal data) throughout the operation.
|
|
|