#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "mojo/public/cpp/base/big_buffer.h"
#include "base/check.h"
#include "base/containers/heap_array.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
namespace mojo_base {
namespace internal {
BigBufferSharedMemoryRegion::BigBufferSharedMemoryRegion() : … { … }
BigBufferSharedMemoryRegion::BigBufferSharedMemoryRegion(
mojo::ScopedSharedBufferHandle buffer_handle,
size_t size)
: … { … }
BigBufferSharedMemoryRegion::BigBufferSharedMemoryRegion(
BigBufferSharedMemoryRegion&& other) = default;
BigBufferSharedMemoryRegion::~BigBufferSharedMemoryRegion() = default;
BigBufferSharedMemoryRegion& BigBufferSharedMemoryRegion::operator=(
BigBufferSharedMemoryRegion&& other) = default;
mojo::ScopedSharedBufferHandle BigBufferSharedMemoryRegion::TakeBufferHandle() { … }
}
namespace {
void TryCreateSharedMemory(
size_t size,
BigBuffer::StorageType* storage_type,
std::optional<internal::BigBufferSharedMemoryRegion>* shared_memory) { … }
}
constexpr size_t BigBuffer::kMaxInlineBytes;
BigBuffer::BigBuffer() : … { … }
BigBuffer::BigBuffer(BigBuffer&& other)
: … { … }
BigBuffer::BigBuffer(base::span<const uint8_t> data) { … }
BigBuffer::BigBuffer(const std::vector<uint8_t>& data)
: … { … }
BigBuffer::BigBuffer(internal::BigBufferSharedMemoryRegion shared_memory)
: … { … }
BigBuffer::BigBuffer(size_t size) { … }
BigBuffer::~BigBuffer() = default;
BigBuffer& BigBuffer::operator=(BigBuffer&& other) { … }
BigBuffer BigBuffer::Clone() const { … }
uint8_t* BigBuffer::data() { … }
const uint8_t* BigBuffer::data() const { … }
size_t BigBuffer::size() const { … }
BigBufferView::BigBufferView() = default;
BigBufferView::BigBufferView(BigBufferView&& other) = default;
BigBufferView::BigBufferView(base::span<const uint8_t> bytes) { … }
BigBufferView::~BigBufferView() = default;
BigBufferView& BigBufferView::operator=(BigBufferView&& other) = default;
void BigBufferView::SetBytes(base::span<const uint8_t> bytes) { … }
void BigBufferView::SetSharedMemory(
internal::BigBufferSharedMemoryRegion shared_memory) { … }
base::span<const uint8_t> BigBufferView::data() const { … }
BigBuffer BigBufferView::ToBigBuffer(BigBufferView view) { … }
BigBufferView BigBufferView::CreateInvalidForTest() { … }
}