| 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/history_backend.h" | 5 #include "components/history/core/browser/history_backend.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 size_t num_downloads_deleted = downloads_count_before - downloads_count_after; | 1214 size_t num_downloads_deleted = downloads_count_before - downloads_count_after; |
| 1215 UMA_HISTOGRAM_COUNTS("Download.DatabaseRemoveDownloadsCount", | 1215 UMA_HISTOGRAM_COUNTS("Download.DatabaseRemoveDownloadsCount", |
| 1216 num_downloads_deleted); | 1216 num_downloads_deleted); |
| 1217 base::TimeDelta micros = (1000 * (finished_removing - started_removing)); | 1217 base::TimeDelta micros = (1000 * (finished_removing - started_removing)); |
| 1218 UMA_HISTOGRAM_TIMES("Download.DatabaseRemoveDownloadsTime", micros); | 1218 UMA_HISTOGRAM_TIMES("Download.DatabaseRemoveDownloadsTime", micros); |
| 1219 if (num_downloads_deleted > 0) { | 1219 if (num_downloads_deleted > 0) { |
| 1220 UMA_HISTOGRAM_TIMES("Download.DatabaseRemoveDownloadsTimePerRecord", | 1220 UMA_HISTOGRAM_TIMES("Download.DatabaseRemoveDownloadsTimePerRecord", |
| 1221 (1000 * micros) / num_downloads_deleted); | 1221 (1000 * micros) / num_downloads_deleted); |
| 1222 } | 1222 } |
| 1223 DCHECK_GE(ids.size(), num_downloads_deleted); | 1223 DCHECK_GE(ids.size(), num_downloads_deleted); |
| 1224 if (ids.size() < num_downloads_deleted) | |
| 1225 return; | |
| 1226 UMA_HISTOGRAM_COUNTS("Download.DatabaseRemoveDownloadsCountNotRemoved", | |
| 1227 ids.size() - num_downloads_deleted); | |
| 1228 } | 1224 } |
| 1229 | 1225 |
| 1230 void HistoryBackend::QueryHistory(const base::string16& text_query, | 1226 void HistoryBackend::QueryHistory(const base::string16& text_query, |
| 1231 const QueryOptions& options, | 1227 const QueryOptions& options, |
| 1232 QueryResults* query_results) { | 1228 QueryResults* query_results) { |
| 1233 DCHECK(query_results); | 1229 DCHECK(query_results); |
| 1234 base::TimeTicks beginning_time = base::TimeTicks::Now(); | 1230 base::TimeTicks beginning_time = base::TimeTicks::Now(); |
| 1235 if (db_) { | 1231 if (db_) { |
| 1236 if (text_query.empty()) { | 1232 if (text_query.empty()) { |
| 1237 // Basic history query for the main database. | 1233 // Basic history query for the main database. |
| (...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2646 // transaction is currently open. | 2642 // transaction is currently open. |
| 2647 db_->CommitTransaction(); | 2643 db_->CommitTransaction(); |
| 2648 db_->Vacuum(); | 2644 db_->Vacuum(); |
| 2649 db_->BeginTransaction(); | 2645 db_->BeginTransaction(); |
| 2650 db_->GetStartDate(&first_recorded_time_); | 2646 db_->GetStartDate(&first_recorded_time_); |
| 2651 | 2647 |
| 2652 return true; | 2648 return true; |
| 2653 } | 2649 } |
| 2654 | 2650 |
| 2655 } // namespace history | 2651 } // namespace history |
| OLD | NEW |