| Index: sql/mojo/mojo_vfs.cc
|
| diff --git a/sql/mojo/mojo_vfs.cc b/sql/mojo/mojo_vfs.cc
|
| index 8fc6da73b837a40e8d50a8324dbba70d5f86238e..943f38bd75eb79bc49c1d74c8236b3c945501bad 100644
|
| --- a/sql/mojo/mojo_vfs.cc
|
| +++ b/sql/mojo/mojo_vfs.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/logging.h"
|
| #include "base/rand_util.h"
|
| #include "base/strings/stringprintf.h"
|
| +#include "base/trace_event/trace_event.h"
|
| #include "components/filesystem/public/interfaces/file.mojom.h"
|
| #include "components/filesystem/public/interfaces/file_system.mojom.h"
|
| #include "components/filesystem/public/interfaces/types.mojom.h"
|
| @@ -60,6 +61,7 @@ filesystem::FilePtr& GetFSFile(sqlite3_file* vfs_file) {
|
|
|
| int MojoVFSClose(sqlite3_file* file) {
|
| DVLOG(1) << "MojoVFSClose(*)";
|
| + TRACE_EVENT0("sql", "MojoVFSClose");
|
| using filesystem::FilePtr;
|
| filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
|
| // Must call File::Close explicitly instead of just deleting the file, since
|
| @@ -75,6 +77,7 @@ int MojoVFSRead(sqlite3_file* sql_file,
|
| int size,
|
| sqlite3_int64 offset) {
|
| DVLOG(1) << "MojoVFSRead (" << size << " @ " << offset << ")";
|
| + TRACE_EVENT0("sql", "MojoVFSRead");
|
| filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
|
| mojo::Array<uint8_t> mojo_data;
|
| GetFSFile(sql_file)->Read(size, offset, filesystem::WHENCE_FROM_BEGIN,
|
| @@ -104,6 +107,7 @@ int MojoVFSWrite(sqlite3_file* sql_file,
|
| int size,
|
| sqlite_int64 offset) {
|
| DVLOG(1) << "MojoVFSWrite(*, " << size << ", " << offset << ")";
|
| + TRACE_EVENT0("sql", "MojoVFSWrite");
|
| mojo::Array<uint8_t> mojo_data(size);
|
| memcpy(&mojo_data.front(), buffer, size);
|
|
|
| @@ -128,6 +132,7 @@ int MojoVFSWrite(sqlite3_file* sql_file,
|
|
|
| int MojoVFSTruncate(sqlite3_file* sql_file, sqlite_int64 size) {
|
| DVLOG(1) << "MojoVFSTruncate(*, " << size << ")";
|
| + TRACE_EVENT0("sql", "MojoVFSTruncate");
|
| filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
|
| GetFSFile(sql_file)->Truncate(size, Capture(&error));
|
| GetFSFile(sql_file).WaitForIncomingResponse();
|
| @@ -142,6 +147,7 @@ int MojoVFSTruncate(sqlite3_file* sql_file, sqlite_int64 size) {
|
|
|
| int MojoVFSSync(sqlite3_file* sql_file, int flags) {
|
| DVLOG(1) << "MojoVFSSync(*, " << flags << ")";
|
| + TRACE_EVENT0("sql", "MojoVFSSync");
|
| filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
|
| GetFSFile(sql_file)->Flush(Capture(&error));
|
| GetFSFile(sql_file).WaitForIncomingResponse();
|
| @@ -156,6 +162,7 @@ int MojoVFSSync(sqlite3_file* sql_file, int flags) {
|
|
|
| int MojoVFSFileSize(sqlite3_file* sql_file, sqlite_int64* size) {
|
| DVLOG(1) << "MojoVFSFileSize(*)";
|
| + TRACE_EVENT0("sql", "MojoVFSFileSize");
|
|
|
| filesystem::FileError err = filesystem::FILE_ERROR_FAILED;
|
| filesystem::FileInformationPtr file_info;
|
| @@ -236,6 +243,9 @@ int MojoVFSOpen(sqlite3_vfs* mojo_vfs,
|
| int flags,
|
| int* pOutFlags) {
|
| DVLOG(1) << "MojoVFSOpen(*, " << name << ", *, " << flags << ")";
|
| + TRACE_EVENT2("sql", "MojoVFSOpen",
|
| + "name", name,
|
| + "flags", flags);
|
| int open_flags = 0;
|
| if (flags & SQLITE_OPEN_EXCLUSIVE) {
|
| DCHECK(flags & SQLITE_OPEN_CREATE);
|
| @@ -293,6 +303,9 @@ int MojoVFSOpen(sqlite3_vfs* mojo_vfs,
|
|
|
| int MojoVFSDelete(sqlite3_vfs* mojo_vfs, const char* filename, int sync_dir) {
|
| DVLOG(1) << "MojoVFSDelete(*, " << filename << ", " << sync_dir << ")";
|
| + TRACE_EVENT2("sql", "MojoVFSDelete",
|
| + "name", filename,
|
| + "sync_dir", sync_dir);
|
| // TODO(erg): The default windows sqlite VFS has retry code to work around
|
| // antivirus software keeping files open. We'll probably have to do something
|
| // like that in the far future if we ever support Windows.
|
| @@ -313,6 +326,9 @@ int MojoVFSAccess(sqlite3_vfs* mojo_vfs,
|
| int flags,
|
| int* result) {
|
| DVLOG(1) << "MojoVFSAccess(*, " << filename << ", " << flags << ", *)";
|
| + TRACE_EVENT2("sql", "MojoVFSAccess",
|
| + "name", filename,
|
| + "flags", flags);
|
| filesystem::FileError error = filesystem::FILE_ERROR_FAILED;
|
|
|
| if (flags == SQLITE_ACCESS_READWRITE || flags == SQLITE_ACCESS_READ) {
|
|
|