#if defined(UNSAFE_BUFFERS_BUILD)
#pragma allow_unsafe_buffers
#endif
#include "pdf/loader/document_loader_impl.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <utility>
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/numerics/safe_math.h"
#include "base/strings/string_util.h"
#include "pdf/loader/result_codes.h"
#include "pdf/loader/url_loader_wrapper.h"
#include "pdf/pdf_features.h"
#include "ui/gfx/range/range.h"
namespace chrome_pdf {
namespace {
constexpr int kChunkCloseDistance = …;
constexpr size_t kReadBufferSize = …;
bool ResponseStatusSuccess(const URLLoaderWrapper* loader) { … }
bool IsValidContentType(const std::string& type) { … }
}
DocumentLoaderImpl::Chunk::Chunk() = default;
DocumentLoaderImpl::Chunk::~Chunk() = default;
void DocumentLoaderImpl::Chunk::Clear() { … }
DocumentLoaderImpl::DocumentLoaderImpl(Client* client)
: … { … }
DocumentLoaderImpl::~DocumentLoaderImpl() = default;
bool DocumentLoaderImpl::Init(std::unique_ptr<URLLoaderWrapper> loader,
const std::string& url) { … }
bool DocumentLoaderImpl::IsDocumentComplete() const { … }
uint32_t DocumentLoaderImpl::GetDocumentSize() const { … }
uint32_t DocumentLoaderImpl::BytesReceived() const { … }
void DocumentLoaderImpl::ClearPendingRequests() { … }
bool DocumentLoaderImpl::GetBlock(uint32_t position,
uint32_t size,
void* buf) const { … }
bool DocumentLoaderImpl::IsDataAvailable(uint32_t position,
uint32_t size) const { … }
void DocumentLoaderImpl::RequestData(uint32_t position, uint32_t size) { … }
void DocumentLoaderImpl::SetPartialLoadingEnabled(bool enabled) { … }
bool DocumentLoaderImpl::ShouldCancelLoading() const { … }
void DocumentLoaderImpl::ContinueDownload() { … }
void DocumentLoaderImpl::DidOpenPartial(int32_t result) { … }
void DocumentLoaderImpl::ReadMore() { … }
void DocumentLoaderImpl::DidRead(int32_t result) { … }
bool DocumentLoaderImpl::SaveBuffer(uint32_t input_size) { … }
void DocumentLoaderImpl::SaveChunkData() { … }
uint32_t DocumentLoaderImpl::EndOfCurrentChunk() const { … }
void DocumentLoaderImpl::ReadComplete() { … }
}