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

Unified Diff: sql/connection.cc

Issue 2623083002: [sql] Move time-machine support from third_party/sqlite to sql/ (Closed)
Patch Set: review comments. 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
Index: sql/connection.cc
diff --git a/sql/connection.cc b/sql/connection.cc
index d220c8e8d78906aad8f9064bd752ea811ec43cf6..a86af5d8bec36dd1317883819e7d8265c3709c87 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 : NULL);
Marijn Kruisselbrink 2017/01/23 23:32:46 nit: this should probably also be nullptr (sorry,
Scott Hess - ex-Googler 2017/01/23 23:47:06 Sorry should be at my end - when you mentioned it
+ 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') | sql/vfs_wrapper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698