Index: components/history/core/browser/visit_database.cc |
diff --git a/components/history/core/browser/visit_database.cc b/components/history/core/browser/visit_database.cc |
index 6d5819c36621ae11058b478811aaca64af2736e8..ae730d130e14fe5f33fb1eaea339bf231c51aa0a 100644 |
--- a/components/history/core/browser/visit_database.cc |
+++ b/components/history/core/browser/visit_database.cc |
@@ -536,6 +536,29 @@ bool VisitDatabase::GetVisibleVisitCountToHost(const GURL& url, |
return true; |
} |
+int VisitDatabase::GetHistoryCount() { |
msramek
2015/09/14 17:28:16
Please follow the convention that methods return b
lwchkg
2015/09/15 14:27:08
Sounds good.
|
+ sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, |
+ "SELECT COUNT(*) FROM (" |
msramek
2015/09/14 17:28:16
Why not SELECT COUNT(DISTINCT ...) FROM ...?
lwchkg
2015/09/15 14:27:08
I was using COUNT(*) where DISTINCT is not availab
lwchkg
2015/09/15 18:03:07
Sorry for wrong reply. SELECT COUNT(DISTINCT ...)
msramek
2015/09/16 11:16:30
Just to be sure we're talking about the same thing
lwchkg
2015/09/16 17:32:34
No, it doesn't work in SQLite. Error message: wron
|
+ "SELECT DISTINCT url, " |
+ // Convert unit of timestamp from the numbers of microseconds since |
+ // Windows Epoch to the number of seconds from Unix Epoch. |
msramek
2015/09/14 17:28:16
Shouldn't this be DATE(timestamp, 'unixepoch', 'lo
lwchkg
2015/09/15 14:27:08
You're right. Confirmed that my wrong version calc
msramek
2015/09/16 11:16:30
Hm, I didn't finish my thought properly. Since bot
lwchkg
2015/09/16 17:32:34
Not correct. The leap years are different before a
msramek
2015/09/17 15:14:25
Ah, of course, DST. Thanks for catching this, and
|
+ "DATE(visit_time/1000000-11644473600, 'localtime', 'unixepoch') " |
msramek
2015/09/14 17:28:16
Please use a constant, such as Time::kTimeTToMicro
lwchkg
2015/09/15 14:27:08
Time::kTimeTToMicrosecondsOffset sounds good. Anyw
msramek
2015/09/16 11:16:30
It does. I looked around and it seems to be used e
lwchkg
2015/09/16 17:32:34
Agree... looks like the comment is incorrect. Shou
msramek
2015/09/17 15:14:25
I investigated a bit more - the constant is used s
|
+ "FROM visits " |
+ "WHERE (transition & ?) != 0 " // CHAIN_END |
+ "AND (transition & ?) NOT IN (?, ?, ?)" // NO SUBFRAME or |
+ // KEYWORD_GENERATED |
+ ")")); |
+ |
+ statement.BindInt(0, ui::PAGE_TRANSITION_CHAIN_END); |
+ statement.BindInt(1, ui::PAGE_TRANSITION_CORE_MASK); |
+ statement.BindInt(2, ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
+ statement.BindInt(3, ui::PAGE_TRANSITION_MANUAL_SUBFRAME); |
+ statement.BindInt(4, ui::PAGE_TRANSITION_KEYWORD_GENERATED); |
+ |
+ statement.Step(); |
+ return statement.ColumnInt(0); |
+} |
+ |
bool VisitDatabase::GetStartDate(base::Time* first_visit) { |
sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, |
"SELECT MIN(visit_time) FROM visits WHERE visit_time != 0")); |