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

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

Issue 1904973003: Revert of Make OffscreenCanvas Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 80779f993e19ceb1bcee932d0cc029e94c67c531..a3fd0a5591e92f7d5f8cea3fe12ef782c9e1367a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.cpp
@@ -7,10 +7,6 @@
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptValueSerializer.h"
#include "bindings/core/v8/Transferables.h"
-#include "bindings/core/v8/V8ArrayBuffer.h"
-#include "bindings/core/v8/V8ImageBitmap.h"
-#include "bindings/core/v8/V8MessagePort.h"
-#include "bindings/core/v8/V8SharedArrayBuffer.h"
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/MessagePort.h"
#include "core/frame/ImageBitmap.h"
@@ -42,7 +38,7 @@
exceptionState.throwDOMException(ScriptValueSerializer::DataCloneError, errorMessage);
return serializedValue.release();
case ScriptValueSerializer::Success:
- transferData(isolate, transferables, exceptionState, serializedValue.get(), writer);
+ transferData(serializedValue.get(), writer, transferables, exceptionState, isolate);
return serializedValue.release();
case ScriptValueSerializer::JSException:
ASSERT_NOT_REACHED();
@@ -107,7 +103,7 @@
return adoptRef(new SerializedScriptValue());
}
-void SerializedScriptValueFactory::transferData(v8::Isolate* isolate, Transferables* transferables, ExceptionState& exceptionState, SerializedScriptValue* serializedValue, SerializedScriptValueWriter& writer)
+void SerializedScriptValueFactory::transferData(SerializedScriptValue* serializedValue, SerializedScriptValueWriter& writer, Transferables* transferables, ExceptionState& exceptionState, v8::Isolate* isolate)
{
serializedValue->setData(writer.takeWireString());
ASSERT(serializedValue->data().impl()->hasOneRef());
@@ -159,47 +155,5 @@
return deserializer.deserialize();
}
-bool SerializedScriptValueFactory::extractTransferables(v8::Isolate* isolate, Transferables& transferables, ExceptionState& exceptionState, v8::Local<v8::Value>& transferableObject, unsigned index)
-{
- // Validation of Objects implementing an interface, per WebIDL spec 4.1.15.
- if (V8MessagePort::hasInstance(transferableObject, isolate)) {
- MessagePort* port = V8MessagePort::toImpl(v8::Local<v8::Object>::Cast(transferableObject));
- // Check for duplicate MessagePorts.
- if (transferables.messagePorts.contains(port)) {
- exceptionState.throwDOMException(DataCloneError, "Message port at index " + String::number(index) + " is a duplicate of an earlier port.");
- return false;
- }
- transferables.messagePorts.append(port);
- return true;
- }
- if (V8ArrayBuffer::hasInstance(transferableObject, isolate)) {
- DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(transferableObject));
- if (transferables.arrayBuffers.contains(arrayBuffer)) {
- exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at index " + String::number(index) + " is a duplicate of an earlier ArrayBuffer.");
- return false;
- }
- transferables.arrayBuffers.append(arrayBuffer);
- return true;
- }
- if (V8SharedArrayBuffer::hasInstance(transferableObject, isolate)) {
- DOMSharedArrayBuffer* sharedArrayBuffer = V8SharedArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(transferableObject));
- if (transferables.arrayBuffers.contains(sharedArrayBuffer)) {
- exceptionState.throwDOMException(DataCloneError, "SharedArrayBuffer at index " + String::number(index) + " is a duplicate of an earlier SharedArrayBuffer.");
- return false;
- }
- transferables.arrayBuffers.append(sharedArrayBuffer);
- return true;
- }
- if (V8ImageBitmap::hasInstance(transferableObject, isolate)) {
- ImageBitmap* imageBitmap = V8ImageBitmap::toImpl(v8::Local<v8::Object>::Cast(transferableObject));
- if (transferables.imageBitmaps.contains(imageBitmap)) {
- exceptionState.throwDOMException(DataCloneError, "ImageBitmap at index " + String::number(index) + " is a duplicate of an earlier ImageBitmap.");
- return false;
- }
- transferables.imageBitmaps.append(imageBitmap);
- return true;
- }
- return false;
-}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698