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

Side by Side Diff: chrome/browser/net/predictor.h

Issue 336543003: Add AllowNetworkPrediction preference name and enum. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address msg4. Created 6 years, 6 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
« no previous file with comments | « no previous file | chrome/common/pref_names.h » ('j') | chrome/common/pref_names.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // A Predictor object is instantiated once in the browser process, and manages 5 // A Predictor object is instantiated once in the browser process, and manages
6 // both preresolution of hostnames, as well as TCP/IP preconnection to expected 6 // both preresolution of hostnames, as well as TCP/IP preconnection to expected
7 // subresources. 7 // subresources.
8 // Most hostname lists are provided by the renderer processes, and include URLs 8 // Most hostname lists are provided by the renderer processes, and include URLs
9 // that *might* be used in the near future by the browsing user. One goal of 9 // that *might* be used in the near future by the browsing user. One goal of
10 // this class is to cause the underlying DNS structure to lookup a hostname 10 // this class is to cause the underlying DNS structure to lookup a hostname
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // avoidance will kick in and all speculations in the queue will be discarded. 106 // avoidance will kick in and all speculations in the queue will be discarded.
107 static const int kMaxSpeculativeResolveQueueDelayMs; 107 static const int kMaxSpeculativeResolveQueueDelayMs;
108 108
109 // We don't bother learning to preconnect via a GET if the original URL 109 // We don't bother learning to preconnect via a GET if the original URL
110 // navigation was so long ago, that a preconnection would have been dropped 110 // navigation was so long ago, that a preconnection would have been dropped
111 // anyway. We believe most servers will drop the connection in 10 seconds, so 111 // anyway. We believe most servers will drop the connection in 10 seconds, so
112 // we currently estimate this time-till-drop at 10 seconds. 112 // we currently estimate this time-till-drop at 10 seconds.
113 // TODO(jar): We should do a persistent field trial to validate/optimize this. 113 // TODO(jar): We should do a persistent field trial to validate/optimize this.
114 static const int kMaxUnusedSocketLifetimeSecondsWithoutAGet; 114 static const int kMaxUnusedSocketLifetimeSecondsWithoutAGet;
115 115
116 // Enum describing when to allow network predictions based on connection type.
117 // The same enum must be used by the platform-dependent components.
118 // TODO(bnc): implement as per crbug.com/334602.
119 enum NetworkPredictionOptions {
120 NETWORK_PREDICTION_ALWAYS,
121 NETWORK_PREDICTION_WIFI_ONLY,
122 NETWORK_PREDICTION_NEVER
123 };
mmenke 2014/06/20 14:48:28 nit: Looks like enums go before constants, accord
Bence 2014/06/20 15:13:55 Done.
124
116 // |max_concurrent| specifies how many concurrent (parallel) prefetches will 125 // |max_concurrent| specifies how many concurrent (parallel) prefetches will
117 // be performed. Host lookups will be issued through |host_resolver|. 126 // be performed. Host lookups will be issued through |host_resolver|.
118 explicit Predictor(bool preconnect_enabled); 127 explicit Predictor(bool preconnect_enabled);
119 128
120 virtual ~Predictor(); 129 virtual ~Predictor();
121 130
122 // This function is used to create a predictor. For testing, we can create 131 // This function is used to create a predictor. For testing, we can create
123 // a version which does a simpler shutdown. 132 // a version which does a simpler shutdown.
124 static Predictor* CreatePredictor(bool preconnect_enabled, 133 static Predictor* CreatePredictor(bool preconnect_enabled,
125 bool simple_shutdown); 134 bool simple_shutdown);
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 PrefService* user_prefs, 614 PrefService* user_prefs,
606 PrefService* local_state, 615 PrefService* local_state,
607 IOThread* io_thread, 616 IOThread* io_thread,
608 net::URLRequestContextGetter* getter) OVERRIDE; 617 net::URLRequestContextGetter* getter) OVERRIDE;
609 virtual void ShutdownOnUIThread() OVERRIDE; 618 virtual void ShutdownOnUIThread() OVERRIDE;
610 }; 619 };
611 620
612 } // namespace chrome_browser_net 621 } // namespace chrome_browser_net
613 622
614 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ 623 #endif // CHROME_BROWSER_NET_PREDICTOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/common/pref_names.h » ('j') | chrome/common/pref_names.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698