chromium/components/paint_preview/common/serialized_recording.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/paint_preview/common/serialized_recording.h"

#include <optional>

#include "base/notreached.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/trace_event/common/trace_event_common.h"
#include "base/trace_event/trace_event.h"
#include "components/paint_preview/common/file_stream.h"
#include "components/paint_preview/common/paint_preview_tracker.h"
#include "components/paint_preview/common/serial_utils.h"
#include "mojo/public/cpp/base/big_buffer.h"
#include "third_party/skia/include/core/SkStream.h"

namespace paint_preview {

namespace {

// Serializes |skp| to |out_stream| as an SkPicture of size |dimensions|.
// |tracker| supplies metadata required during serialization.
bool SerializeSkPicture(sk_sp<const SkPicture> skp,
                        PaintPreviewTracker* tracker,
                        SkWStream* out_stream) {}

}  // namespace

SkpResult::SkpResult() = default;
SkpResult::~SkpResult() = default;

SkpResult::SkpResult(SkpResult&& other) = default;
SkpResult& SkpResult::operator=(SkpResult&& rhs) = default;

SerializedRecording::SerializedRecording()
    :{}

SerializedRecording::SerializedRecording(base::FilePath path)
    :{}

SerializedRecording::SerializedRecording(base::File file)
    :{}

SerializedRecording::SerializedRecording(mojo_base::BigBuffer buffer)
    :{}

SerializedRecording::SerializedRecording(SerializedRecording&&) = default;

SerializedRecording& SerializedRecording::operator=(SerializedRecording&&) =
    default;

SerializedRecording::~SerializedRecording() {}

bool SerializedRecording::IsValid() const {}

std::optional<SkpResult> SerializedRecording::Deserialize() && {}

sk_sp<SkPicture> SerializedRecording::DeserializeWithContext(
    LoadedFramesDeserialContext* ctx) && {}

bool RecordToFile(base::File file,
                  sk_sp<const SkPicture> skp,
                  PaintPreviewTracker* tracker,
                  std::optional<size_t> max_capture_size,
                  size_t* serialized_size) {}

std::optional<mojo_base::BigBuffer> RecordToBuffer(
    sk_sp<const SkPicture> skp,
    PaintPreviewTracker* tracker,
    std::optional<size_t> maybe_max_capture_size,
    size_t* serialized_size) {}

}  // namespace paint_preview