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/thumbnail_database.h" | 5 #include "chrome/browser/history/thumbnail_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // it should be. This error cannot be detected via the SQL error code because | 202 // it should be. This error cannot be detected via the SQL error code because |
203 // the error code for running SQL statements against a database with missing | 203 // the error code for running SQL statements against a database with missing |
204 // columns is SQLITE_ERROR which is not unique enough to act upon. | 204 // columns is SQLITE_ERROR which is not unique enough to act upon. |
205 // TODO(pkotwicz): Revisit this in M27 and see if the razing can be removed. | 205 // TODO(pkotwicz): Revisit this in M27 and see if the razing can be removed. |
206 // (crbug.com/166453) | 206 // (crbug.com/166453) |
207 if (IsFaviconDBStructureIncorrect()) { | 207 if (IsFaviconDBStructureIncorrect()) { |
208 LOG(ERROR) << "Raze thumbnail database because of invalid favicon db" | 208 LOG(ERROR) << "Raze thumbnail database because of invalid favicon db" |
209 << "structure."; | 209 << "structure."; |
210 UMA_HISTOGRAM_BOOLEAN("History.InvalidFaviconsDBStructure", true); | 210 UMA_HISTOGRAM_BOOLEAN("History.InvalidFaviconsDBStructure", true); |
211 | 211 |
212 db_.Raze(); | 212 db_.RazeAndClose(); |
213 db_.Close(); | |
214 return sql::INIT_FAILURE; | 213 return sql::INIT_FAILURE; |
215 } | 214 } |
216 | 215 |
217 return sql::INIT_OK; | 216 return sql::INIT_OK; |
218 } | 217 } |
219 | 218 |
220 sql::InitStatus ThumbnailDatabase::OpenDatabase(sql::Connection* db, | 219 sql::InitStatus ThumbnailDatabase::OpenDatabase(sql::Connection* db, |
221 const FilePath& db_name) { | 220 const FilePath& db_name) { |
222 db->set_error_histogram_name("Sqlite.Thumbnail.Error"); | 221 db->set_error_histogram_name("Sqlite.Thumbnail.Error"); |
223 | 222 |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 } | 1155 } |
1157 parsing_errors |= !base::StringToInt(t.token(), &height); | 1156 parsing_errors |= !base::StringToInt(t.token(), &height); |
1158 favicon_sizes->push_back(gfx::Size(width, height)); | 1157 favicon_sizes->push_back(gfx::Size(width, height)); |
1159 } | 1158 } |
1160 | 1159 |
1161 if (parsing_errors) | 1160 if (parsing_errors) |
1162 favicon_sizes->clear(); | 1161 favicon_sizes->clear(); |
1163 } | 1162 } |
1164 | 1163 |
1165 } // namespace history | 1164 } // namespace history |
OLD | NEW |