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

Unified Diff: third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.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/modules/v8/SerializedScriptValueForModulesFactory.cpp
diff --git a/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp b/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp
index b0ddba22ed801e541426a4402204982d004bc84d..bafa2c93bb6ca9d27d78816fd336e5b080bb6385 100644
--- a/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp
+++ b/third_party/WebKit/Source/bindings/modules/v8/SerializedScriptValueForModulesFactory.cpp
@@ -7,8 +7,6 @@
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/SerializedScriptValue.h"
#include "bindings/modules/v8/ScriptValueSerializerForModules.h"
-#include "bindings/modules/v8/TransferablesForModules.h"
-#include "bindings/modules/v8/V8OffscreenCanvas.h"
#include "core/dom/ExceptionCode.h"
namespace blink {
@@ -34,7 +32,7 @@
exceptionState.throwDOMException(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();
@@ -50,33 +48,6 @@
writer.writeWebCoreString(data);
String wireData = writer.takeWireString();
return createFromWire(wireData);
-}
-
-void SerializedScriptValueForModulesFactory::transferData(v8::Isolate* isolate, Transferables* transferables, ExceptionState& exceptionState, SerializedScriptValue* serializedValue, SerializedScriptValueWriter& writer)
-{
- serializedValue->setData(writer.takeWireString());
- ASSERT(serializedValue->data().impl()->hasOneRef());
- if (!transferables)
- return;
- auto& offscreenCanvases = static_cast<TransferablesForModules*>(transferables)->offscreenCanvases;
- if (offscreenCanvases.size()) {
- HeapHashSet<Member<OffscreenCanvas>> visited;
- for (size_t i = 0; i < offscreenCanvases.size(); i++) {
- if (offscreenCanvases[i]->isNeutered()) {
- exceptionState.throwDOMException(DataCloneError, "OffscreenCanvas at index " + String::number(i) + " is already neutered.");
- return;
- }
- if (offscreenCanvases[i]->renderingContext()) {
- exceptionState.throwDOMException(DataCloneError, "OffscreenCanvas at index " + String::number(i) + " has an associated context.");
- return;
- }
- if (visited.contains(offscreenCanvases[i].get()))
- continue;
- visited.add(offscreenCanvases[i].get());
- offscreenCanvases[i].get()->setNeutered();
- }
- }
- SerializedScriptValueFactory::transferData(isolate, transferables, exceptionState, serializedValue, writer);
}
ScriptValueSerializer::Status SerializedScriptValueForModulesFactory::doSerialize(v8::Local<v8::Value> value, SerializedScriptValueWriter& writer, Transferables* transferables, WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, String& errorMessage, v8::Isolate* isolate)
@@ -102,22 +73,5 @@
return deserializer.deserialize();
}
-bool SerializedScriptValueForModulesFactory::extractTransferables(v8::Isolate* isolate, Transferables& transferables, ExceptionState& exceptionState, v8::Local<v8::Value>& transferableObject, unsigned index)
-{
- if (SerializedScriptValueFactory::extractTransferables(isolate, transferables, exceptionState, transferableObject, index))
- return true;
- if (V8OffscreenCanvas::hasInstance(transferableObject, isolate)) {
- OffscreenCanvas* offscreenCanvas = V8OffscreenCanvas::toImpl(v8::Local<v8::Object>::Cast(transferableObject));
- auto& offscreenCanvases = static_cast<TransferablesForModules*>(&transferables)->offscreenCanvases;
- if (offscreenCanvases.contains(offscreenCanvas)) {
- exceptionState.throwDOMException(DataCloneError, "OffscreenCanvas at index " + String::number(index) + " is a duplicate of an earlier OffscreenCanvas.");
- return false;
- }
- offscreenCanvases.append(offscreenCanvas);
- return true;
- }
- return false;
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698