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

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

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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
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 #include "chrome/browser/net/referrer.h" 5 #include "chrome/browser/net/referrer.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 least_useful_url = it->first; 103 least_useful_url = it->first;
104 lowest_rate_seen = rate; 104 lowest_rate_seen = rate;
105 least_useful_lifetime = lifetime; 105 least_useful_lifetime = lifetime;
106 } 106 }
107 if (least_useful_url.has_host()) 107 if (least_useful_url.has_host())
108 erase(least_useful_url); 108 erase(least_useful_url);
109 } 109 }
110 110
111 void Referrer::Deserialize(const base::Value& value) { 111 void Referrer::Deserialize(const base::Value& value) {
112 if (value.GetType() != base::Value::TYPE_LIST) 112 if (value.GetType() != base::Value::Type::LIST)
113 return; 113 return;
114 const base::ListValue* subresource_list( 114 const base::ListValue* subresource_list(
115 static_cast<const base::ListValue*>(&value)); 115 static_cast<const base::ListValue*>(&value));
116 size_t index = 0; // Bounds checking is done by subresource_list->Get*(). 116 size_t index = 0; // Bounds checking is done by subresource_list->Get*().
117 while (true) { 117 while (true) {
118 std::string url_spec; 118 std::string url_spec;
119 if (!subresource_list->GetString(index++, &url_spec)) 119 if (!subresource_list->GetString(index++, &url_spec))
120 return; 120 return;
121 double rate; 121 double rate;
122 if (!subresource_list->GetDouble(index++, &rate)) 122 if (!subresource_list->GetDouble(index++, &rate))
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 void ReferrerValue::ReferrerWasObserved() { 162 void ReferrerValue::ReferrerWasObserved() {
163 subresource_use_rate_ *= kWeightingForOldConnectsExpectedValue; 163 subresource_use_rate_ *= kWeightingForOldConnectsExpectedValue;
164 // Note: the use rate is temporarilly possibly incorect, as we need to find 164 // Note: the use rate is temporarilly possibly incorect, as we need to find
165 // out if we really end up connecting. This will happen in a few hundred 165 // out if we really end up connecting. This will happen in a few hundred
166 // milliseconds (when content arrives, etc.). 166 // milliseconds (when content arrives, etc.).
167 // Value of subresource_use_rate_ should be sampled before this call. 167 // Value of subresource_use_rate_ should be sampled before this call.
168 } 168 }
169 169
170 } // namespace chrome_browser_net 170 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/disk_cache_dir_policy_handler.cc ('k') | chrome/browser/plugins/plugin_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698