chromium/third_party/blink/renderer/platform/image-decoders/rw_buffer.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/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/platform/image-decoders/rw_buffer.h"

#include "base/atomic_ref_count.h"
#include "base/check.h"
#include "base/check_op.h"
#include "base/memory/raw_ptr.h"
#include "third_party/blink/renderer/platform/wtf/allocator/partitions.h"

#include <algorithm>
#include <atomic>
#include <new>

namespace blink {

namespace {

// Force small chunks to be a page's worth
static const size_t kMinAllocSize =;

}  // namespace

struct RWBuffer::BufferBlock {};

struct RWBuffer::BufferHead {};

size_t RWBuffer::ROIter::size() const {}

RWBuffer::ROIter::ROIter(RWBuffer* rw_buffer, size_t available)
    :{}

const void* RWBuffer::ROIter::data() const {}

bool RWBuffer::ROIter::Next() {}

bool RWBuffer::ROIter::HasNext() const {}

///////////////////////////////////////////////////////////////////////////////////////////////////
// The reader can only access block.capacity_ (which never changes), and cannot
// access block.used_, which may be updated by the writer.
//
ROBuffer::ROBuffer(const RWBuffer::BufferHead* head,
                   size_t available,
                   const RWBuffer::BufferBlock* tail)
    :{}

ROBuffer::~ROBuffer() {}

ROBuffer::Iter::Iter(const ROBuffer* buffer) {}

ROBuffer::Iter::Iter(const scoped_refptr<ROBuffer>& buffer) {}

void ROBuffer::Iter::Reset(const ROBuffer* buffer) {}

const void* ROBuffer::Iter::data() const {}

size_t ROBuffer::Iter::size() const {}

bool ROBuffer::Iter::Next() {}

///////////////////////////////////////////////////////////////////////////////////////////////////

RWBuffer::RWBuffer(size_t initial_capacity) {}

RWBuffer::RWBuffer(base::OnceCallback<size_t(void*, size_t)> writer,
                   size_t initial_capacity) {}

RWBuffer::~RWBuffer() {}

// It is important that we always completely fill the current block before
// spilling over to the next, since our reader will be using capacity_ (min'd
// against its total available) to know how many bytes to read from a given
// block.
//
void RWBuffer::Append(const void* src, size_t length, size_t reserve) {}

scoped_refptr<ROBuffer> RWBuffer::MakeROBufferSnapshot() const {}

bool RWBuffer::HasNoSnapshots() const {}

void RWBuffer::Validate() const {}

}  // namespace blink