OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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_ |
OLD | NEW |