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

Side by Side Diff: chrome/browser/prerender/prerender_manager.cc

Issue 8602005: Adding histograms for better Omnibox prerender performance tracking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/autocomplete/network_action_predictor.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/prerender/prerender_manager.h" 5 #include "chrome/browser/prerender/prerender_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 break; 350 break;
351 351
352 case OMNIBOX_HEURISTIC_EXACT_FULL: 352 case OMNIBOX_HEURISTIC_EXACT_FULL:
353 origin = ORIGIN_OMNIBOX_EXACT_FULL; 353 origin = ORIGIN_OMNIBOX_EXACT_FULL;
354 break; 354 break;
355 355
356 default: 356 default:
357 NOTREACHED(); 357 NOTREACHED();
358 break; 358 break;
359 }; 359 };
360 UMA_HISTOGRAM_COUNTS("Prerender.OmniboxPrerenderCount_" +
361 prerender::GetOmniboxHistogramSuffix(), 1);
360 362
361 return AddPrerender(origin, std::make_pair(-1, -1), url, GURL(), 363 return AddPrerender(origin, std::make_pair(-1, -1), url, GURL(),
362 session_storage_namespace); 364 session_storage_namespace);
363 } 365 }
364 366
365 bool PrerenderManager::AddPrerender( 367 bool PrerenderManager::AddPrerender(
366 Origin origin, 368 Origin origin,
367 const std::pair<int, int>& child_route_id_pair, 369 const std::pair<int, int>& child_route_id_pair,
368 const GURL& url_arg, 370 const GURL& url_arg,
369 const GURL& referrer, 371 const GURL& referrer,
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 641
640 if (!prerender_contents->load_start_time().is_null()) { 642 if (!prerender_contents->load_start_time().is_null()) {
641 histograms_->RecordTimeUntilUsed(GetCurrentTimeTicks() - 643 histograms_->RecordTimeUntilUsed(GetCurrentTimeTicks() -
642 prerender_contents->load_start_time(), 644 prerender_contents->load_start_time(),
643 config_.max_age); 645 config_.max_age);
644 } 646 }
645 647
646 histograms_->RecordPerSessionCount(++prerenders_per_session_count_); 648 histograms_->RecordPerSessionCount(++prerenders_per_session_count_);
647 prerender_contents->set_final_status(FINAL_STATUS_USED); 649 prerender_contents->set_final_status(FINAL_STATUS_USED);
648 650
651 if (prerender_contents->origin() == ORIGIN_OMNIBOX_ORIGINAL ||
652 prerender_contents->origin() == ORIGIN_OMNIBOX_CONSERVATIVE ||
653 prerender_contents->origin() == ORIGIN_OMNIBOX_EXACT) {
654 UMA_HISTOGRAM_COUNTS("Prerender.OmniboxNavigationsUsedPrerenderCount_" +
tburkard 2011/11/21 23:45:39 Wouldn't this fit nicer into prerender_histograms
655 prerender::GetOmniboxHistogramSuffix(), 1);
656 }
657
649 new_render_view_host->Send( 658 new_render_view_host->Send(
650 new ChromeViewMsg_SetIsPrerendering(new_render_view_host->routing_id(), 659 new ChromeViewMsg_SetIsPrerendering(new_render_view_host->routing_id(),
651 false)); 660 false));
652 661
653 TabContentsWrapper* new_tab_contents = 662 TabContentsWrapper* new_tab_contents =
654 prerender_contents->ReleasePrerenderContents(); 663 prerender_contents->ReleasePrerenderContents();
655 TabContentsWrapper* old_tab_contents = 664 TabContentsWrapper* old_tab_contents =
656 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); 665 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
657 DCHECK(new_tab_contents); 666 DCHECK(new_tab_contents);
658 DCHECK(old_tab_contents); 667 DCHECK(old_tab_contents);
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 if (!render_process_host || !render_process_host->GetBrowserContext()) 1159 if (!render_process_host || !render_process_host->GetBrowserContext())
1151 return NULL; 1160 return NULL;
1152 Profile* profile = Profile::FromBrowserContext( 1161 Profile* profile = Profile::FromBrowserContext(
1153 render_process_host->GetBrowserContext()); 1162 render_process_host->GetBrowserContext());
1154 if (!profile) 1163 if (!profile)
1155 return NULL; 1164 return NULL;
1156 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); 1165 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile);
1157 } 1166 }
1158 1167
1159 } // namespace prerender 1168 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/network_action_predictor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698