| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/history/in_memory_database.h" | 5 #include "chrome/browser/history/in_memory_database.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 bool InMemoryDatabase::InitDB() { | 22 bool InMemoryDatabase::InitDB() { |
| 23 // Set the database page size to 4K for better performance. | 23 // Set the database page size to 4K for better performance. |
| 24 db_.set_page_size(4096); | 24 db_.set_page_size(4096); |
| 25 | 25 |
| 26 if (!db_.OpenInMemory()) { | 26 if (!db_.OpenInMemory()) { |
| 27 NOTREACHED() << "Cannot open databse " << GetDB().GetErrorMessage(); | 27 NOTREACHED() << "Cannot open databse " << GetDB().GetErrorMessage(); |
| 28 return false; | 28 return false; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // No reason to leave data behind in memory when rows are removed. | 31 // No reason to leave data behind in memory when rows are removed. |
| 32 db_.Execute("PRAGMA auto_vacuum=1"); | 32 ignore_result(db_.Execute("PRAGMA auto_vacuum=1")); |
| 33 | 33 |
| 34 // Ensure this is really an in-memory-only cache. | 34 // Ensure this is really an in-memory-only cache. |
| 35 db_.Execute("PRAGMA temp_store=MEMORY"); | 35 ignore_result(db_.Execute("PRAGMA temp_store=MEMORY")); |
| 36 | 36 |
| 37 // Create the URL table, but leave it empty for now. | 37 // Create the URL table, but leave it empty for now. |
| 38 if (!CreateURLTable(false)) { | 38 if (!CreateURLTable(false)) { |
| 39 NOTREACHED() << "Unable to create table"; | 39 NOTREACHED() << "Unable to create table"; |
| 40 db_.Close(); | 40 db_.Close(); |
| 41 return false; | 41 return false; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Create the keyword search terms table. | 44 // Create the keyword search terms table. |
| 45 if (!InitKeywordSearchTermsTable()) { | 45 if (!InitKeywordSearchTermsTable()) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 CreateKeywordSearchTermsIndices(); | 148 CreateKeywordSearchTermsIndices(); |
| 149 | 149 |
| 150 return true; | 150 return true; |
| 151 } | 151 } |
| 152 | 152 |
| 153 sql::Connection& InMemoryDatabase::GetDB() { | 153 sql::Connection& InMemoryDatabase::GetDB() { |
| 154 return db_; | 154 return db_; |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace history | 157 } // namespace history |
| OLD | NEW |