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 "components/history/core/browser/top_sites_database.h" | 5 #include "components/history/core/browser/top_sites_database.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 if (original_size > 0 && base::GetFileSize(db_path, &final_size) && | 300 if (original_size > 0 && base::GetFileSize(db_path, &final_size) && |
301 final_size > 0) { | 301 final_size > 0) { |
302 UMA_HISTOGRAM_PERCENTAGE("History.TopSitesRecoveredPercentage", | 302 UMA_HISTOGRAM_PERCENTAGE("History.TopSitesRecoveredPercentage", |
303 final_size * 100 / original_size); | 303 final_size * 100 / original_size); |
304 } | 304 } |
305 | 305 |
306 // Using 10,000 because these cases mostly care about "none recovered" and | 306 // Using 10,000 because these cases mostly care about "none recovered" and |
307 // "lots recovered". More than 10,000 rows recovered probably means there's | 307 // "lots recovered". More than 10,000 rows recovered probably means there's |
308 // something wrong with the profile. | 308 // something wrong with the profile. |
309 UMA_HISTOGRAM_COUNTS_10000("History.TopSitesRecoveredRowsThumbnails", | 309 UMA_HISTOGRAM_COUNTS_10000("History.TopSitesRecoveredRowsThumbnails", |
310 thumbnails_recovered); | 310 static_cast<int>(thumbnails_recovered)); |
311 | 311 |
312 RecordRecoveryEvent(RECOVERY_EVENT_RECOVERED); | 312 RecordRecoveryEvent(RECOVERY_EVENT_RECOVERED); |
313 } | 313 } |
314 | 314 |
315 void DatabaseErrorCallback(sql::Connection* db, | 315 void DatabaseErrorCallback(sql::Connection* db, |
316 const base::FilePath& db_path, | 316 const base::FilePath& db_path, |
317 int extended_error, | 317 int extended_error, |
318 sql::Statement* stmt) { | 318 sql::Statement* stmt) { |
319 // TODO(shess): Assert that this is running on a safe thread. AFAICT, should | 319 // TODO(shess): Assert that this is running on a safe thread. AFAICT, should |
320 // be the history thread, but at this level I can't see how to reach that. | 320 // be the history thread, but at this level I can't see how to reach that. |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 db->set_error_callback(base::Bind(&DatabaseErrorCallback, db.get(), db_name)); | 723 db->set_error_callback(base::Bind(&DatabaseErrorCallback, db.get(), db_name)); |
724 db->set_page_size(4096); | 724 db->set_page_size(4096); |
725 db->set_cache_size(32); | 725 db->set_cache_size(32); |
726 | 726 |
727 if (!db->Open(db_name)) | 727 if (!db->Open(db_name)) |
728 return NULL; | 728 return NULL; |
729 return db.release(); | 729 return db.release(); |
730 } | 730 } |
731 | 731 |
732 } // namespace history | 732 } // namespace history |
OLD | NEW |