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_database.h" | 5 #include "components/history/core/browser/history_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 base::Time visit_time = | 169 base::Time visit_time = |
170 base::Time::FromInternalValue(url_sql.ColumnInt64(1)); | 170 base::Time::FromInternalValue(url_sql.ColumnInt64(1)); |
171 ++month_url_count; | 171 ++month_url_count; |
172 month_hosts.insert(url.host()); | 172 month_hosts.insert(url.host()); |
173 if (visit_time > one_week_ago) { | 173 if (visit_time > one_week_ago) { |
174 ++week_url_count; | 174 ++week_url_count; |
175 week_hosts.insert(url.host()); | 175 week_hosts.insert(url.host()); |
176 } | 176 } |
177 } | 177 } |
178 UMA_HISTOGRAM_COUNTS("History.WeeklyURLCount", week_url_count); | 178 UMA_HISTOGRAM_COUNTS("History.WeeklyURLCount", week_url_count); |
179 UMA_HISTOGRAM_COUNTS_10000("History.WeeklyHostCount", week_hosts.size()); | 179 UMA_HISTOGRAM_COUNTS_10000("History.WeeklyHostCount", |
| 180 static_cast<int>(week_hosts.size())); |
180 UMA_HISTOGRAM_COUNTS("History.MonthlyURLCount", month_url_count); | 181 UMA_HISTOGRAM_COUNTS("History.MonthlyURLCount", month_url_count); |
181 UMA_HISTOGRAM_COUNTS_10000("History.MonthlyHostCount", month_hosts.size()); | 182 UMA_HISTOGRAM_COUNTS_10000("History.MonthlyHostCount", |
| 183 static_cast<int>(month_hosts.size())); |
182 UMA_HISTOGRAM_TIMES("History.DatabaseAdvancedMetricsTime", | 184 UMA_HISTOGRAM_TIMES("History.DatabaseAdvancedMetricsTime", |
183 base::TimeTicks::Now() - start_time); | 185 base::TimeTicks::Now() - start_time); |
184 } | 186 } |
185 } | 187 } |
186 | 188 |
187 void HistoryDatabase::BeginExclusiveMode() { | 189 void HistoryDatabase::BeginExclusiveMode() { |
188 // We can't use set_exclusive_locking() since that only has an effect before | 190 // We can't use set_exclusive_locking() since that only has an effect before |
189 // the DB is opened. | 191 // the DB is opened. |
190 ignore_result(db_.Execute("PRAGMA locking_mode=EXCLUSIVE")); | 192 ignore_result(db_.Execute("PRAGMA locking_mode=EXCLUSIVE")); |
191 } | 193 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 "SET visit_time = visit_time + 11644473600000000 " | 457 "SET visit_time = visit_time + 11644473600000000 " |
456 "WHERE id IN (SELECT id FROM visits WHERE visit_time > 0);")); | 458 "WHERE id IN (SELECT id FROM visits WHERE visit_time > 0);")); |
457 ignore_result(db_.Execute( | 459 ignore_result(db_.Execute( |
458 "UPDATE segment_usage " | 460 "UPDATE segment_usage " |
459 "SET time_slot = time_slot + 11644473600000000 " | 461 "SET time_slot = time_slot + 11644473600000000 " |
460 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);")); | 462 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);")); |
461 } | 463 } |
462 #endif | 464 #endif |
463 | 465 |
464 } // namespace history | 466 } // namespace history |
OLD | NEW |