#ifdef UNSAFE_BUFFERS_BUILD
#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 {
bool SerializeSkPicture(sk_sp<const SkPicture> skp,
PaintPreviewTracker* tracker,
SkWStream* out_stream) { … }
}
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) { … }
}