Commit 13584c12 authored by tburkard@chromium.org's avatar tburkard@chromium.org

Add new stats to local predictor

R=shishir@chromium.org
Review URL: https://codereview.chromium.org/11412288

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170666 0039d316-1c4b-4281-b951-d872f2087c98
parent f64f95c9
...@@ -144,9 +144,20 @@ bool StrCaseStr(std::string haystack, std::string needle) { ...@@ -144,9 +144,20 @@ bool StrCaseStr(std::string haystack, std::string needle) {
return haystack.find(needle) != std::string::npos; return haystack.find(needle) != std::string::npos;
} }
bool IsExtendedRootURL(const GURL& url) {
const std::string& path = url.path();
return path == "/index.html" || path == "/home.html" ||
path == "/main.html" ||
path == "/index.htm" || path == "/home.htm" || path == "/main.htm" ||
path == "/index.php" || path == "/home.php" || path == "/main.php" ||
path == "/index.asp" || path == "/home.asp" || path == "/main.asp" ||
path == "/index.py" || path == "/home.py" || path == "/main.py" ||
path == "/index.pl" || path == "/home.pl" || path == "/main.pl";
}
bool IsRootPageURL(const GURL& url) { bool IsRootPageURL(const GURL& url) {
return (url.path() == "/" || url.path() == "") && (!url.has_query()) && return (url.path() == "/" || url.path() == "" || IsExtendedRootURL(url)) &&
(!url.has_ref()); (!url.has_query()) && (!url.has_ref());
} }
int64 URLHashToInt64(const unsigned char* data) { int64 URLHashToInt64(const unsigned char* data) {
...@@ -384,6 +395,10 @@ void PrerenderLocalPredictor::OnLookupURL(history::URLID url_id, ...@@ -384,6 +395,10 @@ void PrerenderLocalPredictor::OnLookupURL(history::URLID url_id,
} }
if (IsRootPageURL(url)) if (IsRootPageURL(url))
RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT_ROOT_PAGE); RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT_ROOT_PAGE);
if (IsExtendedRootURL(url))
RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT_EXTENDED_ROOT_PAGE);
if (IsRootPageURL(url) && url.SchemeIs("http"))
RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT_ROOT_PAGE_HTTP);
if (url.SchemeIs("http")) if (url.SchemeIs("http"))
RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT_IS_HTTP); RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT_IS_HTTP);
if (url.has_query()) if (url.has_query())
......
...@@ -52,6 +52,8 @@ class PrerenderLocalPredictor : public history::VisitDatabaseObserver { ...@@ -52,6 +52,8 @@ class PrerenderLocalPredictor : public history::VisitDatabaseObserver {
EVENT_URL_WHITELIST_OK = 23, EVENT_URL_WHITELIST_OK = 23,
EVENT_PRERENDER_URL_LOOKUP_RESULT_ON_WHITELIST = 24, EVENT_PRERENDER_URL_LOOKUP_RESULT_ON_WHITELIST = 24,
EVENT_PRERENDER_URL_LOOKUP_RESULT_ON_WHITELIST_ROOT_PAGE = 25, EVENT_PRERENDER_URL_LOOKUP_RESULT_ON_WHITELIST_ROOT_PAGE = 25,
EVENT_PRERENDER_URL_LOOKUP_RESULT_EXTENDED_ROOT_PAGE = 26,
EVENT_PRERENDER_URL_LOOKUP_RESULT_ROOT_PAGE_HTTP = 27,
EVENT_MAX_VALUE EVENT_MAX_VALUE
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment