#include "sql/sandboxed_vfs.h"
#include <algorithm>
#include <cstring>
#include <memory>
#include <optional>
#include <ostream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/check_op.h"
#include "base/dcheck_is_on.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "sql/initialization.h"
#include "sql/sandboxed_vfs_file.h"
#include "sql/vfs_wrapper.h"
#include "third_party/sqlite/sqlite3.h"
namespace sql {
namespace {
SandboxedVfs& SandboxedVfsFromSqliteVfs(sqlite3_vfs& vfs) { … }
int SandboxedVfsOpen(sqlite3_vfs* vfs,
const char* full_path,
sqlite3_file* result_file,
int requested_flags,
int* granted_flags) { … }
int SandboxedVfsDelete(sqlite3_vfs* vfs, const char* full_path, int sync_dir) { … }
int SandboxedVfsAccess(sqlite3_vfs* vfs,
const char* full_path,
int flags,
int* result) { … }
int SandboxedVfsFullPathname(sqlite3_vfs* vfs,
const char* file_path,
int result_size,
char* result) { … }
int SandboxedVfsRandomness(sqlite3_vfs* vfs, int result_size, char* result) { … }
int SandboxedVfsSleep(sqlite3_vfs* vfs, int microseconds) { … }
int SandboxedVfsGetLastError(sqlite3_vfs* vfs,
int message_size,
char* message) { … }
int SandboxedVfsCurrentTimeInt64(sqlite3_vfs* vfs, sqlite3_int64* result_ms) { … }
sqlite3_vfs SqliteVfsFor(SandboxedVfs* sandboxed_vfs, const char* name) { … }
base::Time SqliteEpoch() { … }
#if DCHECK_IS_ON()
SandboxedVfsFileType VfsFileTypeFromPath(const char* full_path_cstr) { … }
#endif
}
void SandboxedVfs::Register(const char* name,
std::unique_ptr<Delegate> delegate,
bool make_default) { … }
int SandboxedVfs::Open(const char* full_path,
sqlite3_file& result_file,
int requested_flags,
int* granted_flags) { … }
int SandboxedVfs::Delete(const char* full_path, int sync_dir) { … }
int SandboxedVfs::Access(const char* full_path, int flags, int& result) { … }
int SandboxedVfs::FullPathname(const char* file_path,
int result_size,
char* result) { … }
int SandboxedVfs::Randomness(int result_size, char* result) { … }
int SandboxedVfs::Sleep(int microseconds) { … }
int SandboxedVfs::GetLastError(int message_size, char* message) const { … }
int SandboxedVfs::CurrentTimeInt64(sqlite3_int64* result_ms) { … }
SandboxedVfs::SandboxedVfs(const char* name,
std::unique_ptr<Delegate> delegate,
bool make_default)
: … { … }
}