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

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

Issue 2749503002: [wasm] enable wasm structured cloning in specific cases (Closed)
Patch Set: async 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 b6de70fe33dfd5e7ab602f1209e74476368cefdb..4013488276a476bca3cf83d44f34a0162f7312a9 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;
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.h ('k') | third_party/WebKit/Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698