Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: sql/connection.cc

Issue 2623083002: [sql] Move time-machine support from third_party/sqlite to sql/ (Closed)
Patch Set: scoped-ref in test, too, iwyu pass to remove leftover-from-prototype includes. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sql/BUILD.gn ('k') | sql/sqlite_features_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/connection.cc
diff --git a/sql/connection.cc b/sql/connection.cc
index d220c8e8d78906aad8f9064bd752ea811ec43cf6..ac715aedba682f11def4d1d46f6576f0b7ee699c 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -33,6 +33,7 @@
#include "sql/connection_memory_dump_provider.h"
#include "sql/meta_table.h"
#include "sql/statement.h"
+#include "sql/vfs_wrapper.h"
#include "third_party/sqlite/sqlite3.h"
#if defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
@@ -1690,7 +1691,12 @@ bool Connection::OpenInternal(const std::string& file_name,
DLOG_IF(FATAL, poisoned_) << "sql::Connection is already open.";
poisoned_ = false;
- int err = sqlite3_open(file_name.c_str(), &db_);
+ // Custom memory-mapping VFS which reads pages using regular I/O on first hit.
+ sqlite3_vfs* vfs = VFSWrapper();
+ const char* vfs_name = (vfs ? vfs->zName : nullptr);
+ int err = sqlite3_open_v2(file_name.c_str(), &db_,
+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
+ vfs_name);
if (err != SQLITE_OK) {
// Extended error codes cannot be enabled until a handle is
// available, fetch manually.
« no previous file with comments | « sql/BUILD.gn ('k') | sql/sqlite_features_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698