#include "third_party/blink/renderer/platform/media/multi_buffer.h"
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/not_fatal_until.h"
#include "base/task/single_thread_task_runner.h"
namespace blink {
enum { … };
template <class T>
static MultiBuffer::BlockId ClosestPreviousEntry(
const std::map<MultiBuffer::BlockId, T>& index,
MultiBuffer::BlockId pos) { … }
template <class T>
static MultiBuffer::BlockId ClosestNextEntry(
const std::map<MultiBuffer::BlockId, T>& index,
MultiBuffer::BlockId pos) { … }
MultiBuffer::GlobalLRU::GlobalLRU(
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
MultiBuffer::GlobalLRU::~GlobalLRU() { … }
void MultiBuffer::GlobalLRU::Use(MultiBuffer* multibuffer,
MultiBufferBlockId block_id) { … }
void MultiBuffer::GlobalLRU::Insert(MultiBuffer* multibuffer,
MultiBufferBlockId block_id) { … }
void MultiBuffer::GlobalLRU::Remove(MultiBuffer* multibuffer,
MultiBufferBlockId block_id) { … }
bool MultiBuffer::GlobalLRU::Contains(MultiBuffer* multibuffer,
MultiBufferBlockId block_id) { … }
void MultiBuffer::GlobalLRU::IncrementDataSize(int64_t blocks) { … }
void MultiBuffer::GlobalLRU::IncrementMaxSize(int64_t blocks) { … }
bool MultiBuffer::GlobalLRU::Pruneable() const { … }
void MultiBuffer::GlobalLRU::SchedulePrune() { … }
void MultiBuffer::GlobalLRU::PruneTask() { … }
void MultiBuffer::GlobalLRU::TryFree(int64_t max_to_free) { … }
void MultiBuffer::GlobalLRU::TryFreeAll() { … }
void MultiBuffer::GlobalLRU::Prune(int64_t max_to_free) { … }
int64_t MultiBuffer::GlobalLRU::Size() const { … }
MultiBuffer::MultiBuffer(int32_t block_size_shift,
scoped_refptr<GlobalLRU> global_lru)
: … { … }
MultiBuffer::~MultiBuffer() { … }
void MultiBuffer::AddReader(const BlockId& pos, Reader* reader) { … }
void MultiBuffer::RemoveReader(const BlockId& pos, Reader* reader) { … }
void MultiBuffer::CleanupWriters(const BlockId& pos) { … }
bool MultiBuffer::Contains(const BlockId& pos) const { … }
MultiBufferBlockId MultiBuffer::FindNextUnavailable(const BlockId& pos) const { … }
void MultiBuffer::NotifyAvailableRange(
const Interval<MultiBufferBlockId>& observer_range,
const Interval<MultiBufferBlockId>& new_range) { … }
void MultiBuffer::ReleaseBlocks(const std::vector<MultiBufferBlockId>& blocks) { … }
void MultiBuffer::OnEmpty() { … }
void MultiBuffer::AddProvider(std::unique_ptr<DataProvider> provider) { … }
std::unique_ptr<MultiBuffer::DataProvider> MultiBuffer::RemoveProvider(
DataProvider* provider) { … }
MultiBuffer::ProviderState MultiBuffer::SuggestProviderState(
const BlockId& pos) const { … }
bool MultiBuffer::ProviderCollision(const BlockId& id) const { … }
void MultiBuffer::Prune(size_t max_to_free) { … }
void MultiBuffer::OnDataProviderEvent(DataProvider* provider_tmp) { … }
void MultiBuffer::MergeFrom(MultiBuffer* other) { … }
void MultiBuffer::GetBlocksThreadsafe(
const BlockId& from,
const BlockId& to,
std::vector<scoped_refptr<media::DataBuffer>>* output) { … }
void MultiBuffer::PinRange(const BlockId& from,
const BlockId& to,
int32_t how_much) { … }
void MultiBuffer::PinRanges(const IntervalMap<BlockId, int32_t>& ranges) { … }
void MultiBuffer::IncrementMaxSize(int64_t size) { … }
int64_t MultiBuffer::UncommittedBytesAt(const MultiBuffer::BlockId& block) { … }
}