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

Unified Diff: chrome/browser/history/history_database.cc

Issue 12252002: Fix the History.WeeklyVisitCount and History.MonthlyVisitCount data collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history_database.cc
===================================================================
--- chrome/browser/history/history_database.cc (revision 181669)
+++ chrome/browser/history/history_database.cc (working copy)
@@ -62,7 +62,9 @@
sql::Statement weekly_visit_sql(db.GetUniqueStatement(
"SELECT count(*) FROM visits WHERE visit_time > ?"));
weekly_visit_sql.BindInt64(0, one_week_ago.ToInternalValue());
- int weekly_visit_count = weekly_visit_sql.ColumnInt(0);
+ int weekly_visit_count = 0;
+ if (weekly_visit_sql.Step())
+ weekly_visit_count = weekly_visit_sql.ColumnInt(0);
UMA_HISTOGRAM_COUNTS("History.WeeklyVisitCount", weekly_visit_count);
base::Time one_month_ago = base::Time::Now() - base::TimeDelta::FromDays(30);
@@ -70,8 +72,11 @@
"SELECT count(*) FROM visits WHERE visit_time > ? AND visit_time <= ?"));
monthly_visit_sql.BindInt64(0, one_month_ago.ToInternalValue());
monthly_visit_sql.BindInt64(1, one_week_ago.ToInternalValue());
+ int older_visit_count = 0;
+ if (monthly_visit_sql.Step())
+ older_visit_count = monthly_visit_sql.ColumnInt(0);
UMA_HISTOGRAM_COUNTS("History.MonthlyVisitCount",
- monthly_visit_sql.ColumnInt(0) + weekly_visit_count);
+ older_visit_count + weekly_visit_count);
UMA_HISTOGRAM_TIMES("History.DatabaseBasicMetricsTime",
base::TimeTicks::Now() - start_time);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698