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

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

Issue 11551003: Change multi-prerender API to include per launcher slots. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clear to land Created 7 years, 12 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // have in the control group. If that dummy prerender in the prerender group 92 // have in the control group. If that dummy prerender in the prerender group
93 // would then be swapped in (but isn't actually b/c it's a dummy), we record 93 // would then be swapped in (but isn't actually b/c it's a dummy), we record
94 // this as a MatchComplete. This allows us to compare MatchComplete's 94 // this as a MatchComplete. This allows us to compare MatchComplete's
95 // across Prerender & Control group which ideally should be lining up. 95 // across Prerender & Control group which ideally should be lining up.
96 // This ensures that there is no bias in terms of the page load times 96 // This ensures that there is no bias in terms of the page load times
97 // of the pages forming the difference between the two sets. 97 // of the pages forming the difference between the two sets.
98 98
99 bool NeedMatchCompleteDummyForFinalStatus(FinalStatus final_status) { 99 bool NeedMatchCompleteDummyForFinalStatus(FinalStatus final_status) {
100 return final_status != FINAL_STATUS_USED && 100 return final_status != FINAL_STATUS_USED &&
101 final_status != FINAL_STATUS_TIMED_OUT && 101 final_status != FINAL_STATUS_TIMED_OUT &&
102 final_status != FINAL_STATUS_EVICTED &&
103 final_status != FINAL_STATUS_MANAGER_SHUTDOWN && 102 final_status != FINAL_STATUS_MANAGER_SHUTDOWN &&
104 final_status != FINAL_STATUS_APP_TERMINATING && 103 final_status != FINAL_STATUS_APP_TERMINATING &&
105 final_status != FINAL_STATUS_WINDOW_OPENER && 104 final_status != FINAL_STATUS_WINDOW_OPENER &&
106 final_status != FINAL_STATUS_CACHE_OR_HISTORY_CLEARED && 105 final_status != FINAL_STATUS_CACHE_OR_HISTORY_CLEARED &&
107 final_status != FINAL_STATUS_CANCELLED && 106 final_status != FINAL_STATUS_CANCELLED &&
108 final_status != FINAL_STATUS_DEVTOOLS_ATTACHED && 107 final_status != FINAL_STATUS_DEVTOOLS_ATTACHED &&
109 final_status != FINAL_STATUS_CROSS_SITE_NAVIGATION_PENDING; 108 final_status != FINAL_STATUS_CROSS_SITE_NAVIGATION_PENDING;
110 } 109 }
111 110
112 } // namespace 111 } // namespace
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // Any other checks simply make sure that the PrerenderManager is accessed on 201 // Any other checks simply make sure that the PrerenderManager is accessed on
203 // the same thread that it was created on. 202 // the same thread that it was created on.
204 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 203 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
205 204
206 if (IsLocalPredictorEnabled()) 205 if (IsLocalPredictorEnabled())
207 local_predictor_.reset(new PrerenderLocalPredictor(this)); 206 local_predictor_.reset(new PrerenderLocalPredictor(this));
208 207
209 // Certain experiments override our default config_ values. 208 // Certain experiments override our default config_ values.
210 switch (PrerenderManager::GetMode()) { 209 switch (PrerenderManager::GetMode()) {
211 case PrerenderManager::PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP: 210 case PrerenderManager::PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP:
212 config_.max_concurrency = 3; 211 config_.max_link_concurrency = 4;
212 config_.max_link_concurrency_per_launcher = 2;
213 break; 213 break;
214 case PrerenderManager::PRERENDER_MODE_EXPERIMENT_15MIN_TTL_GROUP: 214 case PrerenderManager::PRERENDER_MODE_EXPERIMENT_15MIN_TTL_GROUP:
215 config_.time_to_live = base::TimeDelta::FromMinutes(15); 215 config_.time_to_live = base::TimeDelta::FromMinutes(15);
216 break; 216 break;
217 default: 217 default:
218 break; 218 break;
219 } 219 }
220 } 220 }
221 221
222 PrerenderManager::~PrerenderManager() { 222 PrerenderManager::~PrerenderManager() {
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1039
1040 gfx::Size contents_size = 1040 gfx::Size contents_size =
1041 size.IsEmpty() ? config_.default_tab_bounds.size() : size; 1041 size.IsEmpty() ? config_.default_tab_bounds.size() : size;
1042 1042
1043 prerender_contents->StartPrerendering(process_id, contents_size, 1043 prerender_contents->StartPrerendering(process_id, contents_size,
1044 session_storage_namespace); 1044 session_storage_namespace);
1045 1045
1046 DCHECK(IsControlGroup(experiment) || 1046 DCHECK(IsControlGroup(experiment) ||
1047 prerender_contents->prerendering_has_started()); 1047 prerender_contents->prerendering_has_started());
1048 1048
1049 while (active_prerenders_.size() > config_.max_concurrency) { 1049 if (GetMode() == PRERENDER_MODE_EXPERIMENT_MULTI_PRERENDER_GROUP)
1050 prerender_contents = active_prerenders_.front()->contents(); 1050 histograms_->RecordConcurrency(active_prerenders_.size());
1051 DCHECK(prerender_contents);
1052 prerender_contents->Destroy(FINAL_STATUS_EVICTED);
1053 }
1054
1055 histograms_->RecordConcurrency(active_prerenders_.size(),
1056 config_.max_concurrency);
1057 1051
1058 StartSchedulingPeriodicCleanups(); 1052 StartSchedulingPeriodicCleanups();
1059 return prerender_handle; 1053 return prerender_handle;
1060 } 1054 }
1061 1055
1062 void PrerenderManager::StartSchedulingPeriodicCleanups() { 1056 void PrerenderManager::StartSchedulingPeriodicCleanups() {
1063 DCHECK(CalledOnValidThread()); 1057 DCHECK(CalledOnValidThread());
1064 if (repeating_timer_.IsRunning()) 1058 if (repeating_timer_.IsRunning())
1065 return; 1059 return;
1066 repeating_timer_.Start(FROM_HERE, 1060 repeating_timer_.Start(FROM_HERE,
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 if (!render_process_host || !render_process_host->GetBrowserContext()) 1310 if (!render_process_host || !render_process_host->GetBrowserContext())
1317 return NULL; 1311 return NULL;
1318 Profile* profile = Profile::FromBrowserContext( 1312 Profile* profile = Profile::FromBrowserContext(
1319 render_process_host->GetBrowserContext()); 1313 render_process_host->GetBrowserContext());
1320 if (!profile) 1314 if (!profile)
1321 return NULL; 1315 return NULL;
1322 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); 1316 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile);
1323 } 1317 }
1324 1318
1325 } // namespace prerender 1319 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_manager.h ('k') | chrome/browser/prerender/prerender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698