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

Unified Diff: third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.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/ScriptValueSerializerForModules.cpp
diff --git a/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp
index f6bebb08b6a24922b42fa9f8cc97e0b326c7c567..50182cdafc96e88d8c8c48ca0e9efe4fc1c7c6b7 100644
--- a/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp
+++ b/third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp
@@ -6,10 +6,8 @@
#include "bindings/core/v8/SerializationTag.h"
#include "bindings/core/v8/V8Binding.h"
-#include "bindings/modules/v8/TransferablesForModules.h"
#include "bindings/modules/v8/V8CryptoKey.h"
#include "bindings/modules/v8/V8DOMFileSystem.h"
-#include "bindings/modules/v8/V8OffscreenCanvas.h"
#include "modules/filesystem/DOMFileSystem.h"
#include "public/platform/Platform.h"
@@ -74,25 +72,10 @@
// Maximum allowed value is 2^32-1
};
-ScriptValueSerializerForModules::ScriptValueSerializerForModules(SerializedScriptValueWriter& writer, Transferables* transferables, WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, ScriptState* scriptState)
+
+ScriptValueSerializerForModules::ScriptValueSerializerForModules(SerializedScriptValueWriter& writer, const Transferables* transferables, WebBlobInfoArray* blobInfo, BlobDataHandleMap& blobDataHandles, v8::TryCatch& tryCatch, ScriptState* scriptState)
: ScriptValueSerializer(writer, transferables, blobInfo, blobDataHandles, tryCatch, scriptState)
- , m_writer(writer)
-{
- ASSERT(!tryCatch.HasCaught());
- if (!transferables)
- return;
- auto& offscreenCanvases = static_cast<TransferablesForModules*>(transferables)->offscreenCanvases;
- for (size_t i = 0; i < offscreenCanvases.size(); i++) {
- v8::Local<v8::Object> v8OffscreenCanvas;
- if (offscreenCanvases[i].get()) {
- v8::Local<v8::Value> wrapper = toV8(offscreenCanvases[i].get(), scriptState);
- if (!wrapper.IsEmpty()) {
- v8OffscreenCanvas = wrapper.As<v8::Object>();
- if (!m_transferredOffscreenCanvas.contains(v8OffscreenCanvas))
- m_transferredOffscreenCanvas.set(v8OffscreenCanvas, i);
- }
- }
- }
+{
}
ScriptValueSerializer::StateBase* ScriptValueSerializerForModules::writeDOMFileSystem(v8::Local<v8::Value> value, ScriptValueSerializer::StateBase* next)
@@ -121,15 +104,6 @@
doWriteUint32(type);
doWriteWebCoreString(name);
doWriteWebCoreString(url);
-}
-
-void SerializedScriptValueWriterForModules::writeTransferredOffscreenCanvas(uint32_t index, uint32_t width, uint32_t height, uint32_t id)
-{
- append(OffscreenCanvasTransferTag);
- doWriteUint32(index);
- doWriteUint32(width);
- doWriteUint32(height);
- doWriteUint32(id);
}
bool SerializedScriptValueWriterForModules::writeCryptoKey(const WebCryptoKey& key)
@@ -332,25 +306,7 @@
return handleError(DataCloneError, "Couldn't serialize key data", next);
return 0;
}
- v8::Local<v8::Object> jsObject = value.As<v8::Object>();
- uint32_t offscreenCanvasIndex;
- if (V8OffscreenCanvas::hasInstance(value, isolate()) && m_transferredOffscreenCanvas.tryGet(jsObject, &offscreenCanvasIndex)) {
- return writeTransferredOffscreenCanvas(value, offscreenCanvasIndex, next);
- }
return ScriptValueSerializer::doSerializeValue(value, next);
-}
-
-ScriptValueSerializer::StateBase* ScriptValueSerializerForModules::writeTransferredOffscreenCanvas(v8::Local<v8::Value> value, uint32_t index, ScriptValueSerializer::StateBase* next)
-{
- OffscreenCanvas* offscreenCanvas = V8OffscreenCanvas::toImpl(value.As<v8::Object>());
- if (!offscreenCanvas)
- return nullptr;
- if (offscreenCanvas->isNeutered())
- return handleError(DataCloneError, "An OffscreenCanvas is neutered and could not be cloned.", next);
- if (offscreenCanvas->renderingContext())
- return handleError(DataCloneError, "An OffscreenCanvas with a context could not be cloned.", next);
- m_writer.writeTransferredOffscreenCanvas(index, offscreenCanvas->width(), offscreenCanvas->height(), offscreenCanvas->getAssociatedCanvasId());
- return nullptr;
}
bool SerializedScriptValueReaderForModules::read(v8::Local<v8::Value>* value, ScriptValueCompositeCreator& creator)
@@ -368,19 +324,6 @@
if (!readCryptoKey(value))
return false;
creator.pushObjectReference(*value);
- break;
- case OffscreenCanvasTransferTag:
- uint32_t index, width, height, id;
- if (!doReadUint32(&index))
- return false;
- if (!doReadUint32(&width))
- return false;
- if (!doReadUint32(&height))
- return false;
- if (!doReadUint32(&id))
- return false;
- if (!creator.tryGetTransferredOffscreenCanvas(index, width, height, id, value))
- return false;
break;
default:
return SerializedScriptValueReader::readWithTag(tag, value, creator);
@@ -682,18 +625,7 @@
ScriptValueDeserializerForModules::ScriptValueDeserializerForModules(SerializedScriptValueReaderForModules& reader, MessagePortArray* messagePorts, ArrayBufferContentsArray* arrayBufferContents, ImageBitmapContentsArray* imageBitmapContents)
: ScriptValueDeserializer(reader, messagePorts, arrayBufferContents, imageBitmapContents)
- , m_reader(reader)
-{
-}
-
-bool ScriptValueDeserializerForModules::tryGetTransferredOffscreenCanvas(uint32_t index, uint32_t width, uint32_t height, uint32_t id, v8::Local<v8::Value>* object)
-{
- OffscreenCanvas* offscreenCanvas = OffscreenCanvas::create(width, height);
- offscreenCanvas->setAssociatedCanvasId(id);
- *object = toV8(offscreenCanvas, m_reader.getScriptState());
- if ((*object).IsEmpty())
- return false;
- return true;
+{
}
bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value)

Powered by Google App Engine
This is Rietveld 408576698