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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/history/archived_database.h" | 9 #include "chrome/browser/history/archived_database.h" |
10 #include "sql/transaction.h" | 10 #include "sql/transaction.h" |
11 | 11 |
12 namespace history { | 12 namespace history { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 static const int kCurrentVersionNumber = 4; | 16 static const int kCurrentVersionNumber = 4; |
17 static const int kCompatibleVersionNumber = 2; | 17 static const int kCompatibleVersionNumber = 2; |
18 | 18 |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 ArchivedDatabase::ArchivedDatabase() { | 21 ArchivedDatabase::ArchivedDatabase() { |
22 } | 22 } |
23 | 23 |
24 ArchivedDatabase::~ArchivedDatabase() { | 24 ArchivedDatabase::~ArchivedDatabase() { |
25 } | 25 } |
26 | 26 |
27 bool ArchivedDatabase::Init(const FilePath& file_name) { | 27 bool ArchivedDatabase::Init(const base::FilePath& file_name) { |
28 // Set the database page size to something a little larger to give us | 28 // Set the database page size to something a little larger to give us |
29 // better performance (we're typically seek rather than bandwidth limited). | 29 // better performance (we're typically seek rather than bandwidth limited). |
30 // This only has an effect before any tables have been created, otherwise | 30 // This only has an effect before any tables have been created, otherwise |
31 // this is a NOP. Must be a power of 2 and a max of 8192. | 31 // this is a NOP. Must be a power of 2 and a max of 8192. |
32 db_.set_page_size(4096); | 32 db_.set_page_size(4096); |
33 | 33 |
34 // Don't use very much memory caching this database. We seldom use it for | 34 // Don't use very much memory caching this database. We seldom use it for |
35 // anything important. | 35 // anything important. |
36 db_.set_cache_size(64); | 36 db_.set_cache_size(64); |
37 | 37 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Put future migration cases here. | 138 // Put future migration cases here. |
139 | 139 |
140 // When the version is too old, we just try to continue anyway, there should | 140 // When the version is too old, we just try to continue anyway, there should |
141 // not be a released product that makes a database too old for us to handle. | 141 // not be a released product that makes a database too old for us to handle. |
142 LOG_IF(WARNING, cur_version < kCurrentVersionNumber) << | 142 LOG_IF(WARNING, cur_version < kCurrentVersionNumber) << |
143 "Archived database version " << cur_version << " is too old to handle."; | 143 "Archived database version " << cur_version << " is too old to handle."; |
144 | 144 |
145 return sql::INIT_OK; | 145 return sql::INIT_OK; |
146 } | 146 } |
147 } // namespace history | 147 } // namespace history |
OLD | NEW |