Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp

Issue 1893983002: Simplify handling of Transferable objects while (de)serializing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove Transferable.cpp, not needed after all. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9c0378f58fe5446c6e9e687e2875338a76920ef9..a3fd0a5591e92f7d5f8cea3fe12ef782c9e1367a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
@@ -6,9 +6,10 @@
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptValueSerializer.h"
-#include "bindings/core/v8/TransferableArrayBuffer.h"
-#include "bindings/core/v8/TransferableImageBitmap.h"
-#include "bindings/core/v8/TransferableMessagePort.h"
+#include "bindings/core/v8/Transferables.h"
+#include "core/dom/DOMArrayBuffer.h"
+#include "core/dom/MessagePort.h"
+#include "core/frame/ImageBitmap.h"
#include "wtf/ByteOrder.h"
#include "wtf/text/StringBuffer.h"
@@ -16,7 +17,7 @@ namespace blink {
SerializedScriptValueFactory* SerializedScriptValueFactory::m_instance = 0;
-PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isolate* isolate, v8::Local<v8::Value> value, TransferableArray* transferables, WebBlobInfoArray* blobInfo, ExceptionState& exceptionState)
+PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isolate* isolate, v8::Local<v8::Value> value, Transferables* transferables, WebBlobInfoArray* blobInfo, ExceptionState& exceptionState)
{
RefPtr<SerializedScriptValue> serializedValue = create();
SerializedScriptValueWriter writer;
@@ -47,7 +48,7 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isola
return serializedValue.release();
}
-PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isolate* isolate, v8::Local<v8::Value> value, TransferableArray* transferables, ExceptionState& exceptionState)
+PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create(v8::Isolate* isolate, v8::Local<v8::Value> value, Transferables* transferables, ExceptionState& exceptionState)
{
return create(isolate, value, transferables, 0, exceptionState);
}
@@ -102,28 +103,25 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValueFactory::create()
return adoptRef(new SerializedScriptValue());
}
-void SerializedScriptValueFactory::transferData(SerializedScriptValue* serializedValue, SerializedScriptValueWriter& writer, TransferableArray* transferables, ExceptionState& exceptionState, v8::Isolate* isolate)
+void SerializedScriptValueFactory::transferData(SerializedScriptValue* serializedValue, SerializedScriptValueWriter& writer, Transferables* transferables, ExceptionState& exceptionState, v8::Isolate* isolate)
{
serializedValue->setData(writer.takeWireString());
ASSERT(serializedValue->data().impl()->hasOneRef());
if (!transferables)
return;
- if (auto* imageBitmaps = TransferableImageBitmap::get(*transferables)) {
- if (imageBitmaps->getArray().size())
- serializedValue->transferImageBitmaps(isolate, imageBitmaps, exceptionState);
- }
- if (auto* arrayBuffers = TransferableArrayBuffer::get(*transferables)) {
- if (arrayBuffers->getArray().size())
- serializedValue->transferArrayBuffers(isolate, arrayBuffers, exceptionState);
- }
+
+ serializedValue->transferImageBitmaps(isolate, transferables->imageBitmaps, exceptionState);
+ if (exceptionState.hadException())
+ return;
+ serializedValue->transferArrayBuffers(isolate, transferables->arrayBuffers, exceptionState);
}
-ScriptValueSerializer::Status SerializedScriptValueFactory::doSerialize(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, TransferableArray* transferables, WebBlobInfoArray* blobInfo, SerializedScriptValue* serializedValue, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
+ScriptValueSerializer::Status SerializedScriptValueFactory::doSerialize(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, Transferables* transferables, WebBlobInfoArray* blobInfo, SerializedScriptValue* serializedValue, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
{
return doSerialize(value, writer, transferables, blobInfo, serializedValue->blobDataHandles(), tryCatch, errorMessage, isolate);
}
-ScriptValueSerializer::Status SerializedScriptValueFactory::doSerialize(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, TransferableArray* transferables, WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
+ScriptValueSerializer::Status SerializedScriptValueFactory::doSerialize(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, Transferables* transferables, WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
{
ScriptValueSerializer serializer(writer, transferables, blobInfo, blobDataHandles, tryCatch, ScriptState::current(isolate));
ScriptValueSerializer::Status status = serializer.serialize(value);

Powered by Google App Engine
This is Rietveld 408576698