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

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 msg8. 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') | no next file with comments »
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 }; 73 };
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.
84 // The same enum must be used by the platform-dependent components.
85 // TODO(bnc): implement as per crbug.com/334602.
86 enum NetworkPredictionOptions {
87 NETWORK_PREDICTION_ALWAYS,
88 NETWORK_PREDICTION_WIFI_ONLY,
89 NETWORK_PREDICTION_NEVER
90 };
91
83 // A version number for prefs that are saved. This should be incremented when 92 // A version number for prefs that are saved. This should be incremented when
84 // we change the format so that we discard old data. 93 // we change the format so that we discard old data.
85 static const int kPredictorReferrerVersion; 94 static const int kPredictorReferrerVersion;
86 95
87 // Given that the underlying Chromium resolver defaults to a total maximum of 96 // Given that the underlying Chromium resolver defaults to a total maximum of
88 // 8 paralell resolutions, we will avoid any chance of starving navigational 97 // 8 paralell resolutions, we will avoid any chance of starving navigational
89 // resolutions by limiting the number of paralell speculative resolutions. 98 // resolutions by limiting the number of paralell speculative resolutions.
90 // This is used in the field trials and testing. 99 // This is used in the field trials and testing.
91 // TODO(jar): Move this limitation into the resolver. 100 // TODO(jar): Move this limitation into the resolver.
92 static const size_t kMaxSpeculativeParallelResolves; 101 static const size_t kMaxSpeculativeParallelResolves;
(...skipping 512 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698