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

Side by Side Diff: chrome/browser/diagnostics/sqlite_diagnostics.cc

Issue 10872032: Revert 152946 - Replace HistoryQuickProvider protobuf-based caching with an SQLite-based database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/diagnostics/sqlite_diagnostics.h ('k') | chrome/browser/history/history.h » ('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/diagnostics/sqlite_diagnostics.h" 5 #include "chrome/browser/diagnostics/sqlite_diagnostics.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // requires a static name() method. 92 // requires a static name() method.
93 template <size_t unique> 93 template <size_t unique>
94 class HistogramUniquifier { 94 class HistogramUniquifier {
95 public: 95 public:
96 static const char* name() { 96 static const char* name() {
97 const char* kHistogramNames[] = { 97 const char* kHistogramNames[] = {
98 "Sqlite.Cookie.Error", 98 "Sqlite.Cookie.Error",
99 "Sqlite.History.Error", 99 "Sqlite.History.Error",
100 "Sqlite.Thumbnail.Error", 100 "Sqlite.Thumbnail.Error",
101 "Sqlite.Text.Error", 101 "Sqlite.Text.Error",
102 "Sqlite.Web.Error", 102 "Sqlite.Web.Error"
103 "Sqlite.HQPCache.Error"
104 }; 103 };
105 return kHistogramNames[unique]; 104 return kHistogramNames[unique];
106 } 105 }
107 }; 106 };
108 107
109 } // namespace 108 } // namespace
110 109
111 sql::ErrorDelegate* GetErrorHandlerForCookieDb() { 110 sql::ErrorDelegate* GetErrorHandlerForCookieDb() {
112 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<0> >(); 111 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<0> >();
113 } 112 }
114 113
115 sql::ErrorDelegate* GetErrorHandlerForHistoryDb() { 114 sql::ErrorDelegate* GetErrorHandlerForHistoryDb() {
116 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<1> >(); 115 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<1> >();
117 } 116 }
118 117
119 sql::ErrorDelegate* GetErrorHandlerForThumbnailDb() { 118 sql::ErrorDelegate* GetErrorHandlerForThumbnailDb() {
120 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<2> >(); 119 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<2> >();
121 } 120 }
122 121
123 sql::ErrorDelegate* GetErrorHandlerForTextDb() { 122 sql::ErrorDelegate* GetErrorHandlerForTextDb() {
124 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<3> >(); 123 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<3> >();
125 } 124 }
126 125
127 sql::ErrorDelegate* GetErrorHandlerForWebDb() { 126 sql::ErrorDelegate* GetErrorHandlerForWebDb() {
128 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<4> >(); 127 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<4> >();
129 } 128 }
130 129
131 sql::ErrorDelegate* GetErrorHandlerForHQPCacheDb() {
132 return new sql::DiagnosticErrorDelegate<HistogramUniquifier<5> >();
133 }
134
135 DiagnosticTest* MakeSqliteWebDbTest() { 130 DiagnosticTest* MakeSqliteWebDbTest() {
136 return new SqliteIntegrityTest(true, ASCIIToUTF16("Web DB"), 131 return new SqliteIntegrityTest(true, ASCIIToUTF16("Web DB"),
137 FilePath(chrome::kWebDataFilename)); 132 FilePath(chrome::kWebDataFilename));
138 } 133 }
139 134
140 DiagnosticTest* MakeSqliteCookiesDbTest() { 135 DiagnosticTest* MakeSqliteCookiesDbTest() {
141 return new SqliteIntegrityTest(true, ASCIIToUTF16("Cookies DB"), 136 return new SqliteIntegrityTest(true, ASCIIToUTF16("Cookies DB"),
142 FilePath(chrome::kCookieFilename)); 137 FilePath(chrome::kCookieFilename));
143 } 138 }
144 139
145 DiagnosticTest* MakeSqliteHistoryDbTest() { 140 DiagnosticTest* MakeSqliteHistoryDbTest() {
146 return new SqliteIntegrityTest(true, ASCIIToUTF16("History DB"), 141 return new SqliteIntegrityTest(true, ASCIIToUTF16("History DB"),
147 FilePath(chrome::kHistoryFilename)); 142 FilePath(chrome::kHistoryFilename));
148 } 143 }
149 144
150 DiagnosticTest* MakeSqliteArchivedHistoryDbTest() { 145 DiagnosticTest* MakeSqliteArchivedHistoryDbTest() {
151 return new SqliteIntegrityTest(false, ASCIIToUTF16("Archived History DB"), 146 return new SqliteIntegrityTest(false, ASCIIToUTF16("Archived History DB"),
152 FilePath(chrome::kArchivedHistoryFilename)); 147 FilePath(chrome::kArchivedHistoryFilename));
153 } 148 }
154 149
155 DiagnosticTest* MakeSqliteThumbnailsDbTest() { 150 DiagnosticTest* MakeSqliteThumbnailsDbTest() {
156 return new SqliteIntegrityTest(false, ASCIIToUTF16("Thumbnails DB"), 151 return new SqliteIntegrityTest(false, ASCIIToUTF16("Thumbnails DB"),
157 FilePath(chrome::kThumbnailsFilename)); 152 FilePath(chrome::kThumbnailsFilename));
158 } 153 }
159 154
160 DiagnosticTest* MakeSqliteHQPCacheDbTest() {
161 return new SqliteIntegrityTest(false,
162 ASCIIToUTF16("History Provider Cache DB"),
163 FilePath(chrome::kHQPCacheDBFilename));
164 }
165
166 DiagnosticTest* MakeSqliteAppCacheDbTest() { 155 DiagnosticTest* MakeSqliteAppCacheDbTest() {
167 FilePath appcache_dir(content::kAppCacheDirname); 156 FilePath appcache_dir(content::kAppCacheDirname);
168 FilePath appcache_db = appcache_dir.Append(appcache::kAppCacheDatabaseName); 157 FilePath appcache_db = appcache_dir.Append(appcache::kAppCacheDatabaseName);
169 return new SqliteIntegrityTest(false, ASCIIToUTF16("AppCache DB"), 158 return new SqliteIntegrityTest(false, ASCIIToUTF16("AppCache DB"),
170 appcache_db); 159 appcache_db);
171 } 160 }
172 161
173 DiagnosticTest* MakeSqliteWebDatabaseTrackerDbTest() { 162 DiagnosticTest* MakeSqliteWebDatabaseTrackerDbTest() {
174 FilePath databases_dir(webkit_database::kDatabaseDirectoryName); 163 FilePath databases_dir(webkit_database::kDatabaseDirectoryName);
175 FilePath tracker_db = 164 FilePath tracker_db =
176 databases_dir.Append(webkit_database::kTrackerDatabaseFileName); 165 databases_dir.Append(webkit_database::kTrackerDatabaseFileName);
177 return new SqliteIntegrityTest(false, ASCIIToUTF16("DatabaseTracker DB"), 166 return new SqliteIntegrityTest(false, ASCIIToUTF16("DatabaseTracker DB"),
178 tracker_db); 167 tracker_db);
179 } 168 }
OLDNEW
« no previous file with comments | « chrome/browser/diagnostics/sqlite_diagnostics.h ('k') | chrome/browser/history/history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698