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

Unified Diff: sql/connection.h

Issue 1349863003: [sql] Use memory-mapped I/O for sql::Connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: overreverted sync fix, needed to keep iOS fix Created 5 years, 3 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 | « no previous file | sql/connection.cc » ('j') | sync/syncable/directory_backing_store.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/connection.h
diff --git a/sql/connection.h b/sql/connection.h
index 19592d9f0e44ed68764b9d25a88d9a65424ba9b7..d456b6cd88c9627b488c970dcd46de4a72c7945a 100644
--- a/sql/connection.h
+++ b/sql/connection.h
@@ -146,6 +146,9 @@ class SQL_EXPORT Connection {
// other platforms.
void set_restrict_to_user() { restrict_to_user_ = true; }
+ // Call to opt out of memory-mapped file I/O.
+ void set_mmap_disabled() { mmap_disabled_ = true; }
+
// Set an error-handling callback. On errors, the error number (and
// statement, if available) will be passed to the callback.
//
@@ -638,6 +641,12 @@ class SQL_EXPORT Connection {
return clock_->Now();
}
+ // Release page-cache memory if memory-mapped I/O is enabled and the database
+ // was changed. Passing true for |implicit_change_performed| allows
+ // overriding the change detection for cases like DDL (CREATE, DROP, etc),
+ // which do not participate in the total-rows-changed tracking.
+ void ReleaseCacheMemoryIfNeeded(bool implicit_change_performed);
+
// The actual sqlite database. Will be NULL before Init has been called or if
// Init resulted in an error.
sqlite3* db_;
@@ -679,6 +688,17 @@ class SQL_EXPORT Connection {
// databases.
bool poisoned_;
+ // |true| if SQLite memory-mapped I/O is not desired for this connection.
+ bool mmap_disabled_;
+
+ // |true| if SQLite memory-mapped I/O was enabled for this connection.
+ // Used by ReleaseCacheMemoryIfNeeded().
+ bool mmap_enabled_;
+
+ // Used by ReleaseCacheMemoryIfNeeded() to track if new changes have happened
+ // since memory was last released.
+ int total_changes_at_last_release_;
+
ErrorCallback error_callback_;
// Tag for auxiliary histograms.
« no previous file with comments | « no previous file | sql/connection.cc » ('j') | sync/syncable/directory_backing_store.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698