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

Side by Side Diff: chrome/browser/net/referrer.h

Issue 2014103002: Remove deprecated ListValue::Append(Value*) overload on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ADL fail Created 4 years, 3 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 | « chrome/browser/net/predictor_unittest.cc ('k') | chrome/browser/net/referrer.cc » ('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) 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 // 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 to a subresource identifies a referring URL. 7 // navigation to a subresource identifies a referring URL.
8 // When future navigations take place to known referrer sites, then we 8 // When future navigations take place to known referrer sites, then we
9 // speculatively either pre-warm a TCP/IP conneciton, or at a minimum, resolve 9 // speculatively either pre-warm a TCP/IP conneciton, or at a minimum, resolve
10 // the host name via DNS. 10 // the host name via DNS.
11 11
12 // All access to this class is performed via the Predictor class, which only 12 // All access to this class is performed via the Predictor class, which only
13 // operates on the IO thread. 13 // operates on the IO thread.
14 14
15 #ifndef CHROME_BROWSER_NET_REFERRER_H_ 15 #ifndef CHROME_BROWSER_NET_REFERRER_H_
16 #define CHROME_BROWSER_NET_REFERRER_H_ 16 #define CHROME_BROWSER_NET_REFERRER_H_
17 17
18 #include <stdint.h>
19
18 #include <map> 20 #include <map>
19 21 #include <memory>
20 #include <stdint.h>
21 22
22 #include "base/macros.h" 23 #include "base/macros.h"
23 #include "base/time/time.h" 24 #include "base/time/time.h"
25 #include "base/values.h"
24 #include "net/base/host_port_pair.h" 26 #include "net/base/host_port_pair.h"
25 #include "url/gurl.h" 27 #include "url/gurl.h"
26 28
27 namespace base {
28 class Value;
29 }
30
31 namespace chrome_browser_net { 29 namespace chrome_browser_net {
32 30
33 //------------------------------------------------------------------------------ 31 //------------------------------------------------------------------------------
34 // For each hostname in a Referrer, we have a ReferrerValue. It indicates 32 // For each hostname in a Referrer, we have a ReferrerValue. It indicates
35 // exactly how much value (re: latency reduction, or connection use) has 33 // exactly how much value (re: latency reduction, or connection use) has
36 // resulted from having this entry. 34 // resulted from having this entry.
37 class ReferrerValue { 35 class ReferrerValue {
38 public: 36 public:
39 ReferrerValue(); 37 ReferrerValue();
40 38
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 Referrer(); 99 Referrer();
102 void IncrementUseCount() { ++use_count_; } 100 void IncrementUseCount() { ++use_count_; }
103 int64_t use_count() const { return use_count_; } 101 int64_t use_count() const { return use_count_; }
104 102
105 // Add the indicated url to the list that are resolved via DNS when the user 103 // Add the indicated url to the list that are resolved via DNS when the user
106 // navigates to this referrer. Note that if the list is long, an entry may be 104 // navigates to this referrer. Note that if the list is long, an entry may be
107 // discarded to make room for this insertion. 105 // discarded to make room for this insertion.
108 void SuggestHost(const GURL& url); 106 void SuggestHost(const GURL& url);
109 107
110 // Provide methods for persisting, and restoring contents into a Value class. 108 // Provide methods for persisting, and restoring contents into a Value class.
111 base::Value* Serialize() const; 109 std::unique_ptr<base::ListValue> Serialize() const;
112 void Deserialize(const base::Value& referrers); 110 void Deserialize(const base::Value& referrers);
113 111
114 private: 112 private:
115 // Helper function for pruning list. Metric for usefulness is "large accrued 113 // Helper function for pruning list. Metric for usefulness is "large accrued
116 // value," in the form of latency_ savings associated with a host name. We 114 // value," in the form of latency_ savings associated with a host name. We
117 // also give credit for a name being newly added, by scalling latency per 115 // also give credit for a name being newly added, by scalling latency per
118 // lifetime (time since birth). For instance, when two names have accrued 116 // lifetime (time since birth). For instance, when two names have accrued
119 // the same latency_ savings, the older one is less valuable as it didn't 117 // the same latency_ savings, the older one is less valuable as it didn't
120 // accrue savings as quickly. 118 // accrue savings as quickly.
121 void DeleteLeastUseful(); 119 void DeleteLeastUseful();
122 120
123 // The number of times this referer had its subresources scanned for possible 121 // The number of times this referer had its subresources scanned for possible
124 // preconnection or DNS preresolution. 122 // preconnection or DNS preresolution.
125 int64_t use_count_; 123 int64_t use_count_;
126 124
127 // We put these into a std::map<>, so we need copy constructors. 125 // We put these into a std::map<>, so we need copy constructors.
128 // DISALLOW_COPY_AND_ASSIGN(Referrer); 126 // DISALLOW_COPY_AND_ASSIGN(Referrer);
129 // TODO(jar): Consider optimization to use pointers to these instances, and 127 // TODO(jar): Consider optimization to use pointers to these instances, and
130 // avoid deep copies during re-alloc of the containing map. 128 // avoid deep copies during re-alloc of the containing map.
131 }; 129 };
132 130
133 } // namespace chrome_browser_net 131 } // namespace chrome_browser_net
134 132
135 #endif // CHROME_BROWSER_NET_REFERRER_H_ 133 #endif // CHROME_BROWSER_NET_REFERRER_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor_unittest.cc ('k') | chrome/browser/net/referrer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698