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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 typedef chrome_common_net::UrlList UrlList; | 46 typedef chrome_common_net::UrlList UrlList; |
47 typedef chrome_common_net::NameList NameList; | 47 typedef chrome_common_net::NameList NameList; |
48 typedef std::map<GURL, UrlInfo> Results; | 48 typedef std::map<GURL, UrlInfo> Results; |
49 | 49 |
50 // Note that Predictor is not thread safe, and must only be called from | 50 // Note that Predictor is not thread safe, and must only be called from |
51 // the IO thread. Failure to do so will result in a DCHECK at runtime. | 51 // the IO thread. Failure to do so will result in a DCHECK at runtime. |
52 class Predictor : public base::RefCountedThreadSafe<Predictor> { | 52 class Predictor : public base::RefCountedThreadSafe<Predictor> { |
53 public: | 53 public: |
54 // A version number for prefs that are saved. This should be incremented when | 54 // A version number for prefs that are saved. This should be incremented when |
55 // we change the format so that we discard old data. | 55 // we change the format so that we discard old data. |
56 enum { PREDICTOR_REFERRER_VERSION = 2 }; | 56 static const int kPredictorReferrerVersion; |
57 | 57 |
58 // |max_concurrent| specifies how many concurrent (parallel) prefetches will | 58 // |max_concurrent| specifies how many concurrent (parallel) prefetches will |
59 // be performed. Host lookups will be issued through |host_resolver|. | 59 // be performed. Host lookups will be issued through |host_resolver|. |
60 Predictor(net::HostResolver* host_resolver, | 60 Predictor(net::HostResolver* host_resolver, |
61 base::TimeDelta max_queue_delay_ms, size_t max_concurrent, | 61 base::TimeDelta max_queue_delay_ms, size_t max_concurrent, |
62 bool preconnect_enabled); | 62 bool preconnect_enabled); |
63 | 63 |
64 // Cancel pending requests and prevent new ones from being made. | 64 // Cancel pending requests and prevent new ones from being made. |
65 void Shutdown(); | 65 void Shutdown(); |
66 | 66 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 base::TimeTicks next_trim_time_; | 335 base::TimeTicks next_trim_time_; |
336 | 336 |
337 ScopedRunnableMethodFactory<Predictor> trim_task_factory_; | 337 ScopedRunnableMethodFactory<Predictor> trim_task_factory_; |
338 | 338 |
339 DISALLOW_COPY_AND_ASSIGN(Predictor); | 339 DISALLOW_COPY_AND_ASSIGN(Predictor); |
340 }; | 340 }; |
341 | 341 |
342 } // namespace chrome_browser_net | 342 } // namespace chrome_browser_net |
343 | 343 |
344 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 344 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
OLD | NEW |