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

Side by Side Diff: chrome/browser/predictors/resource_prefetch_common.cc

Issue 632033002: Add PLT measurement to Resource Prefetching for Mobile Web (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review fix Created 6 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
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetch_predictor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/predictors/resource_prefetch_common.h" 5 #include "chrome/browser/predictors/resource_prefetch_common.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "chrome/browser/net/prediction_options.h" 13 #include "chrome/browser/net/prediction_options.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/render_frame_host.h"
17 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 20
21 using base::FieldTrialList; 21 using base::FieldTrialList;
22 using std::string; 22 using std::string;
23 using std::vector; 23 using std::vector;
24 24
25 namespace predictors { 25 namespace predictors {
26 26
27 const char kSpeculativePrefetchingTrialName[] = 27 const char kSpeculativePrefetchingTrialName[] =
28 "SpeculativeResourcePrefetching"; 28 "SpeculativeResourcePrefetching";
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 NavigationID::NavigationID(const NavigationID& other) 158 NavigationID::NavigationID(const NavigationID& other)
159 : render_process_id(other.render_process_id), 159 : render_process_id(other.render_process_id),
160 render_frame_id(other.render_frame_id), 160 render_frame_id(other.render_frame_id),
161 main_frame_url(other.main_frame_url), 161 main_frame_url(other.main_frame_url),
162 creation_time(other.creation_time) { 162 creation_time(other.creation_time) {
163 } 163 }
164 164
165 NavigationID::NavigationID(content::WebContents* web_contents) 165 NavigationID::NavigationID(content::WebContents* web_contents)
166 : render_process_id(web_contents->GetRenderProcessHost()->GetID()), 166 : render_process_id(web_contents->GetRenderProcessHost()->GetID()),
167 render_frame_id(web_contents->GetRenderViewHost()->GetRoutingID()), 167 render_frame_id(web_contents->GetMainFrame()->GetRoutingID()),
168 main_frame_url(web_contents->GetURL()) { 168 main_frame_url(web_contents->GetURL()) {
169 } 169 }
170 170
171 bool NavigationID::is_valid() const { 171 bool NavigationID::is_valid() const {
172 return render_process_id != -1 && render_frame_id != -1 && 172 return render_process_id != -1 && render_frame_id != -1 &&
173 !main_frame_url.is_empty(); 173 !main_frame_url.is_empty();
174 } 174 }
175 175
176 bool NavigationID::operator<(const NavigationID& rhs) const { 176 bool NavigationID::operator<(const NavigationID& rhs) const {
177 DCHECK(is_valid() && rhs.is_valid()); 177 DCHECK(is_valid() && rhs.is_valid());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 bool ResourcePrefetchPredictorConfig::IsMoreResourcesEnabledForTest() const { 263 bool ResourcePrefetchPredictorConfig::IsMoreResourcesEnabledForTest() const {
264 return max_resources_per_entry == 100; 264 return max_resources_per_entry == 100;
265 } 265 }
266 266
267 bool ResourcePrefetchPredictorConfig::IsSmallDBEnabledForTest() const { 267 bool ResourcePrefetchPredictorConfig::IsSmallDBEnabledForTest() const {
268 return max_urls_to_track == 200 && max_hosts_to_track == 100; 268 return max_urls_to_track == 200 && max_hosts_to_track == 100;
269 } 269 }
270 270
271 } // namespace predictors 271 } // namespace predictors
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetch_predictor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698