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

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

Issue 1862033002: Make OffscreenCanvas Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, compiles but crashes some layout tests 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/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 06080d9946bd787b1658361e7d444c96823ee809..fe179c9cede3a8dd9d18aec16168c83c27eb5911 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -36,6 +36,7 @@
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/ScriptValueSerializer.h"
#include "bindings/core/v8/SerializedScriptValueFactory.h"
+#include "bindings/core/v8/TransferableExtractor.h"
#include "bindings/core/v8/Transferables.h"
#include "bindings/core/v8/V8ArrayBuffer.h"
#include "bindings/core/v8/V8ImageBitmap.h"
@@ -225,6 +226,7 @@ bool SerializedScriptValue::extractTransferables(v8::Isolate* isolate, v8::Local
}
v8::Local<v8::Object> transferableArray = v8::Local<v8::Object>::Cast(value);
+ Vector<OwnPtr<TransferableExtractor>> extractors;
// Validate the passed array of transferables.
for (unsigned i = 0; i < length; ++i) {
@@ -236,6 +238,15 @@ bool SerializedScriptValue::extractTransferables(v8::Isolate* isolate, v8::Local
exceptionState.throwTypeError("Value at index " + String::number(i) + " is an untransferable " + (transferableObject->IsUndefined() ? "'undefined'" : "'null'") + " value.");
return false;
}
+ bool extractorDoneFlag = false;
+ for (const auto& ex : TransferableExtractor::getExtractors()) {
+ if (ex->extract(transferableObject, isolate, transferables, exceptionState, i)) {
+ extractorDoneFlag = true;
+ break;
+ }
+ }
+ if (extractorDoneFlag)
+ break;
// 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));

Powered by Google App Engine
This is Rietveld 408576698