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

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

Issue 6248026: Rename Real* to Double* in values.* and dependent files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More renames Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
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 #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/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void Referrer::Deserialize(const Value& value) { 117 void Referrer::Deserialize(const Value& value) {
118 if (value.GetType() != Value::TYPE_LIST) 118 if (value.GetType() != Value::TYPE_LIST)
119 return; 119 return;
120 const ListValue* subresource_list(static_cast<const ListValue*>(&value)); 120 const ListValue* subresource_list(static_cast<const ListValue*>(&value));
121 size_t index = 0; // Bounds checking is done by subresource_list->Get*(). 121 size_t index = 0; // Bounds checking is done by subresource_list->Get*().
122 while (true) { 122 while (true) {
123 std::string url_spec; 123 std::string url_spec;
124 if (!subresource_list->GetString(index++, &url_spec)) 124 if (!subresource_list->GetString(index++, &url_spec))
125 return; 125 return;
126 double rate; 126 double rate;
127 if (!subresource_list->GetReal(index++, &rate)) 127 if (!subresource_list->GetDouble(index++, &rate))
128 return; 128 return;
129 129
130 GURL url(url_spec); 130 GURL url(url_spec);
131 // TODO(jar): We could be more direct, and change birth date or similar to 131 // TODO(jar): We could be more direct, and change birth date or similar to
132 // show that this is a resurrected value we're adding in. I'm not yet sure 132 // show that this is a resurrected value we're adding in. I'm not yet sure
133 // of how best to optimize the learning and pruning (Trim) algorithm at this 133 // of how best to optimize the learning and pruning (Trim) algorithm at this
134 // level, so for now, we just suggest subresources, which leaves them all 134 // level, so for now, we just suggest subresources, which leaves them all
135 // with the same birth date (typically start of process). 135 // with the same birth date (typically start of process).
136 SuggestHost(url); 136 SuggestHost(url);
137 (*this)[url].SetSubresourceUseRate(rate); 137 (*this)[url].SetSubresourceUseRate(rate);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 void ReferrerValue::ReferrerWasObserved() { 171 void ReferrerValue::ReferrerWasObserved() {
172 subresource_use_rate_ *= kWeightingForOldExpectedValue; 172 subresource_use_rate_ *= kWeightingForOldExpectedValue;
173 // Note: the use rate is temporarilly possibly incorect, as we need to find 173 // Note: the use rate is temporarilly possibly incorect, as we need to find
174 // out if we really end up connecting. This will happen in a few hundred 174 // out if we really end up connecting. This will happen in a few hundred
175 // milliseconds (when content arrives, etc.). 175 // milliseconds (when content arrives, etc.).
176 // Value of subresource_use_rate_ should be sampled before this call. 176 // Value of subresource_use_rate_ should be sampled before this call.
177 } 177 }
178 178
179 } // namespace chrome_browser_net 179 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698