Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chrome/browser/history/shortcuts_database.cc

Issue 10071032: RefCounted types should not have public destructors, chrome/browser/ part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation fixes Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/shortcuts_database.h ('k') | chrome/browser/history/top_sites.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 namespace history { 52 namespace history {
53 53
54 const FilePath::CharType ShortcutsDatabase::kShortcutsDatabaseName[] = 54 const FilePath::CharType ShortcutsDatabase::kShortcutsDatabaseName[] =
55 FILE_PATH_LITERAL("Shortcuts"); 55 FILE_PATH_LITERAL("Shortcuts");
56 56
57 ShortcutsDatabase::ShortcutsDatabase(const FilePath& folder_path) 57 ShortcutsDatabase::ShortcutsDatabase(const FilePath& folder_path)
58 : database_path_(folder_path.Append(FilePath(kShortcutsDatabaseName))) { 58 : database_path_(folder_path.Append(FilePath(kShortcutsDatabaseName))) {
59 } 59 }
60 60
61 ShortcutsDatabase::~ShortcutsDatabase() {}
62
63 bool ShortcutsDatabase::Init() { 61 bool ShortcutsDatabase::Init() {
64 // 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
65 // better performance (we're typically seek rather than bandwidth limited). 63 // better performance (we're typically seek rather than bandwidth limited).
66 // 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
67 // 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.
68 db_.set_page_size(4096); 66 db_.set_page_size(4096);
69 67
70 // 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
71 // 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.
72 db_.set_exclusive_locking(); 70 db_.set_exclusive_locking();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 ShortcutsBackend::Shortcut(s.ColumnString(0), s.ColumnString16(1), 149 ShortcutsBackend::Shortcut(s.ColumnString(0), s.ColumnString16(1),
152 GURL(s.ColumnString(2)), s.ColumnString16(3), 150 GURL(s.ColumnString(2)), s.ColumnString16(3),
153 AutocompleteMatch::ClassificationsFromString(s.ColumnString(4)), 151 AutocompleteMatch::ClassificationsFromString(s.ColumnString(4)),
154 s.ColumnString16(5), 152 s.ColumnString16(5),
155 AutocompleteMatch::ClassificationsFromString(s.ColumnString(6)), 153 AutocompleteMatch::ClassificationsFromString(s.ColumnString(6)),
156 base::Time::FromInternalValue(s.ColumnInt64(7)), s.ColumnInt(8)))); 154 base::Time::FromInternalValue(s.ColumnInt64(7)), s.ColumnInt(8))));
157 } 155 }
158 return true; 156 return true;
159 } 157 }
160 158
159 ShortcutsDatabase::~ShortcutsDatabase() {}
160
161 bool ShortcutsDatabase::EnsureTable() { 161 bool ShortcutsDatabase::EnsureTable() {
162 if (!db_.DoesTableExist(kShortcutsDBName)) { 162 if (!db_.DoesTableExist(kShortcutsDBName)) {
163 if (!db_.Execute(base::StringPrintf( 163 if (!db_.Execute(base::StringPrintf(
164 "CREATE TABLE %s ( " 164 "CREATE TABLE %s ( "
165 "id VARCHAR PRIMARY KEY, " 165 "id VARCHAR PRIMARY KEY, "
166 "text VARCHAR, " 166 "text VARCHAR, "
167 "url VARCHAR, " 167 "url VARCHAR, "
168 "contents VARCHAR, " 168 "contents VARCHAR, "
169 "contents_class VARCHAR, " 169 "contents_class VARCHAR, "
170 "description VARCHAR, " 170 "description VARCHAR, "
171 "description_class VARCHAR, " 171 "description_class VARCHAR, "
172 "last_access_time INTEGER, " 172 "last_access_time INTEGER, "
173 "number_of_hits INTEGER)", kShortcutsDBName).c_str())) { 173 "number_of_hits INTEGER)", kShortcutsDBName).c_str())) {
174 NOTREACHED(); 174 NOTREACHED();
175 return false; 175 return false;
176 } 176 }
177 } 177 }
178 return true; 178 return true;
179 } 179 }
180 180
181 } // namespace history 181 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/shortcuts_database.h ('k') | chrome/browser/history/top_sites.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698