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

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

Issue 2749503002: [wasm] enable wasm structured cloning in specific cases (Closed)
Patch Set: moved frame.html 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 d88d52258c2f2344ed3f9baccb99b47c64675178..5a9b27ab0ff7ae7cbe7873dddbcc5e6754ec98c7 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2664,6 +2664,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