#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/indexeddb/idb_value_wrapping.h"
#include <cstdint>
#include <memory>
#include <utility>
#include "base/containers/span.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/numerics/safe_conversions.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_request.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_value.h"
#include "third_party/blink/renderer/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/snappy/src/snappy.h"
namespace blink {
namespace {
static const uint8_t kRequiresProcessingSSVPseudoVersion = …;
static const uint8_t kReplaceWithBlob = …;
static const uint8_t kCompressedWithSnappy = …;
static const size_t kHeaderSize = …;
bool ShouldTransmitCompressed(size_t uncompressed_length,
size_t compressed_length) { … }
}
IDBValueWrapper::IDBValueWrapper(
v8::Isolate* isolate,
v8::Local<v8::Value> value,
SerializedScriptValue::SerializeOptions::WasmSerializationPolicy
wasm_policy,
ExceptionState& exception_state) { … }
IDBValueWrapper::~IDBValueWrapper() = default;
void IDBValueWrapper::Clone(ScriptState* script_state, ScriptValue* clone) { … }
void IDBValueWrapper::WriteVarInt(unsigned value, Vector<char>& output) { … }
void IDBValueWrapper::DoneCloning() { … }
bool IDBValueWrapper::ShouldCompress(size_t uncompressed_length) const { … }
void IDBValueWrapper::MaybeCompress() { … }
void IDBValueWrapper::MaybeStoreInBlob() { … }
Vector<char> IDBValueWrapper::TakeWireBytes() { … }
IDBValueUnwrapper::IDBValueUnwrapper() { … }
bool IDBValueUnwrapper::IsWrapped(IDBValue* value) { … }
bool IDBValueUnwrapper::IsWrapped(
const Vector<std::unique_ptr<IDBValue>>& values) { … }
void IDBValueUnwrapper::Unwrap(Vector<char>&& wrapper_blob_content,
IDBValue& wrapped_value) { … }
bool IDBValueUnwrapper::Decompress(const Vector<char>& buffer,
Vector<char>* out_buffer) { … }
bool IDBValueUnwrapper::Parse(IDBValue* value) { … }
scoped_refptr<BlobDataHandle> IDBValueUnwrapper::WrapperBlobHandle() { … }
bool IDBValueUnwrapper::ReadVarInt(unsigned& value) { … }
bool IDBValueUnwrapper::ReadBytes(Vector<uint8_t>& value) { … }
bool IDBValueUnwrapper::Reset() { … }
}