blob: 0843df42f34cdfc307806c5b7d937016de774036 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/bindings/modules/v8/serialization/serialized_script_value_for_modules_factory.h"
#include "third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h"
#include "third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
namespace blink {
scoped_refptr<SerializedScriptValue>
SerializedScriptValueForModulesFactory::Create(
v8::Isolate* isolate,
v8::Local<v8::Value> value,
const SerializedScriptValue::SerializeOptions& options,
ExceptionState& exception_state) {
TRACE_EVENT0("blink", "SerializedScriptValueFactory::create");
V8ScriptValueSerializerForModules serializer(ScriptState::Current(isolate),
options);
return serializer.Serialize(value, exception_state);
}
v8::Local<v8::Value> SerializedScriptValueForModulesFactory::Deserialize(
scoped_refptr<SerializedScriptValue> value,
v8::Isolate* isolate,
const SerializedScriptValue::DeserializeOptions& options) {
TRACE_EVENT0("blink", "SerializedScriptValueFactory::deserialize");
V8ScriptValueDeserializerForModules deserializer(
ScriptState::Current(isolate), std::move(value), options);
return deserializer.Deserialize();
}
v8::Local<v8::Value> SerializedScriptValueForModulesFactory::Deserialize(
UnpackedSerializedScriptValue* value,
v8::Isolate* isolate,
const SerializedScriptValue::DeserializeOptions& options) {
TRACE_EVENT0("blink", "SerializedScriptValueFactory::deserialize");
V8ScriptValueDeserializerForModules deserializer(
ScriptState::Current(isolate), value, options);
return deserializer.Deserialize();
}
} // namespace blink