chromium/v8/include/v8-value-serializer.h

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef INCLUDE_V8_VALUE_SERIALIZER_H_
#define INCLUDE_V8_VALUE_SERIALIZER_H_

#include <stddef.h>
#include <stdint.h>

#include <memory>
#include <utility>

#include "v8-local-handle.h"  // NOLINT(build/include_directory)
#include "v8-maybe.h"         // NOLINT(build/include_directory)
#include "v8config.h"         // NOLINT(build/include_directory)

namespace v8 {

class ArrayBuffer;
class Isolate;
class Object;
class SharedArrayBuffer;
class String;
class WasmModuleObject;
class Value;

namespace internal {
struct ScriptStreamingData;
class SharedObjectConveyorHandles;
class ValueDeserializer;
class ValueSerializer;
}  // namespace internal

/**
 * A move-only class for managing the lifetime of shared value conveyors used
 * by V8 to keep JS shared values alive in transit when serialized.
 *
 * This class is not directly constructible and is always passed to a
 * ValueSerializer::Delegate via ValueSerializer::SetSharedValueConveyor.
 *
 * The embedder must not destruct the SharedValueConveyor until the associated
 * serialized data will no longer be deserialized.
 */
class V8_EXPORT SharedValueConveyor final {};

/**
 * Value serialization compatible with the HTML structured clone algorithm.
 * The format is backward-compatible (i.e. safe to store to disk).
 */
class V8_EXPORT ValueSerializer {};

/**
 * Deserializes values from data written with ValueSerializer, or a compatible
 * implementation.
 */
class V8_EXPORT ValueDeserializer {};

}  // namespace v8

#endif  // INCLUDE_V8_VALUE_SERIALIZER_H_