#include "storage/browser/blob/blob_data_item.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/file_access/scoped_file_access_delegate.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/net_errors.h"
#include "services/network/public/cpp/data_pipe_to_source_stream.h"
#include "storage/browser/file_system/file_system_context.h"
#include "third_party/blink/public/common/blob/blob_utils.h"
namespace storage {
namespace {
const base::FilePath::CharType kFutureFileName[] = …);
}
class MojoDataItem : public BlobDataItem::DataHandle { … };
BlobDataItem::DataHandle::~DataHandle() = default;
scoped_refptr<BlobDataItem> BlobDataItem::CreateBytes(
base::span<const uint8_t> bytes) { … }
scoped_refptr<BlobDataItem> BlobDataItem::CreateBytesDescription(
size_t length) { … }
scoped_refptr<BlobDataItem> BlobDataItem::CreateFile(
base::FilePath path,
file_access::ScopedFileAccessDelegate::RequestFilesAccessIOCallback
file_access) { … }
scoped_refptr<BlobDataItem> BlobDataItem::CreateFile(
base::FilePath path,
uint64_t offset,
uint64_t length,
base::Time expected_modification_time,
scoped_refptr<ShareableFileReference> file_ref,
file_access::ScopedFileAccessDelegate::RequestFilesAccessIOCallback
file_access) { … }
scoped_refptr<BlobDataItem> BlobDataItem::CreateFutureFile(uint64_t offset,
uint64_t length,
uint64_t file_id) { … }
scoped_refptr<BlobDataItem> BlobDataItem::CreateFileFilesystem(
const FileSystemURL& url,
uint64_t offset,
uint64_t length,
base::Time expected_modification_time,
scoped_refptr<FileSystemContext> file_system_context,
file_access::ScopedFileAccessDelegate::RequestFilesAccessIOCallback
file_access) { … }
scoped_refptr<BlobDataItem> BlobDataItem::CreateReadableDataHandle(
scoped_refptr<DataHandle> data_handle,
uint64_t offset,
uint64_t length) { … }
scoped_refptr<BlobDataItem> BlobDataItem::CreateMojoDataItem(
mojom::BlobDataItemPtr item) { … }
bool BlobDataItem::IsFutureFileItem() const { … }
uint64_t BlobDataItem::GetFutureFileID() const { … }
BlobDataItem::BlobDataItem(Type type, uint64_t offset, uint64_t length)
: … { … }
BlobDataItem::~BlobDataItem() = default;
void BlobDataItem::AllocateBytes() { … }
void BlobDataItem::PopulateBytes(base::span<const uint8_t> data) { … }
void BlobDataItem::ShrinkBytes(size_t new_length) { … }
void BlobDataItem::PopulateFile(
base::FilePath path,
base::Time expected_modification_time,
scoped_refptr<ShareableFileReference> file_ref) { … }
void BlobDataItem::ShrinkFile(uint64_t new_length) { … }
void BlobDataItem::GrowFile(uint64_t new_length) { … }
void BlobDataItem::SetFileModificationTimes(
std::vector<scoped_refptr<BlobDataItem>> items,
std::vector<base::Time> times) { … }
void PrintTo(const BlobDataItem& x, ::std::ostream* os) { … }
bool operator==(const BlobDataItem& a, const BlobDataItem& b) { … }
bool operator!=(const BlobDataItem& a, const BlobDataItem& b) { … }
}