OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/activity_log/activity_database.h" | 5 #include "chrome/browser/extensions/activity_log/activity_database.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 did_init_ = true; | 60 did_init_ = true; |
61 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB)) | 61 if (BrowserThread::IsMessageLoopValid(BrowserThread::DB)) |
62 DCHECK_CURRENTLY_ON(BrowserThread::DB); | 62 DCHECK_CURRENTLY_ON(BrowserThread::DB); |
63 db_.set_histogram_tag("Activity"); | 63 db_.set_histogram_tag("Activity"); |
64 db_.set_error_callback( | 64 db_.set_error_callback( |
65 base::Bind(&ActivityDatabase::DatabaseErrorCallback, | 65 base::Bind(&ActivityDatabase::DatabaseErrorCallback, |
66 base::Unretained(this))); | 66 base::Unretained(this))); |
67 db_.set_page_size(4096); | 67 db_.set_page_size(4096); |
68 db_.set_cache_size(32); | 68 db_.set_cache_size(32); |
69 | 69 |
70 // TODO(shess): The current mitigation for http://crbug.com/537742 stores | 70 // This db does not use [meta] table, store mmap status data elsewhere. |
71 // state in the meta table, which this database does not use. | 71 db_.set_mmap_alt_status(); |
72 db_.set_mmap_disabled(); | |
73 | 72 |
74 if (!db_.Open(db_name)) { | 73 if (!db_.Open(db_name)) { |
75 LOG(ERROR) << db_.GetErrorMessage(); | 74 LOG(ERROR) << db_.GetErrorMessage(); |
76 return LogInitFailure(); | 75 return LogInitFailure(); |
77 } | 76 } |
78 | 77 |
79 // Wrap the initialization in a transaction so that the db doesn't | 78 // Wrap the initialization in a transaction so that the db doesn't |
80 // get corrupted if init fails/crashes. | 79 // get corrupted if init fails/crashes. |
81 sql::Transaction committer(&db_); | 80 sql::Transaction committer(&db_); |
82 if (!committer.Begin()) | 81 if (!committer.Begin()) |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 field_types[i]); | 234 field_types[i]); |
236 if (!db->Execute(table_updater.c_str())) | 235 if (!db->Execute(table_updater.c_str())) |
237 return false; | 236 return false; |
238 } | 237 } |
239 } | 238 } |
240 } | 239 } |
241 return true; | 240 return true; |
242 } | 241 } |
243 | 242 |
244 } // namespace extensions | 243 } // namespace extensions |
OLD | NEW |