#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "content/browser/file_system_access/file_system_access_file_delegate_host_impl.h"
#include <cstdint>
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/scoped_refptr.h"
#include "base/numerics/safe_math.h"
#include "base/task/sequenced_task_runner.h"
#include "components/services/storage/public/cpp/big_io_buffer.h"
#include "content/browser/file_system_access/file_system_access_manager_impl.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "mojo/public/cpp/base/big_buffer.h"
#include "net/base/io_buffer.h"
#include "partition_alloc/partition_alloc_constants.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_operation_runner.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/common/file_system/file_system_util.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_file_handle.mojom.h"
namespace content {
namespace {
void ReadOnIOThread(scoped_refptr<storage::FileSystemContext> context,
storage::FileSystemURL url,
int64_t offset,
scoped_refptr<storage::BigIOBuffer> buffer,
scoped_refptr<base::SequencedTaskRunner> reply_runner,
base::OnceCallback<void(int)> callback) { … }
}
FileSystemAccessFileDelegateHostImpl::FileSystemAccessFileDelegateHostImpl(
FileSystemAccessManagerImpl* manager,
const storage::FileSystemURL& url,
base::PassKey<FileSystemAccessAccessHandleHostImpl> ,
mojo::PendingReceiver<blink::mojom::FileSystemAccessFileDelegateHost>
receiver)
: … { … }
FileSystemAccessFileDelegateHostImpl::~FileSystemAccessFileDelegateHostImpl() =
default;
struct FileSystemAccessFileDelegateHostImpl::WriteState { … };
void FileSystemAccessFileDelegateHostImpl::Read(int64_t offset,
int bytes_to_read,
ReadCallback callback) { … }
void FileSystemAccessFileDelegateHostImpl::DidRead(
scoped_refptr<storage::BigIOBuffer> buffer,
ReadCallback callback,
int rv) { … }
void FileSystemAccessFileDelegateHostImpl::Write(
int64_t offset,
mojo::ScopedDataPipeConsumerHandle data,
WriteCallback callback) { … }
void FileSystemAccessFileDelegateHostImpl::DidWrite(WriteState* state,
base::File::Error result,
int64_t bytes,
bool complete) { … }
void FileSystemAccessFileDelegateHostImpl::GetLength(
GetLengthCallback callback) { … }
void FileSystemAccessFileDelegateHostImpl::SetLength(
int64_t length,
SetLengthCallback callback) { … }
void FileSystemAccessFileDelegateHostImpl::OnDisconnect() { … }
}