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/history/shortcuts_database.h" | 5 #include "chrome/browser/history/shortcuts_database.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 namespace history { | 53 namespace history { |
54 | 54 |
55 ShortcutsDatabase::ShortcutsDatabase(Profile* profile) { | 55 ShortcutsDatabase::ShortcutsDatabase(Profile* profile) { |
56 database_path_ = profile->GetPath().Append(chrome::kShortcutsDatabaseName); | 56 database_path_ = profile->GetPath().Append(chrome::kShortcutsDatabaseName); |
57 } | 57 } |
58 | 58 |
59 bool ShortcutsDatabase::Init() { | 59 bool ShortcutsDatabase::Init() { |
| 60 db_.set_histogram_tag("Shortcuts"); |
| 61 |
60 // Set the database page size to something a little larger to give us | 62 // Set the database page size to something a little larger to give us |
61 // better performance (we're typically seek rather than bandwidth limited). | 63 // better performance (we're typically seek rather than bandwidth limited). |
62 // This only has an effect before any tables have been created, otherwise | 64 // This only has an effect before any tables have been created, otherwise |
63 // this is a NOP. Must be a power of 2 and a max of 8192. | 65 // this is a NOP. Must be a power of 2 and a max of 8192. |
64 db_.set_page_size(4096); | 66 db_.set_page_size(4096); |
65 | 67 |
66 // Run the database in exclusive mode. Nobody else should be accessing the | 68 // Run the database in exclusive mode. Nobody else should be accessing the |
67 // database while we're running, and this will give somewhat improved perf. | 69 // database while we're running, and this will give somewhat improved perf. |
68 db_.set_exclusive_locking(); | 70 db_.set_exclusive_locking(); |
69 | 71 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 "last_access_time INTEGER, " | 172 "last_access_time INTEGER, " |
171 "number_of_hits INTEGER)", kShortcutsTableName).c_str())) { | 173 "number_of_hits INTEGER)", kShortcutsTableName).c_str())) { |
172 NOTREACHED(); | 174 NOTREACHED(); |
173 return false; | 175 return false; |
174 } | 176 } |
175 } | 177 } |
176 return true; | 178 return true; |
177 } | 179 } |
178 | 180 |
179 } // namespace history | 181 } // namespace history |
OLD | NEW |