| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This class helps to remember what domains may be needed to be resolved when a | 5 // This class helps to remember what domains may be needed to be resolved when a |
| 6 // navigation takes place to a given URL. This information is gathered when a | 6 // navigation takes place to a given URL. This information is gathered when a |
| 7 // navigation resolution was not foreseen by identifying the referrer field that | 7 // navigation resolution was not foreseen by identifying the referrer field that |
| 8 // induced the navigation. When future navigations take place to known referrer | 8 // induced the navigation. When future navigations take place to known referrer |
| 9 // sites, then we automatically pre-resolve the expected set of useful domains. | 9 // sites, then we automatically pre-resolve the expected set of useful domains. |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Value is expressed as positive latency of amount delta. | 65 // Value is expressed as positive latency of amount delta. |
| 66 void AccrueValue(const base::TimeDelta& delta, const std::string host); | 66 void AccrueValue(const base::TimeDelta& delta, const std::string host); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // Helper function for pruning list. Metric for usefulness is "large accrued | 69 // Helper function for pruning list. Metric for usefulness is "large accrued |
| 70 // value," in the form of latency_ savings associated with a host name. We | 70 // value," in the form of latency_ savings associated with a host name. We |
| 71 // also give credit for a name being newly added, by scalling latency per | 71 // also give credit for a name being newly added, by scalling latency per |
| 72 // lifetime (time since birth). For instance, when to names have accrued | 72 // lifetime (time since birth). For instance, when to names have accrued |
| 73 // the same latency_ savings, the older one is less valuable as it didn't | 73 // the same latency_ savings, the older one is less valuable as it didn't |
| 74 // accrue savings as quickly. | 74 // accrue savings as quickly. |
| 75 void Referrer::DeleteLeastUseful(); | 75 void DeleteLeastUseful(); |
| 76 | 76 |
| 77 // Limit how large our list can get, in case we start make mistakes about | |
| 78 // what hostnames are in sub-resources (example: Some advertisments have | |
| 79 // a link to the ad agency, and then provide a "surprising" redirect to | |
| 80 // the advertised entity, which appears to be a subresource on the page | |
| 81 // hosting the ad). | |
| 82 static const int kMaxSuggestions = 8; | |
| 83 | 77 |
| 84 // We put these into a std::map<>, so we need copy constructors. | 78 // We put these into a std::map<>, so we need copy constructors. |
| 85 // DISALLOW_COPY_AND_ASSIGN(Referrer); | 79 // DISALLOW_COPY_AND_ASSIGN(Referrer); |
| 86 // TODO(jar): Consider optimization to use pointers to these instances, and | 80 // TODO(jar): Consider optimization to use pointers to these instances, and |
| 87 // avoid deep copies during re-alloc of the containing map. | 81 // avoid deep copies during re-alloc of the containing map. |
| 88 }; | 82 }; |
| 89 | 83 |
| 90 } // namespace chrome_browser_net | 84 } // namespace chrome_browser_net |
| 91 | 85 |
| 92 #endif // CHROME_BROWSER_NET_REFERRER_H_ | 86 #endif // CHROME_BROWSER_NET_REFERRER_H_ |
| OLD | NEW |