Chromium Code Reviews| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 74 |
| 75 // Predictor is constructed during Profile construction (on the UI thread), | 75 // Predictor is constructed during Profile construction (on the UI thread), |
| 76 // but it is destroyed on the IO thread when ProfileIOData goes away. All of | 76 // but it is destroyed on the IO thread when ProfileIOData goes away. All of |
| 77 // its core state and functionality happens on the IO thread. The only UI | 77 // its core state and functionality happens on the IO thread. The only UI |
| 78 // methods are initialization / shutdown related (including preconnect | 78 // methods are initialization / shutdown related (including preconnect |
| 79 // initialization), or convenience methods that internally forward calls to | 79 // initialization), or convenience methods that internally forward calls to |
| 80 // the IO thread. | 80 // the IO thread. |
| 81 class Predictor { | 81 class Predictor { |
| 82 public: | 82 public: |
| 83 // Enum describing when to allow network predictions based on connection type. | 83 // Enum describing when to allow network predictions based on connection type. |
| 84 // The same enum must be used by the platform-dependent components. | 84 // The same enum must be used by the platform-dependent components. |
|
mmenke
2014/06/26 20:41:02
Should mention that order matters here, since they
Bence
2014/06/27 15:11:51
Done.
| |
| 85 // TODO(bnc): implement as per crbug.com/334602. | 85 // TODO(bnc): implement as per crbug.com/334602. |
| 86 // NETWORK_PREDICTION_UNSET means that the old preferences, | |
| 87 // kNetworkPredictionEnabled and kAllowPrerender, should be observed. | |
| 86 enum NetworkPredictionOptions { | 88 enum NetworkPredictionOptions { |
| 87 NETWORK_PREDICTION_ALWAYS, | 89 NETWORK_PREDICTION_ALWAYS, |
| 88 NETWORK_PREDICTION_WIFI_ONLY, | 90 NETWORK_PREDICTION_WIFI_ONLY, |
| 89 NETWORK_PREDICTION_NEVER | 91 NETWORK_PREDICTION_NEVER, |
| 92 NETWORK_PREDICTION_UNSET, | |
| 90 }; | 93 }; |
|
mmenke
2014/06/26 20:41:02
Suggest moving these into the new file, since they
Bence
2014/06/27 15:11:50
Cf. https://codereview.chromium.org/336543003#msg2
Bence
2014/06/27 18:26:45
Done.
| |
| 91 | 94 |
| 92 // A version number for prefs that are saved. This should be incremented when | 95 // A version number for prefs that are saved. This should be incremented when |
| 93 // we change the format so that we discard old data. | 96 // we change the format so that we discard old data. |
| 94 static const int kPredictorReferrerVersion; | 97 static const int kPredictorReferrerVersion; |
| 95 | 98 |
| 96 // Given that the underlying Chromium resolver defaults to a total maximum of | 99 // Given that the underlying Chromium resolver defaults to a total maximum of |
| 97 // 8 paralell resolutions, we will avoid any chance of starving navigational | 100 // 8 paralell resolutions, we will avoid any chance of starving navigational |
| 98 // resolutions by limiting the number of paralell speculative resolutions. | 101 // resolutions by limiting the number of paralell speculative resolutions. |
| 99 // This is used in the field trials and testing. | 102 // This is used in the field trials and testing. |
| 100 // TODO(jar): Move this limitation into the resolver. | 103 // TODO(jar): Move this limitation into the resolver. |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 614 PrefService* user_prefs, | 617 PrefService* user_prefs, |
| 615 PrefService* local_state, | 618 PrefService* local_state, |
| 616 IOThread* io_thread, | 619 IOThread* io_thread, |
| 617 net::URLRequestContextGetter* getter) OVERRIDE; | 620 net::URLRequestContextGetter* getter) OVERRIDE; |
| 618 virtual void ShutdownOnUIThread() OVERRIDE; | 621 virtual void ShutdownOnUIThread() OVERRIDE; |
| 619 }; | 622 }; |
| 620 | 623 |
| 621 } // namespace chrome_browser_net | 624 } // namespace chrome_browser_net |
| 622 | 625 |
| 623 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 626 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
| OLD | NEW |