#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/file_system_access/file_system_access_incognito_file_delegate.h"
#include <optional>
#include "base/files/file.h"
#include "base/files/file_error_or.h"
#include "base/memory/scoped_refptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/system/string_data_source.h"
#include "third_party/blink/public/common/blob/blob_utils.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/file_system_access/file_system_access_file_delegate.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_mojo.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/wtf.h"
#include "third_party/blink/renderer/platform/wtf/wtf_size_t.h"
namespace blink {
namespace {
bool CreateDataPipeForSize(uint64_t data_size,
mojo::ScopedDataPipeProducerHandle& producer,
mojo::ScopedDataPipeConsumerHandle& consumer) { … }
void WriteDataToProducer(
mojo::ScopedDataPipeProducerHandle producer_handle,
scoped_refptr<base::RefCountedData<Vector<uint8_t>>> data) { … }
}
FileSystemAccessFileDelegate* FileSystemAccessFileDelegate::CreateForIncognito(
ExecutionContext* context,
mojo::PendingRemote<mojom::blink::FileSystemAccessFileDelegateHost>
incognito_file_remote) { … }
FileSystemAccessIncognitoFileDelegate::FileSystemAccessIncognitoFileDelegate(
ExecutionContext* context,
mojo::PendingRemote<mojom::blink::FileSystemAccessFileDelegateHost>
incognito_file_remote,
base::PassKey<FileSystemAccessFileDelegate>)
: … { … }
void FileSystemAccessIncognitoFileDelegate::Trace(Visitor* visitor) const { … }
base::FileErrorOr<int> FileSystemAccessIncognitoFileDelegate::Read(
int64_t offset,
base::span<uint8_t> data) { … }
base::FileErrorOr<int> FileSystemAccessIncognitoFileDelegate::Write(
int64_t offset,
const base::span<uint8_t> data) { … }
base::FileErrorOr<int64_t> FileSystemAccessIncognitoFileDelegate::GetLength() { … }
base::FileErrorOr<bool> FileSystemAccessIncognitoFileDelegate::SetLength(
int64_t length) { … }
bool FileSystemAccessIncognitoFileDelegate::Flush() { … }
void FileSystemAccessIncognitoFileDelegate::Close() { … }
}