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 #include "chrome/browser/net/referrer.h" | 5 #include "chrome/browser/net/referrer.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // level, so for now, we just suggest subresources, which leaves them all | 140 // level, so for now, we just suggest subresources, which leaves them all |
141 // with the same birth date (typically start of process). | 141 // with the same birth date (typically start of process). |
142 SuggestHost(url); | 142 SuggestHost(url); |
143 (*this)[url].SetSubresourceUseRate(rate); | 143 (*this)[url].SetSubresourceUseRate(rate); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 Value* Referrer::Serialize() const { | 147 Value* Referrer::Serialize() const { |
148 base::ListValue* subresource_list(new base::ListValue); | 148 base::ListValue* subresource_list(new base::ListValue); |
149 for (const_iterator it = begin(); it != end(); ++it) { | 149 for (const_iterator it = begin(); it != end(); ++it) { |
150 base::StringValue* url_spec(new base::StringValue(it->first.spec())); | 150 base::StringValue* url_spec(base::StringValue::New(it->first.spec())); |
151 base::FundamentalValue* rate(new base::FundamentalValue( | 151 base::NumberValue* rate(base::NumberValue::New( |
152 it->second.subresource_use_rate())); | 152 it->second.subresource_use_rate())); |
153 | 153 |
154 subresource_list->Append(url_spec); | 154 subresource_list->Append(url_spec); |
155 subresource_list->Append(rate); | 155 subresource_list->Append(rate); |
156 } | 156 } |
157 return subresource_list; | 157 return subresource_list; |
158 } | 158 } |
159 | 159 |
160 //------------------------------------------------------------------------------ | 160 //------------------------------------------------------------------------------ |
161 | 161 |
(...skipping 14 matching lines...) Expand all Loading... |
176 | 176 |
177 void ReferrerValue::ReferrerWasObserved() { | 177 void ReferrerValue::ReferrerWasObserved() { |
178 subresource_use_rate_ *= kWeightingForOldConnectsExpectedValue; | 178 subresource_use_rate_ *= kWeightingForOldConnectsExpectedValue; |
179 // Note: the use rate is temporarilly possibly incorect, as we need to find | 179 // Note: the use rate is temporarilly possibly incorect, as we need to find |
180 // out if we really end up connecting. This will happen in a few hundred | 180 // out if we really end up connecting. This will happen in a few hundred |
181 // milliseconds (when content arrives, etc.). | 181 // milliseconds (when content arrives, etc.). |
182 // Value of subresource_use_rate_ should be sampled before this call. | 182 // Value of subresource_use_rate_ should be sampled before this call. |
183 } | 183 } |
184 | 184 |
185 } // namespace chrome_browser_net | 185 } // namespace chrome_browser_net |
OLD | NEW |