summaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
authorvichang <vichang@chromium.org>2016-01-28 14:09:03 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-28 22:09:52 +0000
commit7ce37c1ec34e33f7e2c4b87341f16885942c3e5c (patch)
treeb91e0bc688a150d03e12ca8f54cf2d700ecfef5f /sql
parent12607e58c74926c0480c08f19214908f987a37a3 (diff)
downloadchromium_src-7ce37c1ec34e33f7e2c4b87341f16885942c3e5c.zip
chromium_src-7ce37c1ec34e33f7e2c4b87341f16885942c3e5c.tar.gz
chromium_src-7ce37c1ec34e33f7e2c4b87341f16885942c3e5c.tar.bz2
Add flag to disable mmap in all sql connection in work build
Work Chrome runs in environment without a proper mmap support. Disable it for all work chrome. BUG=554269 Review URL: https://codereview.chromium.org/1637683003 Cr-Commit-Position: refs/heads/master@{#372179}
Diffstat (limited to 'sql')
-rw-r--r--sql/connection.cc10
-rw-r--r--sql/connection.h5
2 files changed, 13 insertions, 2 deletions
diff --git a/sql/connection.cc b/sql/connection.cc
index 003005a..f08560c 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -43,6 +43,8 @@ namespace {
// TODO(shess): Better story on this. http://crbug.com/56559
const int kBusyTimeoutSeconds = 1;
+bool g_mmap_disabled_default = false;
+
class ScopedBusyTimeout {
public:
explicit ScopedBusyTimeout(sqlite3* db)
@@ -254,6 +256,12 @@ bool Connection::ShouldIgnoreSqliteCompileError(int error) {
basic_error == SQLITE_CORRUPT;
}
+// static
+void Connection::set_mmap_disabled_by_default() {
+ g_mmap_disabled_default = true;
+}
+
+
void Connection::ReportDiagnosticInfo(int extended_error, Statement* stmt) {
AssertIOAllowed();
@@ -339,7 +347,7 @@ Connection::Connection()
needs_rollback_(false),
in_memory_(false),
poisoned_(false),
- mmap_disabled_(false),
+ mmap_disabled_(g_mmap_disabled_default),
mmap_enabled_(false),
total_changes_at_last_release_(0),
stats_histogram_(NULL),
diff --git a/sql/connection.h b/sql/connection.h
index b35e2fa..4606a1f 100644
--- a/sql/connection.h
+++ b/sql/connection.h
@@ -149,9 +149,12 @@ 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.
+ // Call to opt out of memory-mapped file I/O on per connection basis.
void set_mmap_disabled() { mmap_disabled_ = true; }
+ // Call to opt out of memory-mapped file I/O on all connections.
+ static void set_mmap_disabled_by_default();
+
// Set an error-handling callback. On errors, the error number (and
// statement, if available) will be passed to the callback.
//