#include "storage/browser/file_system/local_file_stream_reader.h"
#include <stdint.h>
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_runner.h"
#include "base/types/expected_macros.h"
#include "base/types/pass_key.h"
#include "components/file_access/scoped_file_access.h"
#include "components/file_access/scoped_file_access_delegate.h"
#include "net/base/file_stream.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
namespace storage {
namespace {
const int kOpenFlagsForRead = …;
base::FileErrorOr<base::File::Info> DoGetFileInfo(const base::FilePath& path) { … }
}
std::unique_ptr<FileStreamReader> FileStreamReader::CreateForLocalFile(
scoped_refptr<base::TaskRunner> task_runner,
const base::FilePath& file_path,
int64_t initial_offset,
const base::Time& expected_modification_time,
file_access::ScopedFileAccessDelegate::RequestFilesAccessIOCallback
file_access) { … }
LocalFileStreamReader::~LocalFileStreamReader() = default;
int LocalFileStreamReader::Read(net::IOBuffer* buf,
int buf_len,
net::CompletionOnceCallback callback) { … }
int64_t LocalFileStreamReader::GetLength(
net::Int64CompletionOnceCallback callback) { … }
LocalFileStreamReader::LocalFileStreamReader(
scoped_refptr<base::TaskRunner> task_runner,
const base::FilePath& file_path,
int64_t initial_offset,
const base::Time& expected_modification_time,
base::PassKey<FileStreamReader> ,
file_access::ScopedFileAccessDelegate::RequestFilesAccessIOCallback
file_access)
: … { … }
void LocalFileStreamReader::Open(net::CompletionOnceCallback callback) { … }
void LocalFileStreamReader::OnScopedFileAccessRequested(
net::CompletionOnceCallback callback,
file_access::ScopedFileAccess scoped_file_access) { … }
void LocalFileStreamReader::DidVerifyForOpen(
net::CompletionOnceCallback callback,
file_access::ScopedFileAccess scoped_file_access,
int64_t get_length_result) { … }
void LocalFileStreamReader::DidOpenFileStream(
file_access::ScopedFileAccess ,
int result) { … }
void LocalFileStreamReader::DidSeekFileStream(int64_t seek_result) { … }
void LocalFileStreamReader::DidOpenForRead(net::IOBuffer* buf,
int buf_len,
net::CompletionOnceCallback callback,
int open_result) { … }
void LocalFileStreamReader::DidGetFileInfoForGetLength(
net::Int64CompletionOnceCallback callback,
base::FileErrorOr<base::File::Info> result) { … }
void LocalFileStreamReader::OnRead(int read_result) { … }
}