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

Unified Diff: chrome/browser/prerender/prerender_local_predictor.cc

Issue 14949012: Add instrumentation to see how often a local predictor prerender could be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 7 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
Index: chrome/browser/prerender/prerender_local_predictor.cc
===================================================================
--- chrome/browser/prerender/prerender_local_predictor.cc (revision 199567)
+++ chrome/browser/prerender/prerender_local_predictor.cc (working copy)
@@ -306,7 +306,8 @@
PrerenderManager* prerender_manager)
: prerender_manager_(prerender_manager),
is_visit_database_observer_(false),
- weak_factory_(this) {
+ weak_factory_(this),
+ current_prerender_would_have_matched_(false) {
RecordEvent(EVENT_CONSTRUCTED);
if (MessageLoop::current()) {
timer_.Start(FROM_HERE,
@@ -731,6 +732,7 @@
prerender_handle_.release());
prerender_handle_.reset(prerender_manager_->AddPrerenderFromLocalPredictor(
url, session_storage_namespace.get(), *size));
+ current_prerender_would_have_matched_ = false;
if (old_prerender_handle)
old_prerender_handle->OnCancel();
@@ -757,4 +759,21 @@
current_prerender_->actual_start_time = current_time;
}
+void PrerenderLocalPredictor::OnTabHelperURLSeen(
+ const GURL& url, WebContents* web_contents) {
+ RecordEvent(EVENT_TAB_HELPER_URL_SEEN);
Shishir 2013/05/14 18:19:34 This event will have a lot of duplicates since it
tburkard 2013/05/14 19:28:06 We already have other events for when a DidNavigat
+ if (current_prerender_would_have_matched_ ||
+ !prerender_handle_.get() ||
+ !prerender_handle_->Matches(url, NULL)) {
Shishir 2013/05/14 18:19:34 Can you call this with NULL if the prerender is li
tburkard 2013/05/14 19:28:06 Done.
+ return;
+ }
+ RecordEvent(EVENT_TAB_HELPER_URL_SEEN_MATCH);
+ if (prerender_handle_->Matches(
+ url,
+ web_contents->GetController().GetDefaultSessionStorageNamespace())) {
+ RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH);
+ }
+ current_prerender_would_have_matched_ = true;
Shishir 2013/05/14 18:19:34 Can you add a comment as to the conditions where t
tburkard 2013/05/14 19:28:06 Done.
+}
+
} // namespace prerender

Powered by Google App Engine
This is Rietveld 408576698