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

Unified Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2749503002: [wasm] enable wasm structured cloning in specific cases (Closed)
Patch Set: fixed idb test Created 3 years, 9 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/core/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index dabd8b74de6a8163d6e638c4ef502077e88d22b9..97058693958276b304c615f8febdc5669eb2442d 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2621,6 +2621,33 @@ PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(
return SerializedScriptValue::create(value);
}
+DOMArrayBuffer* Internals::serializeWithInlineWasm(ScriptValue value) const {
+ v8::Isolate* isolate = value.isolate();
+ ExceptionState exceptionState(isolate, ExceptionState::ExecutionContext,
+ "Internals", "serializeWithInlineWasm");
+ v8::Local<v8::Value> v8Value = value.v8Value();
+ SerializedScriptValue::SerializeOptions options;
+ options.writeWasmToStream = true;
+ RefPtr<SerializedScriptValue> obj = SerializedScriptValue::serialize(
+ isolate, v8Value, options, exceptionState);
+ if (exceptionState.hadException())
+ return nullptr;
+ return serializeObject(obj);
+}
+
+ScriptValue Internals::deserializeBufferContainingWasm(
+ ScriptState* state,
+ DOMArrayBuffer* buffer) const {
+ String value(static_cast<const UChar*>(buffer->data()),
+ buffer->byteLength() / sizeof(UChar));
+ DummyExceptionStateForTesting exceptionState;
+ SerializedScriptValue::DeserializeOptions options;
+ options.readWasmFromStream = true;
+ return ScriptValue::from(
+ state, SerializedScriptValue::create(value)->deserialize(state->isolate(),
+ options));
+}
+
void Internals::forceReload(bool bypassCache) {
if (!frame())
return;

Powered by Google App Engine
This is Rietveld 408576698