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

Unified Diff: net/proxy/proxy_list.cc

Issue 1286373002: Refactored not to expose raw pointers on ProxyList class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: net/proxy/proxy_list.cc
diff --git a/net/proxy/proxy_list.cc b/net/proxy/proxy_list.cc
index 7d53b4cfb7ebd485eaada9d0096bfe012677bec1..1881c12eea6868a59db8d87dde7aa1af59c621a2 100644
--- a/net/proxy/proxy_list.cc
+++ b/net/proxy/proxy_list.cc
@@ -142,17 +142,16 @@ std::string ProxyList::ToPacString() const {
return proxy_list.empty() ? std::string() : proxy_list;
}
-base::ListValue* ProxyList::ToValue() const {
+scoped_ptr<base::ListValue> ProxyList::ToValue() const {
scoped_ptr<base::ListValue> list(new base::ListValue());
for (size_t i = 0; i < proxies_.size(); ++i)
list->AppendString(proxies_[i].ToURI());
- return list.release();
+ return list.Pass();
}
-bool ProxyList::Fallback(ProxyRetryInfoMap* proxy_retry_info,
+bool ProxyList::Fallback(ProxyRetryInfoMap& proxy_retry_info,
int net_error,
const BoundNetLog& net_log) {
-
// TODO(eroman): It would be good if instead of removing failed proxies
// from the list, we simply annotated them with the error code they failed
// with. Of course, ProxyService::ReconsiderProxyAfterError() would need to
@@ -180,7 +179,7 @@ bool ProxyList::Fallback(ProxyRetryInfoMap* proxy_retry_info,
return !proxies_.empty();
}
-void ProxyList::AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info,
+void ProxyList::AddProxyToRetryList(ProxyRetryInfoMap& proxy_retry_info,
base::TimeDelta retry_delay,
bool try_while_bad,
const ProxyServer& proxy_to_retry,
@@ -189,21 +188,21 @@ void ProxyList::AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info,
// Mark this proxy as bad.
TimeTicks bad_until = TimeTicks::Now() + retry_delay;
std::string proxy_key = proxy_to_retry.ToURI();
- ProxyRetryInfoMap::iterator iter = proxy_retry_info->find(proxy_key);
- if (iter == proxy_retry_info->end() || bad_until > iter->second.bad_until) {
+ ProxyRetryInfoMap::iterator iter = proxy_retry_info.find(proxy_key);
+ if (iter == proxy_retry_info.end() || bad_until > iter->second.bad_until) {
ProxyRetryInfo retry_info;
retry_info.current_delay = retry_delay;
retry_info.bad_until = bad_until;
retry_info.try_while_bad = try_while_bad;
retry_info.net_error = net_error;
- (*proxy_retry_info)[proxy_key] = retry_info;
+ proxy_retry_info[proxy_key] = retry_info;
}
net_log.AddEvent(NetLog::TYPE_PROXY_LIST_FALLBACK,
NetLog::StringCallback("bad_proxy", &proxy_key));
}
void ProxyList::UpdateRetryInfoOnFallback(
- ProxyRetryInfoMap* proxy_retry_info,
+ ProxyRetryInfoMap& proxy_retry_info,
base::TimeDelta retry_delay,
bool reconsider,
const std::vector<ProxyServer>& additional_proxies_to_bypass,

Powered by Google App Engine
This is Rietveld 408576698