| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 UrlInfo object is used to store prediction related information about a host | 5 // A UrlInfo object is used to store prediction related information about a host |
| 6 // port and scheme triplet. When performing DNS pre-resolution of the host/port | 6 // port and scheme triplet. When performing DNS pre-resolution of the host/port |
| 7 // pair, its state is monitored as it is resolved. | 7 // pair, its state is monitored as it is resolved. |
| 8 // It includes progress, from placement in the Predictor's queue, to resolution | 8 // It includes progress, from placement in the Predictor's queue, to resolution |
| 9 // by the DNS service as either FOUND or NO_SUCH_NAME. Each instance may also | 9 // by the DNS service as either FOUND or NO_SUCH_NAME. Each instance may also |
| 10 // hold records of previous resolution times, which might later be shown to be | 10 // hold records of previous resolution times, which might later be shown to be |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // The number of OS cache entries we can guarantee(?) before cache eviction | 67 // The number of OS cache entries we can guarantee(?) before cache eviction |
| 68 // might likely take place. | 68 // might likely take place. |
| 69 static const int kMaxGuaranteedDnsCacheSize = 50; | 69 static const int kMaxGuaranteedDnsCacheSize = 50; |
| 70 | 70 |
| 71 typedef std::vector<UrlInfo> UrlInfoTable; | 71 typedef std::vector<UrlInfo> UrlInfoTable; |
| 72 | 72 |
| 73 static const base::TimeDelta kNullDuration; | 73 static const base::TimeDelta kNullDuration; |
| 74 | 74 |
| 75 // UrlInfo are usually made by the default constructor during | 75 // UrlInfo are usually made by the default constructor during |
| 76 // initializing of the Predictor's map (of info for Hostnames). | 76 // initializing of the Predictor's map (of info for Hostnames). |
| 77 UrlInfo() | 77 UrlInfo(); |
| 78 : state_(PENDING), | |
| 79 old_prequeue_state_(state_), | |
| 80 resolve_duration_(kNullDuration), | |
| 81 queue_duration_(kNullDuration), | |
| 82 sequence_number_(0), | |
| 83 motivation_(NO_PREFETCH_MOTIVATION), | |
| 84 was_linked_(false) { | |
| 85 } | |
| 86 | 78 |
| 87 ~UrlInfo() {} | 79 ~UrlInfo(); |
| 88 | 80 |
| 89 // NeedDnsUpdate decides, based on our internal info, | 81 // NeedDnsUpdate decides, based on our internal info, |
| 90 // if it would be valuable to attempt to update (prefectch) | 82 // if it would be valuable to attempt to update (prefectch) |
| 91 // DNS data for hostname. This decision is based | 83 // DNS data for hostname. This decision is based |
| 92 // on how recently we've done DNS prefetching for hostname. | 84 // on how recently we've done DNS prefetching for hostname. |
| 93 bool NeedsDnsUpdate(); | 85 bool NeedsDnsUpdate(); |
| 94 | 86 |
| 95 // FOR TEST ONLY: The following access the otherwise constant values. | 87 // FOR TEST ONLY: The following access the otherwise constant values. |
| 96 static void set_cache_expiration(base::TimeDelta time); | 88 static void set_cache_expiration(base::TimeDelta time); |
| 97 static base::TimeDelta get_cache_expiration(); | 89 static base::TimeDelta get_cache_expiration(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 GURL referring_url_; | 184 GURL referring_url_; |
| 193 | 185 |
| 194 // We put these objects into a std::map, and hence we | 186 // We put these objects into a std::map, and hence we |
| 195 // need some "evil" constructors. | 187 // need some "evil" constructors. |
| 196 // DISALLOW_COPY_AND_ASSIGN(UrlInfo); | 188 // DISALLOW_COPY_AND_ASSIGN(UrlInfo); |
| 197 }; | 189 }; |
| 198 | 190 |
| 199 } // namespace chrome_browser_net | 191 } // namespace chrome_browser_net |
| 200 | 192 |
| 201 #endif // CHROME_BROWSER_NET_URL_INFO_H_ | 193 #endif // CHROME_BROWSER_NET_URL_INFO_H_ |
| OLD | NEW |