OLD | NEW |
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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 GURL additional_alias_url; | 148 GURL additional_alias_url; |
149 if (IsControlGroup() && | 149 if (IsControlGroup() && |
150 PrerenderManager::MaybeGetQueryStringBasedAliasURL( | 150 PrerenderManager::MaybeGetQueryStringBasedAliasURL( |
151 url, &additional_alias_url)) | 151 url, &additional_alias_url)) |
152 all_alias_urls.push_back(additional_alias_url); | 152 all_alias_urls.push_back(additional_alias_url); |
153 | 153 |
154 // Do not prerender if there are too many render processes, and we would | 154 // Do not prerender if there are too many render processes, and we would |
155 // have to use an existing one. We do not want prerendering to happen in | 155 // have to use an existing one. We do not want prerendering to happen in |
156 // a shared process, so that we can always reliably lower the CPU | 156 // a shared process, so that we can always reliably lower the CPU |
157 // priority for prerendering. | 157 // priority for prerendering. |
| 158 // In single-process mode, ShouldTryToUseExistingProcessHost() always returns |
| 159 // true, so that case needs to be explicitly checked for. |
158 // TODO(tburkard): Figure out how to cancel prerendering in the opposite | 160 // TODO(tburkard): Figure out how to cancel prerendering in the opposite |
159 // case, when a new tab is added to a process used for prerendering. | 161 // case, when a new tab is added to a process used for prerendering. |
160 if (RenderProcessHost::ShouldTryToUseExistingProcessHost()) { | 162 if (RenderProcessHost::ShouldTryToUseExistingProcessHost() && |
| 163 !RenderProcessHost::run_renderer_in_process()) { |
161 // Only record the status if we are not in the control group. | 164 // Only record the status if we are not in the control group. |
162 if (!IsControlGroup()) | 165 if (!IsControlGroup()) |
163 RecordFinalStatus(FINAL_STATUS_TOO_MANY_PROCESSES); | 166 RecordFinalStatus(FINAL_STATUS_TOO_MANY_PROCESSES); |
164 return false; | 167 return false; |
165 } | 168 } |
166 | 169 |
167 // Check if enough time has passed since the last prerender. | 170 // Check if enough time has passed since the last prerender. |
168 if (!DoesRateLimitAllowPrerender()) { | 171 if (!DoesRateLimitAllowPrerender()) { |
169 // Cancel the prerender. We could add it to the pending prerender list but | 172 // Cancel the prerender. We could add it to the pending prerender list but |
170 // this doesn't make sense as the next prerender request will be triggered | 173 // this doesn't make sense as the next prerender request will be triggered |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 | 579 |
577 bool PrerenderManager::IsTabContentsPrerendered(TabContents* tc) const { | 580 bool PrerenderManager::IsTabContentsPrerendered(TabContents* tc) const { |
578 return prerendered_tc_set_.count(tc) > 0; | 581 return prerendered_tc_set_.count(tc) > 0; |
579 } | 582 } |
580 | 583 |
581 bool PrerenderManager::WouldTabContentsBePrerendered(TabContents* tc) const { | 584 bool PrerenderManager::WouldTabContentsBePrerendered(TabContents* tc) const { |
582 return would_be_prerendered_tc_set_.count(tc) > 0; | 585 return would_be_prerendered_tc_set_.count(tc) > 0; |
583 } | 586 } |
584 | 587 |
585 } // namespace prerender | 588 } // namespace prerender |
OLD | NEW |