chromium/third_party/blink/renderer/platform/image-decoders/segment_reader.cc

// Copyright 2016 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/segment_reader.h"

#include <utility>

#include "base/containers/span.h"
#include "base/memory/scoped_refptr.h"
#include "base/synchronization/lock.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/skia/include/core/SkData.h"

namespace blink {

namespace {

// Helpers for ROBufferSegmentReader and ParkableImageSegmentReader
template <class Iter>
size_t BufferGetSomeData(Iter& iter,
                         size_t& position_of_block,
                         const char*& data,
                         size_t position) {}

template <class Iter>
sk_sp<SkData> BufferCopyAsSkData(Iter iter, size_t available) {}

}  // namespace

// SharedBufferSegmentReader ---------------------------------------------------

// Interface for ImageDecoder to read a SharedBuffer.
class SharedBufferSegmentReader final : public SegmentReader {};

SharedBufferSegmentReader::SharedBufferSegmentReader(
    scoped_refptr<const SharedBuffer> buffer)
    :{}

size_t SharedBufferSegmentReader::size() const {}

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

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

// DataSegmentReader -----------------------------------------------------------

// Interface for ImageDecoder to read an SkData.
class DataSegmentReader final : public SegmentReader {};

DataSegmentReader::DataSegmentReader(sk_sp<SkData> data)
    :{}

size_t DataSegmentReader::size() const {}

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

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

// ROBufferSegmentReader -------------------------------------------------------

class ROBufferSegmentReader final : public SegmentReader {};

ROBufferSegmentReader::ROBufferSegmentReader(scoped_refptr<ROBuffer> buffer)
    :{}

size_t ROBufferSegmentReader::size() const {}

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

static void UnrefROBuffer(const void* ptr, void* context) {}

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

// SegmentReader ---------------------------------------------------------------

scoped_refptr<SegmentReader> SegmentReader::CreateFromSharedBuffer(
    scoped_refptr<const SharedBuffer> buffer) {}

scoped_refptr<SegmentReader> SegmentReader::CreateFromSkData(
    sk_sp<SkData> data) {}

scoped_refptr<SegmentReader> SegmentReader::CreateFromROBuffer(
    scoped_refptr<ROBuffer> buffer) {}

// static
sk_sp<SkData> SegmentReader::RWBufferCopyAsSkData(RWBuffer::ROIter iter,
                                                  size_t available) {}

// static
size_t SegmentReader::RWBufferGetSomeData(RWBuffer::ROIter& iter,
                                          size_t& position_of_block,
                                          const char*& data,
                                          size_t position) {}

}  // namespace blink