OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 15 matching lines...) Expand all Loading... |
26 #include <string> | 26 #include <string> |
27 #include <vector> | 27 #include <vector> |
28 | 28 |
29 #include "base/gtest_prod_util.h" | 29 #include "base/gtest_prod_util.h" |
30 #include "base/memory/ref_counted.h" | 30 #include "base/memory/ref_counted.h" |
31 #include "chrome/browser/net/url_info.h" | 31 #include "chrome/browser/net/url_info.h" |
32 #include "chrome/browser/net/referrer.h" | 32 #include "chrome/browser/net/referrer.h" |
33 #include "chrome/common/net/predictor_common.h" | 33 #include "chrome/common/net/predictor_common.h" |
34 #include "net/base/host_port_pair.h" | 34 #include "net/base/host_port_pair.h" |
35 | 35 |
| 36 namespace base { |
36 class ListValue; | 37 class ListValue; |
| 38 } |
37 | 39 |
38 namespace net { | 40 namespace net { |
39 class HostResolver; | 41 class HostResolver; |
40 } // namespace net | 42 } // namespace net |
41 | 43 |
42 namespace chrome_browser_net { | 44 namespace chrome_browser_net { |
43 | 45 |
44 typedef chrome_common_net::UrlList UrlList; | 46 typedef chrome_common_net::UrlList UrlList; |
45 typedef chrome_common_net::NameList NameList; | 47 typedef chrome_common_net::NameList NameList; |
46 typedef std::map<GURL, UrlInfo> Results; | 48 typedef std::map<GURL, UrlInfo> Results; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Discards any referrer for which all the suggested host names are currently | 108 // Discards any referrer for which all the suggested host names are currently |
107 // annotated with negligible expected-use. Scales down (diminishes) the | 109 // annotated with negligible expected-use. Scales down (diminishes) the |
108 // expected-use of those that remain, so that their use will go down by a | 110 // expected-use of those that remain, so that their use will go down by a |
109 // factor each time we trim (moving the referrer closer to being discarded in | 111 // factor each time we trim (moving the referrer closer to being discarded in |
110 // a future call). | 112 // a future call). |
111 // The task is performed synchronously and completes before returing. | 113 // The task is performed synchronously and completes before returing. |
112 void TrimReferrersNow(); | 114 void TrimReferrersNow(); |
113 | 115 |
114 // Construct a ListValue object that contains all the data in the referrers_ | 116 // Construct a ListValue object that contains all the data in the referrers_ |
115 // so that it can be persisted in a pref. | 117 // so that it can be persisted in a pref. |
116 void SerializeReferrers(ListValue* referral_list); | 118 void SerializeReferrers(base::ListValue* referral_list); |
117 | 119 |
118 // Process a ListValue that contains all the data from a previous reference | 120 // Process a ListValue that contains all the data from a previous reference |
119 // list, as constructed by SerializeReferrers(), and add all the identified | 121 // list, as constructed by SerializeReferrers(), and add all the identified |
120 // values into the current referrer list. | 122 // values into the current referrer list. |
121 void DeserializeReferrers(const ListValue& referral_list); | 123 void DeserializeReferrers(const base::ListValue& referral_list); |
122 | 124 |
123 void DeserializeReferrersThenDelete(ListValue* referral_list); | 125 void DeserializeReferrersThenDelete(base::ListValue* referral_list); |
124 | 126 |
125 // For unit test code only. | 127 // For unit test code only. |
126 size_t max_concurrent_dns_lookups() const { | 128 size_t max_concurrent_dns_lookups() const { |
127 return max_concurrent_dns_lookups_; | 129 return max_concurrent_dns_lookups_; |
128 } | 130 } |
129 | 131 |
130 // Flag setting to use preconnection instead of just DNS pre-fetching. | 132 // Flag setting to use preconnection instead of just DNS pre-fetching. |
131 bool preconnect_enabled() const { return preconnect_enabled_; } | 133 bool preconnect_enabled() const { return preconnect_enabled_; } |
132 | 134 |
133 // Put URL in canonical form, including a scheme, host, and port. | 135 // Put URL in canonical form, including a scheme, host, and port. |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 base::TimeTicks next_trim_time_; | 335 base::TimeTicks next_trim_time_; |
334 | 336 |
335 ScopedRunnableMethodFactory<Predictor> trim_task_factory_; | 337 ScopedRunnableMethodFactory<Predictor> trim_task_factory_; |
336 | 338 |
337 DISALLOW_COPY_AND_ASSIGN(Predictor); | 339 DISALLOW_COPY_AND_ASSIGN(Predictor); |
338 }; | 340 }; |
339 | 341 |
340 } // namespace chrome_browser_net | 342 } // namespace chrome_browser_net |
341 | 343 |
342 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 344 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
OLD | NEW |