Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/proxy_service_factory.h" | 5 #include "chrome/browser/net/proxy_service_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 | 115 |
| 116 // Parse the switch (it should be a positive integer formatted as decimal). | 116 // Parse the switch (it should be a positive integer formatted as decimal). |
| 117 int n; | 117 int n; |
| 118 if (base::StringToInt(s, &n) && n > 0) { | 118 if (base::StringToInt(s, &n) && n > 0) { |
| 119 num_pac_threads = static_cast<size_t>(n); | 119 num_pac_threads = static_cast<size_t>(n); |
| 120 } else { | 120 } else { |
| 121 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; | 121 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 // TODO(eroman): Remove once crbug.com/454983 is fixed. | |
| 126 tracked_objects::ScopedTracker tracking_profile2( | |
| 127 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 128 "454983 ProxyServiceFactory::CreateProxyService_2")); | |
| 129 | |
| 125 net::ProxyService* proxy_service = NULL; | 130 net::ProxyService* proxy_service = NULL; |
| 126 if (use_v8) { | 131 if (use_v8) { |
| 127 #if defined(OS_IOS) | 132 #if defined(OS_IOS) |
| 128 NOTREACHED(); | 133 NOTREACHED(); |
| 129 #else | 134 #else |
| 130 net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher; | 135 net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher; |
| 131 #if defined(OS_CHROMEOS) | 136 #if defined(OS_CHROMEOS) |
| 132 dhcp_proxy_script_fetcher = | 137 dhcp_proxy_script_fetcher = |
| 133 new chromeos::DhcpProxyScriptFetcherChromeos(context); | 138 new chromeos::DhcpProxyScriptFetcherChromeos(context); |
| 134 #else | 139 #else |
| 140 // TODO(eroman): Remove once crbug.com/454983 is fixed. | |
| 141 tracked_objects::ScopedTracker tracking_profile3( | |
| 142 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 143 "454983 ProxyServiceFactory::CreateProxyService_3")); | |
|
mmenke
2015/03/06 22:56:44
optional nit: Should this be just before the #ifd
eroman
2015/03/06 23:02:43
Done.
| |
| 144 | |
| 135 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 145 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
| 136 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); | 146 dhcp_proxy_script_fetcher = dhcp_factory.Create(context); |
| 137 #endif | 147 #endif |
| 138 | 148 |
| 149 // TODO(eroman): Remove once crbug.com/454983 is fixed. | |
| 150 tracked_objects::ScopedTracker tracking_profile3( | |
| 151 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 152 "454983 ProxyServiceFactory::CreateProxyService_3")); | |
| 153 | |
| 139 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( | 154 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( |
| 140 proxy_config_service, | 155 proxy_config_service, |
| 141 new net::ProxyScriptFetcherImpl(context), | 156 new net::ProxyScriptFetcherImpl(context), |
| 142 dhcp_proxy_script_fetcher, | 157 dhcp_proxy_script_fetcher, |
| 143 context->host_resolver(), | 158 context->host_resolver(), |
| 144 net_log, | 159 net_log, |
| 145 network_delegate); | 160 network_delegate); |
| 146 #endif // defined(OS_IOS) | 161 #endif // defined(OS_IOS) |
| 147 } else { | 162 } else { |
| 163 // TODO(eroman): Remove once crbug.com/454983 is fixed. | |
| 164 tracked_objects::ScopedTracker tracking_profile4( | |
| 165 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 166 "454983 ProxyServiceFactory::CreateProxyService_4")); | |
| 167 | |
| 148 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 168 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 149 proxy_config_service, | 169 proxy_config_service, |
| 150 num_pac_threads, | 170 num_pac_threads, |
| 151 net_log); | 171 net_log); |
| 152 } | 172 } |
| 153 | 173 |
| 154 proxy_service->set_quick_check_enabled(quick_check_enabled); | 174 proxy_service->set_quick_check_enabled(quick_check_enabled); |
| 155 | 175 |
| 156 return proxy_service; | 176 return proxy_service; |
| 157 } | 177 } |
| OLD | NEW |