#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "components/services/filesystem/public/mojom/directory.mojom-blink.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "mojo/public/cpp/bindings/features.h"
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/proxy_to_responder.h"
#include "mojo/public/cpp/bindings/lib/send_message_helper.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "mojo/public/cpp/bindings/urgent_message_scope.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "components/services/filesystem/public/mojom/directory.mojom-params-data.h"
#include "components/services/filesystem/public/mojom/directory.mojom-shared-message-ids.h"
#include "components/services/filesystem/public/mojom/directory.mojom-blink-import-headers.h"
#include "components/services/filesystem/public/mojom/directory.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"
namespace filesystem::mojom::blink {
FileOpenDetails::FileOpenDetails()
: … { … }
FileOpenDetails::FileOpenDetails(
const WTF::String& path_in,
uint32_t open_flags_in)
: … { … }
FileOpenDetails::~FileOpenDetails() = default;
size_t FileOpenDetails::Hash(size_t seed) const { … }
void FileOpenDetails::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool FileOpenDetails::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
FileOpenResult::FileOpenResult()
: … { … }
FileOpenResult::FileOpenResult(
const WTF::String& path_in,
::base::File::Error error_in,
::base::File file_handle_in)
: … { … }
FileOpenResult::~FileOpenResult() = default;
void FileOpenResult::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool FileOpenResult::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
const char Directory::Name_[] = …;
Directory::IPCStableHashFunction Directory::MessageToMethodInfo_(mojo::Message& message) { … }
const char* Directory::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t Directory::Read_Sym::IPCStableHash() { … }
uint32_t Directory::OpenFileHandle_Sym::IPCStableHash() { … }
uint32_t Directory::OpenFileHandles_Sym::IPCStableHash() { … }
uint32_t Directory::OpenDirectory_Sym::IPCStableHash() { … }
uint32_t Directory::Rename_Sym::IPCStableHash() { … }
uint32_t Directory::Replace_Sym::IPCStableHash() { … }
uint32_t Directory::Delete_Sym::IPCStableHash() { … }
uint32_t Directory::Exists_Sym::IPCStableHash() { … }
uint32_t Directory::IsWritable_Sym::IPCStableHash() { … }
uint32_t Directory::Flush_Sym::IPCStableHash() { … }
uint32_t Directory::StatFile_Sym::IPCStableHash() { … }
uint32_t Directory::Clone_Sym::IPCStableHash() { … }
uint32_t Directory::ReadEntireFile_Sym::IPCStableHash() { … }
uint32_t Directory::WriteFile_Sym::IPCStableHash() { … }
# endif
bool Directory::Read(::base::File::Error* out_error, std::optional<WTF::Vector<::filesystem::mojom::blink::DirectoryEntryPtr>>* out_directory_contents) { … }
bool Directory::OpenFileHandle(const WTF::String& path, uint32_t open_flags, ::base::File::Error* out_error, ::base::File* out_file_handle) { … }
bool Directory::OpenFileHandles(WTF::Vector<FileOpenDetailsPtr> files, WTF::Vector<FileOpenResultPtr>* out_results) { … }
bool Directory::OpenDirectory(const WTF::String& path, ::mojo::PendingReceiver<Directory> directory, uint32_t open_flags, ::base::File::Error* out_error) { … }
bool Directory::Rename(const WTF::String& path, const WTF::String& new_path, ::base::File::Error* out_error) { … }
bool Directory::Replace(const WTF::String& path, const WTF::String& new_path, ::base::File::Error* out_error) { … }
bool Directory::Delete(const WTF::String& path, uint32_t delete_flags, ::base::File::Error* out_error) { … }
bool Directory::Exists(const WTF::String& path, ::base::File::Error* out_error, bool* out_exists) { … }
bool Directory::IsWritable(const WTF::String& path, ::base::File::Error* out_error, bool* out_is_writable) { … }
bool Directory::Flush(::base::File::Error* out_error) { … }
bool Directory::StatFile(const WTF::String& path, ::base::File::Error* out_error, ::filesystem::mojom::blink::FileInformationPtr* out_file_information) { … }
bool Directory::ReadEntireFile(const WTF::String& path, ::base::File::Error* out_error, WTF::Vector<uint8_t>* out_data) { … }
bool Directory::WriteFile(const WTF::String& path, const WTF::Vector<uint8_t>& data, ::base::File::Error* out_error) { … }
class Directory_Read_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_Read_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_OpenFileHandle_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_OpenFileHandle_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_OpenFileHandles_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_OpenFileHandles_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_OpenDirectory_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_OpenDirectory_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_Rename_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_Rename_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_Replace_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_Replace_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_Delete_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_Delete_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_Exists_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_Exists_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_IsWritable_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_IsWritable_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_Flush_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_Flush_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_StatFile_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_StatFile_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_ReadEntireFile_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_ReadEntireFile_ForwardToCallback
: public mojo::MessageReceiver { … };
class Directory_WriteFile_HandleSyncResponse
: public mojo::MessageReceiver { … };
class Directory_WriteFile_ForwardToCallback
: public mojo::MessageReceiver { … };
DirectoryProxy::DirectoryProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
bool DirectoryProxy::Read(
::base::File::Error* out_param_error, std::optional<WTF::Vector<::filesystem::mojom::blink::DirectoryEntryPtr>>* out_param_directory_contents) { … }
void DirectoryProxy::Read(
ReadCallback callback) { … }
bool DirectoryProxy::OpenFileHandle(
const WTF::String& param_path, uint32_t param_open_flags, ::base::File::Error* out_param_error, ::base::File* out_param_file_handle) { … }
void DirectoryProxy::OpenFileHandle(
const WTF::String& in_path, uint32_t in_open_flags, OpenFileHandleCallback callback) { … }
bool DirectoryProxy::OpenFileHandles(
WTF::Vector<FileOpenDetailsPtr> param_files, WTF::Vector<FileOpenResultPtr>* out_param_results) { … }
void DirectoryProxy::OpenFileHandles(
WTF::Vector<FileOpenDetailsPtr> in_files, OpenFileHandlesCallback callback) { … }
bool DirectoryProxy::OpenDirectory(
const WTF::String& param_path, ::mojo::PendingReceiver<Directory> param_directory, uint32_t param_open_flags, ::base::File::Error* out_param_error) { … }
void DirectoryProxy::OpenDirectory(
const WTF::String& in_path, ::mojo::PendingReceiver<Directory> in_directory, uint32_t in_open_flags, OpenDirectoryCallback callback) { … }
bool DirectoryProxy::Rename(
const WTF::String& param_path, const WTF::String& param_new_path, ::base::File::Error* out_param_error) { … }
void DirectoryProxy::Rename(
const WTF::String& in_path, const WTF::String& in_new_path, RenameCallback callback) { … }
bool DirectoryProxy::Replace(
const WTF::String& param_path, const WTF::String& param_new_path, ::base::File::Error* out_param_error) { … }
void DirectoryProxy::Replace(
const WTF::String& in_path, const WTF::String& in_new_path, ReplaceCallback callback) { … }
bool DirectoryProxy::Delete(
const WTF::String& param_path, uint32_t param_delete_flags, ::base::File::Error* out_param_error) { … }
void DirectoryProxy::Delete(
const WTF::String& in_path, uint32_t in_delete_flags, DeleteCallback callback) { … }
bool DirectoryProxy::Exists(
const WTF::String& param_path, ::base::File::Error* out_param_error, bool* out_param_exists) { … }
void DirectoryProxy::Exists(
const WTF::String& in_path, ExistsCallback callback) { … }
bool DirectoryProxy::IsWritable(
const WTF::String& param_path, ::base::File::Error* out_param_error, bool* out_param_is_writable) { … }
void DirectoryProxy::IsWritable(
const WTF::String& in_path, IsWritableCallback callback) { … }
bool DirectoryProxy::Flush(
::base::File::Error* out_param_error) { … }
void DirectoryProxy::Flush(
FlushCallback callback) { … }
bool DirectoryProxy::StatFile(
const WTF::String& param_path, ::base::File::Error* out_param_error, ::filesystem::mojom::blink::FileInformationPtr* out_param_file_information) { … }
void DirectoryProxy::StatFile(
const WTF::String& in_path, StatFileCallback callback) { … }
void DirectoryProxy::Clone(
::mojo::PendingReceiver<Directory> in_directory) { … }
bool DirectoryProxy::ReadEntireFile(
const WTF::String& param_path, ::base::File::Error* out_param_error, WTF::Vector<uint8_t>* out_param_data) { … }
void DirectoryProxy::ReadEntireFile(
const WTF::String& in_path, ReadEntireFileCallback callback) { … }
bool DirectoryProxy::WriteFile(
const WTF::String& param_path, const WTF::Vector<uint8_t>& param_data, ::base::File::Error* out_param_error) { … }
void DirectoryProxy::WriteFile(
const WTF::String& in_path, const WTF::Vector<uint8_t>& in_data, WriteFileCallback callback) { … }
class Directory_Read_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_Read_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_Read_ProxyToResponder::Run(
::base::File::Error in_error, std::optional<WTF::Vector<::filesystem::mojom::blink::DirectoryEntryPtr>> in_directory_contents) { … }
bool Directory_Read_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_OpenFileHandle_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_OpenFileHandle_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_OpenFileHandle_ProxyToResponder::Run(
::base::File::Error in_error, ::base::File in_file_handle) { … }
bool Directory_OpenFileHandle_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_OpenFileHandles_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_OpenFileHandles_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_OpenFileHandles_ProxyToResponder::Run(
WTF::Vector<FileOpenResultPtr> in_results) { … }
bool Directory_OpenFileHandles_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_OpenDirectory_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_OpenDirectory_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_OpenDirectory_ProxyToResponder::Run(
::base::File::Error in_error) { … }
bool Directory_OpenDirectory_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_Rename_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_Rename_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_Rename_ProxyToResponder::Run(
::base::File::Error in_error) { … }
bool Directory_Rename_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_Replace_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_Replace_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_Replace_ProxyToResponder::Run(
::base::File::Error in_error) { … }
bool Directory_Replace_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_Delete_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_Delete_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_Delete_ProxyToResponder::Run(
::base::File::Error in_error) { … }
bool Directory_Delete_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_Exists_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_Exists_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_Exists_ProxyToResponder::Run(
::base::File::Error in_error, bool in_exists) { … }
bool Directory_Exists_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_IsWritable_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_IsWritable_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_IsWritable_ProxyToResponder::Run(
::base::File::Error in_error, bool in_is_writable) { … }
bool Directory_IsWritable_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_Flush_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_Flush_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_Flush_ProxyToResponder::Run(
::base::File::Error in_error) { … }
bool Directory_Flush_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_StatFile_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_StatFile_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_StatFile_ProxyToResponder::Run(
::base::File::Error in_error, ::filesystem::mojom::blink::FileInformationPtr in_file_information) { … }
bool Directory_StatFile_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_ReadEntireFile_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_ReadEntireFile_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_ReadEntireFile_ProxyToResponder::Run(
::base::File::Error in_error, const WTF::Vector<uint8_t>& in_data) { … }
bool Directory_ReadEntireFile_HandleSyncResponse::Accept(
mojo::Message* message) { … }
class Directory_WriteFile_ProxyToResponder : public ::mojo::internal::ProxyToResponder { … };
bool Directory_WriteFile_ForwardToCallback::Accept(
mojo::Message* message) { … }
void Directory_WriteFile_ProxyToResponder::Run(
::base::File::Error in_error) { … }
bool Directory_WriteFile_HandleSyncResponse::Accept(
mojo::Message* message) { … }
bool DirectoryStubDispatch::Accept(
Directory* impl,
mojo::Message* message) { … }
bool DirectoryStubDispatch::AcceptWithResponder(
Directory* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kDirectoryValidationInfo[] = …;
bool DirectoryRequestValidator::Accept(mojo::Message* message) { … }
bool DirectoryResponseValidator::Accept(mojo::Message* message) { … }
}
namespace mojo {
bool StructTraits<::filesystem::mojom::blink::FileOpenDetails::DataView, ::filesystem::mojom::blink::FileOpenDetailsPtr>::Read(
::filesystem::mojom::blink::FileOpenDetails::DataView input,
::filesystem::mojom::blink::FileOpenDetailsPtr* output) { … }
bool StructTraits<::filesystem::mojom::blink::FileOpenResult::DataView, ::filesystem::mojom::blink::FileOpenResultPtr>::Read(
::filesystem::mojom::blink::FileOpenResult::DataView input,
::filesystem::mojom::blink::FileOpenResultPtr* output) { … }
}
namespace filesystem::mojom::blink {
void DirectoryInterceptorForTesting::Read(ReadCallback callback) { … }
void DirectoryInterceptorForTesting::OpenFileHandle(const WTF::String& path, uint32_t open_flags, OpenFileHandleCallback callback) { … }
void DirectoryInterceptorForTesting::OpenFileHandles(WTF::Vector<FileOpenDetailsPtr> files, OpenFileHandlesCallback callback) { … }
void DirectoryInterceptorForTesting::OpenDirectory(const WTF::String& path, ::mojo::PendingReceiver<Directory> directory, uint32_t open_flags, OpenDirectoryCallback callback) { … }
void DirectoryInterceptorForTesting::Rename(const WTF::String& path, const WTF::String& new_path, RenameCallback callback) { … }
void DirectoryInterceptorForTesting::Replace(const WTF::String& path, const WTF::String& new_path, ReplaceCallback callback) { … }
void DirectoryInterceptorForTesting::Delete(const WTF::String& path, uint32_t delete_flags, DeleteCallback callback) { … }
void DirectoryInterceptorForTesting::Exists(const WTF::String& path, ExistsCallback callback) { … }
void DirectoryInterceptorForTesting::IsWritable(const WTF::String& path, IsWritableCallback callback) { … }
void DirectoryInterceptorForTesting::Flush(FlushCallback callback) { … }
void DirectoryInterceptorForTesting::StatFile(const WTF::String& path, StatFileCallback callback) { … }
void DirectoryInterceptorForTesting::Clone(::mojo::PendingReceiver<Directory> directory) { … }
void DirectoryInterceptorForTesting::ReadEntireFile(const WTF::String& path, ReadEntireFileCallback callback) { … }
void DirectoryInterceptorForTesting::WriteFile(const WTF::String& path, const WTF::Vector<uint8_t>& data, WriteFileCallback callback) { … }
DirectoryAsyncWaiter::DirectoryAsyncWaiter(
Directory* proxy) : … { … }
DirectoryAsyncWaiter::~DirectoryAsyncWaiter() = default;
void DirectoryAsyncWaiter::Read(
::base::File::Error* out_error, std::optional<WTF::Vector<::filesystem::mojom::blink::DirectoryEntryPtr>>* out_directory_contents) { … }
void DirectoryAsyncWaiter::OpenFileHandle(
const WTF::String& path, uint32_t open_flags, ::base::File::Error* out_error, ::base::File* out_file_handle) { … }
void DirectoryAsyncWaiter::OpenFileHandles(
WTF::Vector<FileOpenDetailsPtr> files, WTF::Vector<FileOpenResultPtr>* out_results) { … }
WTF::Vector<FileOpenResultPtr> DirectoryAsyncWaiter::OpenFileHandles(
WTF::Vector<FileOpenDetailsPtr> files) { … }
void DirectoryAsyncWaiter::OpenDirectory(
const WTF::String& path, ::mojo::PendingReceiver<Directory> directory, uint32_t open_flags, ::base::File::Error* out_error) { … }
::base::File::Error DirectoryAsyncWaiter::OpenDirectory(
const WTF::String& path, ::mojo::PendingReceiver<Directory> directory, uint32_t open_flags) { … }
void DirectoryAsyncWaiter::Rename(
const WTF::String& path, const WTF::String& new_path, ::base::File::Error* out_error) { … }
::base::File::Error DirectoryAsyncWaiter::Rename(
const WTF::String& path, const WTF::String& new_path) { … }
void DirectoryAsyncWaiter::Replace(
const WTF::String& path, const WTF::String& new_path, ::base::File::Error* out_error) { … }
::base::File::Error DirectoryAsyncWaiter::Replace(
const WTF::String& path, const WTF::String& new_path) { … }
void DirectoryAsyncWaiter::Delete(
const WTF::String& path, uint32_t delete_flags, ::base::File::Error* out_error) { … }
::base::File::Error DirectoryAsyncWaiter::Delete(
const WTF::String& path, uint32_t delete_flags) { … }
void DirectoryAsyncWaiter::Exists(
const WTF::String& path, ::base::File::Error* out_error, bool* out_exists) { … }
void DirectoryAsyncWaiter::IsWritable(
const WTF::String& path, ::base::File::Error* out_error, bool* out_is_writable) { … }
void DirectoryAsyncWaiter::Flush(
::base::File::Error* out_error) { … }
::base::File::Error DirectoryAsyncWaiter::Flush(
) { … }
void DirectoryAsyncWaiter::StatFile(
const WTF::String& path, ::base::File::Error* out_error, ::filesystem::mojom::blink::FileInformationPtr* out_file_information) { … }
void DirectoryAsyncWaiter::ReadEntireFile(
const WTF::String& path, ::base::File::Error* out_error, WTF::Vector<uint8_t>* out_data) { … }
void DirectoryAsyncWaiter::WriteFile(
const WTF::String& path, const WTF::Vector<uint8_t>& data, ::base::File::Error* out_error) { … }
::base::File::Error DirectoryAsyncWaiter::WriteFile(
const WTF::String& path, const WTF::Vector<uint8_t>& data) { … }
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif