chromium/third_party/blink/renderer/platform/graphics/parkable_image.cc

// Copyright 2021 The Chromium Authors
// 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/platform/graphics/parkable_image.h"

#include "base/debug/stack_trace.h"
#include "base/feature_list.h"
#include "base/memory/ref_counted.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/synchronization/lock.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
#include "base/trace_event/trace_event.h"
#include "third_party/blink/renderer/platform/graphics/parkable_image_manager.h"
#include "third_party/blink/renderer/platform/image-decoders/segment_reader.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/sanitizers.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkRefCnt.h"

namespace blink {

BASE_FEATURE();

namespace {

void RecordReadStatistics(size_t size,
                          base::TimeDelta duration,
                          base::TimeDelta time_since_freeze) {}

void RecordWriteStatistics(size_t size, base::TimeDelta duration) {}

void AsanPoisonBuffer(RWBuffer* rw_buffer) {}

void AsanUnpoisonBuffer(RWBuffer* rw_buffer) {}

// This should be used to make sure that the last reference to the |this| is
// decremented on the main thread (since that's where the destructor must
// run), for example by posting a task with this to the main thread.
void NotifyWriteToDiskFinished(scoped_refptr<ParkableImageImpl>) {}

}  // namespace

// ParkableImageSegmentReader

class ParkableImageSegmentReader : public SegmentReader {};

ParkableImageSegmentReader::ParkableImageSegmentReader(
    scoped_refptr<ParkableImage> image)
    :{}

size_t ParkableImageSegmentReader::size() const {}

size_t ParkableImageSegmentReader::GetSomeData(const char*& data,
                                               size_t position) const {}

sk_sp<SkData> ParkableImageSegmentReader::GetAsSkData() const {}

void ParkableImageSegmentReader::LockData() {}

void ParkableImageSegmentReader::UnlockData() {}

BASE_FEATURE();

constexpr base::TimeDelta ParkableImageImpl::kParkingDelay;

void ParkableImageImpl::Append(WTF::SharedBuffer* buffer, size_t offset) {}

scoped_refptr<SharedBuffer> ParkableImageImpl::Data() {}

scoped_refptr<SegmentReader> ParkableImageImpl::GetROBufferSegmentReader() {}

bool ParkableImageImpl::CanParkNow() const {}

ParkableImageImpl::ParkableImageImpl(size_t initial_capacity)
    :{}

ParkableImageImpl::~ParkableImageImpl() {}

// static
scoped_refptr<ParkableImageImpl> ParkableImageImpl::Create(
    size_t initial_capacity) {}

void ParkableImageImpl::Freeze() {}

void ParkableImageImpl::LockData() {}

void ParkableImageImpl::UnlockData() {}

// static
void ParkableImageImpl::WriteToDiskInBackground(
    scoped_refptr<ParkableImageImpl> parkable_image,
    scoped_refptr<base::SingleThreadTaskRunner> callback_task_runner) {}

void ParkableImageImpl::MaybeDiscardData() {}

void ParkableImageImpl::DiscardData() {}

bool ParkableImageImpl::TransientlyUnableToPark() const {}

bool ParkableImageImpl::MaybePark(
    scoped_refptr<base::SingleThreadTaskRunner> task_runner) {}

// static
size_t ParkableImageImpl::ReadFromDiskIntoBuffer(
    DiskDataMetadata* on_disk_metadata,
    void* buffer,
    size_t capacity) {}

void ParkableImageImpl::Unpark() {}

size_t ParkableImageImpl::size() const {}

bool ParkableImageImpl::is_below_min_parking_size() const {}

bool ParkableImageImpl::is_locked() const {}

ParkableImage::ParkableImage(size_t offset)
    :{}

ParkableImage::~ParkableImage() {}

// static
scoped_refptr<ParkableImage> ParkableImage::Create(size_t initial_capacity) {}

size_t ParkableImage::size() const {}

bool ParkableImage::is_on_disk() const {}

scoped_refptr<SegmentReader> ParkableImage::MakeROSnapshot() {}

void ParkableImage::Freeze() {}

scoped_refptr<SharedBuffer> ParkableImage::Data() {}

void ParkableImage::Append(WTF::SharedBuffer* buffer, size_t offset) {}

void ParkableImage::LockData() {}

void ParkableImage::UnlockData() {}

scoped_refptr<SegmentReader> ParkableImage::CreateSegmentReader() {}

}  // namespace blink