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

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

Issue 1413723004: Revert of Make ImageBitmap Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/SerializedScriptValue.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
index b5e74ab3befa74326948a3eca0a09c18721ff580..bc1e32f4a090fdb4f9d5092eab00f52cbc79609f 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -38,7 +38,6 @@
#include "bindings/core/v8/ScriptValueSerializer.h"
#include "bindings/core/v8/SerializedScriptValueFactory.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/ExceptionCode.h"
@@ -102,29 +101,6 @@
}
}
-PassOwnPtrWillBeRawPtr<ImageBitmapArray> SerializedScriptValue::createImageBitmaps(v8::Isolate* isolate, ImageBitmapArray& imageBitmaps, ExceptionState& exceptionState)
-{
- ASSERT(imageBitmaps.size());
-
- for (size_t i = 0; i < imageBitmaps.size(); i++) {
- if (imageBitmaps[i]->isNeutered()) {
- exceptionState.throwDOMException(DataCloneError, "ImageBitmap at index " + String::number(i) + " is already neutered.");
- return nullptr;
- }
- }
-
- OwnPtrWillBeRawPtr<ImageBitmapArray> contents = adoptPtrWillBeNoop(new ImageBitmapArray(imageBitmaps.size()));
- WillBeHeapHashSet<RawPtrWillBeMember<ImageBitmap>> visited;
- for (size_t i = 0; i < imageBitmaps.size(); i++) {
- if (visited.contains(imageBitmaps[i].get()))
- continue;
- visited.add(imageBitmaps[i].get());
- contents->at(i) = imageBitmaps[i]->transfer();
- }
-
- return contents.release();
-}
-
PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValue::createArrayBuffers(v8::Isolate* isolate, ArrayBufferArray& arrayBuffers, ExceptionState& exceptionState)
{
ASSERT(arrayBuffers.size());
@@ -157,6 +133,7 @@
bool isNeuterable = true;
for (size_t j = 0; j < bufferHandles.size(); j++)
isNeuterable &= bufferHandles[j]->IsNeuterable();
+
RefPtr<DOMArrayBufferBase> toTransfer = arrayBuffers[i];
if (!isNeuterable)
toTransfer = DOMArrayBuffer::create(arrayBuffers[i]->buffer());
@@ -170,6 +147,7 @@
for (size_t j = 0; j < bufferHandles.size(); j++)
bufferHandles[j]->Neuter();
}
+
}
return contents.release();
@@ -191,12 +169,11 @@
return SerializedScriptValueFactory::instance().deserialize(this, isolate, messagePorts, blobInfo);
}
-bool SerializedScriptValue::extractTransferables(v8::Isolate* isolate, v8::Local<v8::Value> value, int argumentIndex, MessagePortArray& ports, ArrayBufferArray& arrayBuffers, ImageBitmapArray& imageBitmaps, ExceptionState& exceptionState)
+bool SerializedScriptValue::extractTransferables(v8::Isolate* isolate, v8::Local<v8::Value> value, int argumentIndex, MessagePortArray& ports, ArrayBufferArray& arrayBuffers, ExceptionState& exceptionState)
{
if (isUndefinedOrNull(value)) {
ports.resize(0);
arrayBuffers.resize(0);
- imageBitmaps.resize(0);
return true;
}
@@ -245,13 +222,6 @@
return false;
}
arrayBuffers.append(sharedArrayBuffer.release());
- } else if (V8ImageBitmap::hasInstance(transferrable, isolate)) {
- RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = V8ImageBitmap::toImpl(v8::Local<v8::Object>::Cast(transferrable));
- if (imageBitmaps.contains(imageBitmap)) {
- exceptionState.throwDOMException(DataCloneError, "ImageBitmap at index " + String::number(i) + " is a duplicate of an earlier ImageBitmap.");
- return false;
- }
- imageBitmaps.append(imageBitmap.release());
} else {
exceptionState.throwTypeError("Value at index " + String::number(i) + " does not have a transferable type.");
return false;
@@ -289,9 +259,4 @@
m_arrayBufferContentsArray = createArrayBuffers(isolate, arrayBuffers, exceptionState);
}
-void SerializedScriptValue::transferImageBitmaps(v8::Isolate* isolate, ImageBitmapArray& imageBitmaps, ExceptionState& exceptionState)
-{
- m_imageBitmapsArray = createImageBitmaps(isolate, imageBitmaps, exceptionState);
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698