summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrdsmith <rdsmith@chromium.org>2015-09-16 12:42:03 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-16 19:42:48 +0000
commit82957ade8b7a9686c50688ab8caab3a19dcd80b1 (patch)
treeb0ff38f97b99a189b0c2d2e925787a33dc1a9224
parenta1c3501b272ca1c3f5ddc4f87c4ab397eba5af67 (diff)
downloadchromium_src-82957ade8b7a9686c50688ab8caab3a19dcd80b1.zip
chromium_src-82957ade8b7a9686c50688ab8caab3a19dcd80b1.tar.gz
chromium_src-82957ade8b7a9686c50688ab8caab3a19dcd80b1.tar.bz2
Shift URLRequestContextStorage over to taking scoped_ptrs.
Also includes converting several sources of scoped_ptrs for URLRequestContextStorage, including the ProxyService static generators and the ShellURLRequestContextGetter protected methods to be used by subclasses. BUG=521705 Review URL: https://codereview.chromium.org/1290243007 Cr-Commit-Position: refs/heads/master@{#349194}
-rw-r--r--android_webview/browser/net/aw_url_request_context_getter.cc5
-rw-r--r--chrome/browser/extensions/api/platform_keys/verify_trust_api.cc10
-rw-r--r--chrome/browser/io_thread.cc17
-rw-r--r--chrome/browser/net/predictor_unittest.cc15
-rw-r--r--chrome/browser/net/proxy_service_factory.cc4
-rw-r--r--chrome/browser/net/proxy_service_factory.h3
-rw-r--r--chrome/browser/profiles/profile_io_data.cc14
-rw-r--r--chromecast/browser/url_request_context_factory.cc10
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc4
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc5
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc3
-rw-r--r--components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc12
-rw-r--r--content/browser/renderer_host/pepper/ssl_context_helper.cc2
-rw-r--r--content/shell/browser/layout_test/layout_test_url_request_context_getter.cc9
-rw-r--r--content/shell/browser/layout_test/layout_test_url_request_context_getter.h6
-rw-r--r--content/shell/browser/shell_url_request_context_getter.cc39
-rw-r--r--content/shell/browser/shell_url_request_context_getter.h6
-rw-r--r--device/test/usb_test_gadget_impl.cc3
-rw-r--r--extensions/browser/api/cast_channel/cast_socket.cc2
-rw-r--r--extensions/shell/browser/shell_url_request_context_getter.cc6
-rw-r--r--extensions/shell/browser/shell_url_request_context_getter.h2
-rw-r--r--google_apis/gcm/tools/mcs_probe.cc6
-rw-r--r--ios/crnet/crnet_environment.mm13
-rw-r--r--ios/web/shell/shell_url_request_context_getter.cc22
-rw-r--r--mojo/services/network/network_context.cc2
-rw-r--r--net/cert/cert_verifier.cc8
-rw-r--r--net/cert/cert_verifier.h3
-rw-r--r--net/cert_net/cert_net_fetcher_impl_unittest.cc15
-rw-r--r--net/http/http_auth_handler_factory.cc8
-rw-r--r--net/http/http_auth_handler_factory.h3
-rw-r--r--net/http/http_network_layer_unittest.cc4
-rw-r--r--net/http/http_network_transaction_ssl_unittest.cc2
-rw-r--r--net/http/http_network_transaction_unittest.cc176
-rw-r--r--net/http/http_stream_factory_impl_request_unittest.cc1
-rw-r--r--net/http/http_stream_factory_impl_unittest.cc7
-rw-r--r--net/proxy/proxy_script_fetcher_impl_unittest.cc16
-rw-r--r--net/proxy/proxy_service.cc31
-rw-r--r--net/proxy/proxy_service.h15
-rw-r--r--net/proxy/proxy_service_mojo.cc9
-rw-r--r--net/proxy/proxy_service_mojo.h4
-rw-r--r--net/proxy/proxy_service_mojo_unittest.cc4
-rw-r--r--net/proxy/proxy_service_v8.cc7
-rw-r--r--net/proxy/proxy_service_v8.h2
-rw-r--r--net/quic/quic_network_transaction_unittest.cc10
-rw-r--r--net/quic/test_tools/crypto_test_utils_chromium.cc21
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc58
-rw-r--r--net/spdy/spdy_test_util_common.cc25
-rw-r--r--net/spdy/spdy_test_util_common.h3
-rw-r--r--net/tools/quic/quic_client_bin.cc2
-rw-r--r--net/tools/quic/quic_simple_client_bin.cc2
-rw-r--r--net/url_request/url_fetcher_impl_unittest.cc4
-rw-r--r--net/url_request/url_request_context_builder.cc56
-rw-r--r--net/url_request/url_request_context_storage.cc68
-rw-r--r--net/url_request/url_request_context_storage.h24
-rw-r--r--net/url_request/url_request_ftp_job_unittest.cc29
-rw-r--r--net/url_request/url_request_test_util.cc26
-rw-r--r--net/websockets/websocket_test_util.cc2
-rw-r--r--remoting/host/token_validator_factory_impl_unittest.cc7
-rw-r--r--remoting/signaling/xmpp_signal_strategy.cc2
-rw-r--r--sync/tools/sync_client.cc2
-rw-r--r--sync/tools/sync_listen_notifications.cc2
61 files changed, 453 insertions, 425 deletions
diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc
index def5f81..8a21c56 100644
--- a/android_webview/browser/net/aw_url_request_context_getter.cc
+++ b/android_webview/browser/net/aw_url_request_context_getter.cc
@@ -217,9 +217,8 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() {
// Android provides a local HTTP proxy that handles all the proxying.
// Create the proxy without a resolver since we rely on this local HTTP proxy.
// TODO(sgurun) is this behavior guaranteed through SDK?
- builder.set_proxy_service(
- make_scoped_ptr(net::ProxyService::CreateWithoutProxyResolver(
- proxy_config_service_.release(), net_log_.get())));
+ builder.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver(
+ proxy_config_service_.release(), net_log_.get()));
builder.set_net_log(net_log_.get());
builder.SetCookieAndChannelIdStores(cookie_store_, NULL);
ApplyCmdlineOverridesToURLRequestContextBuilder(&builder);
diff --git a/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc b/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc
index 7274371..dc1bd8b 100644
--- a/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc
+++ b/chrome/browser/extensions/api/platform_keys/verify_trust_api.cc
@@ -178,13 +178,11 @@ void VerifyTrustAPI::IOPart::Verify(scoped_ptr<Params> params,
return;
}
- net::CertVerifier* verifier = nullptr;
- if (ContainsKey(extension_to_verifier_, extension_id)) {
- verifier = extension_to_verifier_[extension_id].get();
- } else {
- verifier = net::CertVerifier::CreateDefault();
- extension_to_verifier_[extension_id] = make_linked_ptr(verifier);
+ if (!ContainsKey(extension_to_verifier_, extension_id)) {
+ extension_to_verifier_[extension_id] =
+ make_linked_ptr(net::CertVerifier::CreateDefault().release());
}
+ net::CertVerifier* verifier = extension_to_verifier_[extension_id].get();
scoped_ptr<net::CertVerifyResult> verify_result(new net::CertVerifyResult);
scoped_ptr<net::BoundNetLog> net_log(new net::BoundNetLog);
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 4f6d572..6cccca7 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -681,8 +681,8 @@ void IOThread::Init() {
globals_->host_resolver.get()));
globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
// For the ProxyScriptFetcher, we use a direct ProxyService.
- globals_->proxy_script_fetcher_proxy_service.reset(
- net::ProxyService::CreateDirectWithNetLog(net_log_));
+ globals_->proxy_script_fetcher_proxy_service =
+ net::ProxyService::CreateDirectWithNetLog(net_log_);
// In-memory cookie store.
// TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
// is fixed.
@@ -1090,14 +1090,11 @@ void IOThread::InitSystemRequestContextOnIOThread() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
- globals_->system_proxy_service.reset(
- ProxyServiceFactory::CreateProxyService(
- net_log_,
- globals_->proxy_script_fetcher_context.get(),
- globals_->system_network_delegate.get(),
- system_proxy_config_service_.release(),
- command_line,
- quick_check_enabled_.GetValue()));
+ globals_->system_proxy_service = ProxyServiceFactory::CreateProxyService(
+ net_log_, globals_->proxy_script_fetcher_context.get(),
+ globals_->system_network_delegate.get(),
+ system_proxy_config_service_.release(), command_line,
+ quick_check_enabled_.GetValue());
globals_->system_request_context.reset(
ConstructSystemRequestContext(globals_, net_log_));
diff --git a/chrome/browser/net/predictor_unittest.cc b/chrome/browser/net/predictor_unittest.cc
index 61460ae..8a2d9d0 100644
--- a/chrome/browser/net/predictor_unittest.cc
+++ b/chrome/browser/net/predictor_unittest.cc
@@ -791,7 +791,9 @@ TEST_F(PredictorTest, ProxyDefinitelyEnabled) {
net::ProxyConfig config;
config.proxy_rules().ParseFromString("http=socks://localhost:12345");
- testing_master.proxy_service_ = net::ProxyService::CreateFixed(config);
+ scoped_ptr<net::ProxyService> proxy_service(
+ net::ProxyService::CreateFixed(config));
+ testing_master.proxy_service_ = proxy_service.get();
GURL goog("http://www.google.com:80");
testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED);
@@ -799,7 +801,6 @@ TEST_F(PredictorTest, ProxyDefinitelyEnabled) {
// Proxy is definitely in use, so there is no need to pre-resolve the domain.
EXPECT_TRUE(testing_master.work_queue_.IsEmpty());
- delete testing_master.proxy_service_;
testing_master.Shutdown();
}
@@ -809,7 +810,9 @@ TEST_F(PredictorTest, ProxyDefinitelyNotEnabled) {
Predictor testing_master(true, true);
net::ProxyConfig config = net::ProxyConfig::CreateDirect();
- testing_master.proxy_service_ = net::ProxyService::CreateFixed(config);
+ scoped_ptr<net::ProxyService> proxy_service(
+ net::ProxyService::CreateFixed(config));
+ testing_master.proxy_service_ = proxy_service.get();
GURL goog("http://www.google.com:80");
testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED);
@@ -817,7 +820,6 @@ TEST_F(PredictorTest, ProxyDefinitelyNotEnabled) {
// Proxy is not in use, so the name has been registered for pre-resolve.
EXPECT_FALSE(testing_master.work_queue_.IsEmpty());
- delete testing_master.proxy_service_;
testing_master.Shutdown();
}
@@ -828,7 +830,9 @@ TEST_F(PredictorTest, ProxyMaybeEnabled) {
Predictor testing_master(true, true);
net::ProxyConfig config = net::ProxyConfig::CreateFromCustomPacURL(GURL(
"http://foopy/proxy.pac"));
- testing_master.proxy_service_ = net::ProxyService::CreateFixed(config);
+ scoped_ptr<net::ProxyService> proxy_service(
+ net::ProxyService::CreateFixed(config));
+ testing_master.proxy_service_ = proxy_service.get();
GURL goog("http://www.google.com:80");
testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED);
@@ -837,7 +841,6 @@ TEST_F(PredictorTest, ProxyMaybeEnabled) {
// name has been registered for pre-resolve.
EXPECT_FALSE(testing_master.work_queue_.IsEmpty());
- delete testing_master.proxy_service_;
testing_master.Shutdown();
}
diff --git a/chrome/browser/net/proxy_service_factory.cc b/chrome/browser/net/proxy_service_factory.cc
index 01787f2..55209ab 100644
--- a/chrome/browser/net/proxy_service_factory.cc
+++ b/chrome/browser/net/proxy_service_factory.cc
@@ -114,7 +114,7 @@ ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
}
// static
-net::ProxyService* ProxyServiceFactory::CreateProxyService(
+scoped_ptr<net::ProxyService> ProxyServiceFactory::CreateProxyService(
net::NetLog* net_log,
net::URLRequestContext* context,
net::NetworkDelegate* network_delegate,
@@ -151,7 +151,7 @@ net::ProxyService* ProxyServiceFactory::CreateProxyService(
}
}
- net::ProxyService* proxy_service = NULL;
+ scoped_ptr<net::ProxyService> proxy_service;
if (use_v8) {
#if defined(OS_IOS)
NOTREACHED();
diff --git a/chrome/browser/net/proxy_service_factory.h b/chrome/browser/net/proxy_service_factory.h
index b91c2e3..2952ff2 100644
--- a/chrome/browser/net/proxy_service_factory.h
+++ b/chrome/browser/net/proxy_service_factory.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
class PrefProxyConfigTracker;
class PrefService;
@@ -44,7 +45,7 @@ class ProxyServiceFactory {
PrefService* local_state_prefs);
// Create a proxy service according to the options on command line.
- static net::ProxyService* CreateProxyService(
+ static scoped_ptr<net::ProxyService> CreateProxyService(
net::NetLog* net_log,
net::URLRequestContext* context,
net::NetworkDelegate* network_delegate,
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index 08885a3..814728e 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -1070,14 +1070,12 @@ void ProfileIOData::Init(
// NOTE: Proxy service uses the default io thread network delegate, not the
// delegate just created.
- proxy_service_.reset(
- ProxyServiceFactory::CreateProxyService(
- io_thread->net_log(),
- io_thread_globals->proxy_script_fetcher_context.get(),
- io_thread_globals->system_network_delegate.get(),
- profile_params_->proxy_config_service.release(),
- command_line,
- quick_check_enabled_.GetValue()));
+ proxy_service_ = ProxyServiceFactory::CreateProxyService(
+ io_thread->net_log(),
+ io_thread_globals->proxy_script_fetcher_context.get(),
+ io_thread_globals->system_network_delegate.get(),
+ profile_params_->proxy_config_service.release(), command_line,
+ quick_check_enabled_.GetValue());
transport_security_state_.reset(new net::TransportSecurityState());
base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
transport_security_persister_.reset(
diff --git a/chromecast/browser/url_request_context_factory.cc b/chromecast/browser/url_request_context_factory.cc
index c3b0f88..7729205 100644
--- a/chromecast/browser/url_request_context_factory.cc
+++ b/chromecast/browser/url_request_context_factory.cc
@@ -206,18 +206,18 @@ void URLRequestContextFactory::InitializeSystemContextDependencies() {
new net::ChannelIDService(new net::DefaultChannelIDStore(NULL),
base::WorkerPool::GetTaskRunner(true)));
- cert_verifier_.reset(net::CertVerifier::CreateDefault());
+ cert_verifier_ = net::CertVerifier::CreateDefault();
ssl_config_service_ = new net::SSLConfigServiceDefaults;
transport_security_state_.reset(new net::TransportSecurityState());
- http_auth_handler_factory_.reset(
- net::HttpAuthHandlerFactory::CreateDefault(host_resolver_.get()));
+ http_auth_handler_factory_ =
+ net::HttpAuthHandlerFactory::CreateDefault(host_resolver_.get());
http_server_properties_.reset(new net::HttpServerPropertiesImpl);
- proxy_service_.reset(net::ProxyService::CreateUsingSystemProxyResolver(
- proxy_config_service_.release(), 0, NULL));
+ proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver(
+ proxy_config_service_.release(), 0, NULL);
system_dependencies_initialized_ = true;
}
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
index 8ad2b9c..d13f8c4 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
@@ -92,11 +92,11 @@ class DataReductionProxyProtocolTest : public testing::Test {
}
// Sets up the |TestURLRequestContext| with the provided |ProxyService|.
- void ConfigureTestDependencies(ProxyService* proxy_service) {
+ void ConfigureTestDependencies(scoped_ptr<ProxyService> proxy_service) {
// Create a context with delayed initialization.
context_.reset(new TestURLRequestContext(true));
- proxy_service_.reset(proxy_service);
+ proxy_service_ = proxy_service.Pass();
context_->set_client_socket_factory(&mock_socket_factory_);
context_->set_proxy_service(proxy_service_.get());
network_delegate_.reset(new net::TestNetworkDelegate());
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc
index 145b267..4492a87 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor_unittest.cc
@@ -210,9 +210,8 @@ class DataReductionProxyInterceptorWithServerTest : public testing::Test {
proxies_for_http.push_back(origin);
test_context_->config()->test_params()->SetProxiesForHttp(proxies_for_http);
std::string proxy_name = origin.ToURI();
- proxy_service_.reset(
- net::ProxyService::CreateFixedFromPacResult(
- "PROXY " + proxy_name + "; DIRECT"));
+ proxy_service_ = net::ProxyService::CreateFixedFromPacResult(
+ "PROXY " + proxy_name + "; DIRECT");
context_.set_proxy_service(proxy_service_.get());
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
index ab68a52..9fb4b00 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc
@@ -70,8 +70,7 @@ net::URLRequestContext*
BasicHTTPURLRequestContextGetter::GetURLRequestContext() {
if (!url_request_context_) {
net::URLRequestContextBuilder builder;
- builder.set_proxy_service(
- make_scoped_ptr(net::ProxyService::CreateDirect()));
+ builder.set_proxy_service(net::ProxyService::CreateDirect());
builder.SetSpdyAndQuicEnabled(false, false);
url_request_context_ = builder.Build().Pass();
}
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc
index c3755ac..6cf17d3 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.cc
@@ -552,16 +552,16 @@ void DataReductionProxyTestContext::AttachToURLRequestContext(
// |request_context_storage| takes ownership of the network delegate.
request_context_storage->set_network_delegate(
- io_data()->CreateNetworkDelegate(
- scoped_ptr<net::NetworkDelegate>(new net::TestNetworkDelegate()),
- true).release());
+ io_data()
+ ->CreateNetworkDelegate(
+ make_scoped_ptr(new net::TestNetworkDelegate()).Pass(), true)
+ .Pass());
- // |request_context_storage| takes ownership of the job factory.
request_context_storage->set_job_factory(
- new net::URLRequestInterceptingJobFactory(
+ make_scoped_ptr(new net::URLRequestInterceptingJobFactory(
scoped_ptr<net::URLRequestJobFactory>(
new net::URLRequestJobFactoryImpl()),
- io_data()->CreateInterceptor().Pass()));
+ io_data()->CreateInterceptor().Pass())));
}
void DataReductionProxyTestContext::
diff --git a/content/browser/renderer_host/pepper/ssl_context_helper.cc b/content/browser/renderer_host/pepper/ssl_context_helper.cc
index a5ab3c8..aed8823 100644
--- a/content/browser/renderer_host/pepper/ssl_context_helper.cc
+++ b/content/browser/renderer_host/pepper/ssl_context_helper.cc
@@ -15,7 +15,7 @@ SSLContextHelper::~SSLContextHelper() {}
net::CertVerifier* SSLContextHelper::GetCertVerifier() {
if (!cert_verifier_)
- cert_verifier_.reset(net::CertVerifier::CreateDefault());
+ cert_verifier_ = net::CertVerifier::CreateDefault();
return cert_verifier_.get();
}
diff --git a/content/shell/browser/layout_test/layout_test_url_request_context_getter.cc b/content/shell/browser/layout_test/layout_test_url_request_context_getter.cc
index 15ddd80..7afdb58 100644
--- a/content/shell/browser/layout_test/layout_test_url_request_context_getter.cc
+++ b/content/shell/browser/layout_test/layout_test_url_request_context_getter.cc
@@ -34,18 +34,19 @@ LayoutTestURLRequestContextGetter::LayoutTestURLRequestContextGetter(
LayoutTestURLRequestContextGetter::~LayoutTestURLRequestContextGetter() {
}
-net::NetworkDelegate*
+scoped_ptr<net::NetworkDelegate>
LayoutTestURLRequestContextGetter::CreateNetworkDelegate() {
ShellNetworkDelegate::SetAcceptAllCookies(false);
- return new ShellNetworkDelegate;
+ return make_scoped_ptr(new ShellNetworkDelegate);
}
-net::ProxyConfigService*
+scoped_ptr<net::ProxyConfigService>
LayoutTestURLRequestContextGetter::GetProxyConfigService() {
return nullptr;
}
-net::ProxyService* LayoutTestURLRequestContextGetter::GetProxyService() {
+scoped_ptr<net::ProxyService>
+LayoutTestURLRequestContextGetter::GetProxyService() {
return net::ProxyService::CreateDirect();
}
diff --git a/content/shell/browser/layout_test/layout_test_url_request_context_getter.h b/content/shell/browser/layout_test/layout_test_url_request_context_getter.h
index 6ddf677..dc64b5d 100644
--- a/content/shell/browser/layout_test/layout_test_url_request_context_getter.h
+++ b/content/shell/browser/layout_test/layout_test_url_request_context_getter.h
@@ -43,9 +43,9 @@ class LayoutTestURLRequestContextGetter : public ShellURLRequestContextGetter {
~LayoutTestURLRequestContextGetter() override;
// ShellURLRequestContextGetter implementation.
- net::NetworkDelegate* CreateNetworkDelegate() override;
- net::ProxyConfigService* GetProxyConfigService() override;
- net::ProxyService* GetProxyService() override;
+ scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate() override;
+ scoped_ptr<net::ProxyConfigService> GetProxyConfigService() override;
+ scoped_ptr<net::ProxyService> GetProxyService() override;
private:
DISALLOW_COPY_AND_ASSIGN(LayoutTestURLRequestContextGetter);
diff --git a/content/shell/browser/shell_url_request_context_getter.cc b/content/shell/browser/shell_url_request_context_getter.cc
index 6554e05..01ca90e 100644
--- a/content/shell/browser/shell_url_request_context_getter.cc
+++ b/content/shell/browser/shell_url_request_context_getter.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -82,22 +83,24 @@ ShellURLRequestContextGetter::ShellURLRequestContextGetter(
// We must create the proxy config service on the UI loop on Linux because it
// must synchronously run on the glib message loop. This will be passed to
// the URLRequestContextStorage on the IO thread in GetURLRequestContext().
- proxy_config_service_.reset(GetProxyConfigService());
+ proxy_config_service_ = GetProxyConfigService();
}
ShellURLRequestContextGetter::~ShellURLRequestContextGetter() {
}
-net::NetworkDelegate* ShellURLRequestContextGetter::CreateNetworkDelegate() {
- return new ShellNetworkDelegate;
+scoped_ptr<net::NetworkDelegate>
+ShellURLRequestContextGetter::CreateNetworkDelegate() {
+ return make_scoped_ptr(new ShellNetworkDelegate).Pass();
}
-net::ProxyConfigService* ShellURLRequestContextGetter::GetProxyConfigService() {
- return net::ProxyService::CreateSystemProxyConfigService(
- io_loop_->task_runner(), file_loop_->task_runner());
+scoped_ptr<net::ProxyConfigService>
+ShellURLRequestContextGetter::GetProxyConfigService() {
+ return make_scoped_ptr(net::ProxyService::CreateSystemProxyConfigService(
+ io_loop_->task_runner(), file_loop_->task_runner()));
}
-net::ProxyService* ShellURLRequestContextGetter::GetProxyService() {
+scoped_ptr<net::ProxyService> ShellURLRequestContextGetter::GetProxyService() {
// TODO(jam): use v8 if possible, look at chrome code.
return net::ProxyService::CreateUsingSystemProxyResolver(
proxy_config_service_.release(), 0, url_request_context_->net_log());
@@ -112,7 +115,7 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
url_request_context_.reset(new net::URLRequestContext());
url_request_context_->set_net_log(net_log_);
- network_delegate_.reset(CreateNetworkDelegate());
+ network_delegate_ = CreateNetworkDelegate();
url_request_context_->set_network_delegate(network_delegate_.get());
storage_.reset(
new net::URLRequestContextStorage(url_request_context_.get()));
@@ -120,23 +123,22 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
storage_->set_channel_id_service(make_scoped_ptr(
new net::ChannelIDService(new net::DefaultChannelIDStore(NULL),
base::WorkerPool::GetTaskRunner(true))));
- storage_->set_http_user_agent_settings(
- new net::StaticHttpUserAgentSettings(
- "en-us,en", GetShellUserAgent()));
+ storage_->set_http_user_agent_settings(make_scoped_ptr(
+ new net::StaticHttpUserAgentSettings("en-us,en", GetShellUserAgent())));
scoped_ptr<net::HostResolver> host_resolver(
net::HostResolver::CreateDefaultResolver(
url_request_context_->net_log()));
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
- storage_->set_transport_security_state(new net::TransportSecurityState);
+ storage_->set_transport_security_state(
+ make_scoped_ptr(new net::TransportSecurityState));
storage_->set_proxy_service(GetProxyService());
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
storage_->set_http_auth_handler_factory(
net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get()));
storage_->set_http_server_properties(
- scoped_ptr<net::HttpServerProperties>(
- new net::HttpServerPropertiesImpl()));
+ make_scoped_ptr(new net::HttpServerPropertiesImpl()));
base::FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache"));
net::HttpCache::DefaultBackend* main_backend =
@@ -199,9 +201,10 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
network_session_params.host_resolver =
url_request_context_->host_resolver();
- net::HttpCache* main_cache = new net::HttpCache(
- network_session_params, main_backend);
- storage_->set_http_transaction_factory(main_cache);
+ storage_->set_http_transaction_factory(
+ make_scoped_ptr(
+ new net::HttpCache(network_session_params, main_backend))
+ .Pass());
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
@@ -232,7 +235,7 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
}
request_interceptors_.weak_clear();
- storage_->set_job_factory(top_job_factory.release());
+ storage_->set_job_factory(top_job_factory.Pass());
}
return url_request_context_.get();
diff --git a/content/shell/browser/shell_url_request_context_getter.h b/content/shell/browser/shell_url_request_context_getter.h
index 7a83ba0..18e4b8d 100644
--- a/content/shell/browser/shell_url_request_context_getter.h
+++ b/content/shell/browser/shell_url_request_context_getter.h
@@ -53,9 +53,9 @@ class ShellURLRequestContextGetter : public net::URLRequestContextGetter {
// Used by subclasses to create their own implementation of NetworkDelegate
// and net::ProxyService.
- virtual net::NetworkDelegate* CreateNetworkDelegate();
- virtual net::ProxyConfigService* GetProxyConfigService();
- virtual net::ProxyService* GetProxyService();
+ virtual scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate();
+ virtual scoped_ptr<net::ProxyConfigService> GetProxyConfigService();
+ virtual scoped_ptr<net::ProxyService> GetProxyService();
private:
bool ignore_certificate_errors_;
diff --git a/device/test/usb_test_gadget_impl.cc b/device/test/usb_test_gadget_impl.cc
index 0d88d57..df85756 100644
--- a/device/test/usb_test_gadget_impl.cc
+++ b/device/test/usb_test_gadget_impl.cc
@@ -145,8 +145,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
net::URLRequestContext* GetURLRequestContext() override {
if (!context_) {
net::URLRequestContextBuilder context_builder;
- context_builder.set_proxy_service(
- make_scoped_ptr(net::ProxyService::CreateDirect()));
+ context_builder.set_proxy_service(net::ProxyService::CreateDirect());
context_ = context_builder.Build().Pass();
}
return context_.get();
diff --git a/extensions/browser/api/cast_channel/cast_socket.cc b/extensions/browser/api/cast_channel/cast_socket.cc
index f3d1ac11..1ded13e 100644
--- a/extensions/browser/api/cast_channel/cast_socket.cc
+++ b/extensions/browser/api/cast_channel/cast_socket.cc
@@ -173,7 +173,7 @@ scoped_ptr<net::SSLClientSocket> CastSocketImpl::CreateSslSocket(
logger_->LogSocketEvent(channel_id_, proto::SSL_CERT_WHITELISTED);
}
- cert_verifier_.reset(net::CertVerifier::CreateDefault());
+ cert_verifier_ = net::CertVerifier::CreateDefault();
transport_security_state_.reset(new net::TransportSecurityState);
net::SSLClientSocketContext context;
// CertVerifier and TransportSecurityState are owned by us, not the
diff --git a/extensions/shell/browser/shell_url_request_context_getter.cc b/extensions/shell/browser/shell_url_request_context_getter.cc
index e151e02..4216a3e 100644
--- a/extensions/shell/browser/shell_url_request_context_getter.cc
+++ b/extensions/shell/browser/shell_url_request_context_getter.cc
@@ -4,6 +4,7 @@
#include "extensions/shell/browser/shell_url_request_context_getter.h"
+#include "base/memory/scoped_ptr.h"
#include "content/public/browser/resource_request_info.h"
#include "extensions/browser/info_map.h"
#include "extensions/shell/browser/shell_network_delegate.h"
@@ -34,9 +35,10 @@ ShellURLRequestContextGetter::ShellURLRequestContextGetter(
ShellURLRequestContextGetter::~ShellURLRequestContextGetter() {
}
-net::NetworkDelegate*
+scoped_ptr<net::NetworkDelegate>
ShellURLRequestContextGetter::CreateNetworkDelegate() {
- return new ShellNetworkDelegate(browser_context_, extension_info_map_);
+ return make_scoped_ptr(
+ new ShellNetworkDelegate(browser_context_, extension_info_map_));
}
} // namespace extensions
diff --git a/extensions/shell/browser/shell_url_request_context_getter.h b/extensions/shell/browser/shell_url_request_context_getter.h
index 8bda199..0742530 100644
--- a/extensions/shell/browser/shell_url_request_context_getter.h
+++ b/extensions/shell/browser/shell_url_request_context_getter.h
@@ -40,7 +40,7 @@ class ShellURLRequestContextGetter :
InfoMap* extension_info_map);
// content::ShellURLRequestContextGetter implementation.
- net::NetworkDelegate* CreateNetworkDelegate() override;
+ scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate() override;
protected:
~ShellURLRequestContextGetter() override;
diff --git a/google_apis/gcm/tools/mcs_probe.cc b/google_apis/gcm/tools/mcs_probe.cc
index 9d0881b..1063db9 100644
--- a/google_apis/gcm/tools/mcs_probe.cc
+++ b/google_apis/gcm/tools/mcs_probe.cc
@@ -137,7 +137,7 @@ class MyTestURLRequestContext : public net::TestURLRequestContext {
context_storage_.set_host_resolver(
net::HostResolver::CreateDefaultResolver(NULL));
context_storage_.set_transport_security_state(
- new net::TransportSecurityState());
+ make_scoped_ptr(new net::TransportSecurityState()));
Init();
}
@@ -368,7 +368,7 @@ void MCSProbe::InitializeNetworkState() {
if (command_line_.HasSwitch(kIgnoreCertSwitch)) {
cert_verifier_.reset(new MyTestCertVerifier());
} else {
- cert_verifier_.reset(net::CertVerifier::CreateDefault());
+ cert_verifier_ = net::CertVerifier::CreateDefault();
}
system_channel_id_service_.reset(
new net::ChannelIDService(
@@ -382,7 +382,7 @@ void MCSProbe::InitializeNetworkState() {
host_resolver_.get(), std::string(), std::string(), false, false));
http_server_properties_.reset(new net::HttpServerPropertiesImpl());
host_mapping_rules_.reset(new net::HostMappingRules());
- proxy_service_.reset(net::ProxyService::CreateDirectWithNetLog(&net_log_));
+ proxy_service_ = net::ProxyService::CreateDirectWithNetLog(&net_log_);
}
void MCSProbe::BuildNetworkSession() {
diff --git a/ios/crnet/crnet_environment.mm b/ios/crnet/crnet_environment.mm
index 3eb873a..c8650cb 100644
--- a/ios/crnet/crnet_environment.mm
+++ b/ios/crnet/crnet_environment.mm
@@ -394,15 +394,22 @@ void CrNetEnvironment::InitializeOnNetworkThread() {
http_server_properties_.reset(new net::HttpServerPropertiesImpl());
main_context_->set_http_server_properties(
http_server_properties_->GetWeakPtr());
+ // TODO(rdsmith): Note that the ".release()" calls below are leaking
+ // the objects in question; this should be fixed by having an object
+ // corresponding to URLRequestContextStorage that actually owns those
+ // objects. See http://crbug.com/523858.
main_context_->set_host_resolver(
net::HostResolver::CreateDefaultResolver(nullptr).release());
- main_context_->set_cert_verifier(net::CertVerifier::CreateDefault());
+ main_context_->set_cert_verifier(
+ net::CertVerifier::CreateDefault().release());
main_context_->set_http_auth_handler_factory(
net::HttpAuthHandlerRegistryFactory::CreateDefault(
- main_context_->host_resolver()));
+ main_context_->host_resolver())
+ .release());
main_context_->set_proxy_service(
net::ProxyService::CreateUsingSystemProxyResolver(
- proxy_config_service_.get(), 0, nullptr));
+ proxy_config_service_.get(), 0, nullptr)
+ .release());
// Cache
NSArray* dirs = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,
diff --git a/ios/web/shell/shell_url_request_context_getter.cc b/ios/web/shell/shell_url_request_context_getter.cc
index 5d8c660..4c9aa86 100644
--- a/ios/web/shell/shell_url_request_context_getter.cc
+++ b/ios/web/shell/shell_url_request_context_getter.cc
@@ -7,6 +7,7 @@
#include "base/base_paths.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/threading/worker_pool.h"
#include "ios/net/cookies/cookie_store_ios.h"
@@ -83,7 +84,9 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
std::string user_agent = web::GetWebClient()->GetUserAgent(false);
storage_->set_http_user_agent_settings(
- new net::StaticHttpUserAgentSettings("en-us,en", user_agent));
+ make_scoped_ptr(
+ new net::StaticHttpUserAgentSettings("en-us,en", user_agent))
+ .Pass());
storage_->set_proxy_service(
net::ProxyService::CreateUsingSystemProxyResolver(
proxy_config_service_.release(), 0,
@@ -91,11 +94,11 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
- net::TransportSecurityState* transport_security_state =
- new net::TransportSecurityState();
- storage_->set_transport_security_state(transport_security_state);
+ storage_->set_transport_security_state(
+ make_scoped_ptr(new net::TransportSecurityState()));
transport_security_persister_.reset(new net::TransportSecurityPersister(
- transport_security_state, base_path_, file_task_runner_, false));
+ url_request_context_->transport_security_state(), base_path_,
+ file_task_runner_, false));
storage_->set_channel_id_service(make_scoped_ptr(
new net::ChannelIDService(new net::DefaultChannelIDStore(nullptr),
base::WorkerPool::GetTaskRunner(true))));
@@ -135,9 +138,10 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
net::CACHE_BACKEND_DEFAULT,
cache_path, 0, cache_task_runner_);
- net::HttpCache* main_cache =
- new net::HttpCache(network_session_params, main_backend);
- storage_->set_http_transaction_factory(main_cache);
+ storage_->set_http_transaction_factory(
+ make_scoped_ptr(
+ new net::HttpCache(network_session_params, main_backend))
+ .Pass());
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
@@ -145,7 +149,7 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
"data", make_scoped_ptr(new net::DataProtocolHandler));
DCHECK(set_protocol);
- storage_->set_job_factory(job_factory.release());
+ storage_->set_job_factory(job_factory.Pass());
}
return url_request_context_.get();
diff --git a/mojo/services/network/network_context.cc b/mojo/services/network/network_context.cc
index 3208ad7..3b333fd 100644
--- a/mojo/services/network/network_context.cc
+++ b/mojo/services/network/network_context.cc
@@ -173,7 +173,7 @@ scoped_ptr<net::URLRequestContext> NetworkContext::MakeURLRequestContext(
builder.set_accept_language("en-us,en");
builder.set_user_agent(mojo::common::GetUserAgent());
- builder.set_proxy_service(make_scoped_ptr(net::ProxyService::CreateDirect()));
+ builder.set_proxy_service(net::ProxyService::CreateDirect());
builder.set_transport_security_persister_path(base_path);
net::URLRequestContextBuilder::HttpCacheParams cache_params;
diff --git a/net/cert/cert_verifier.cc b/net/cert/cert_verifier.cc
index 4152d55..3cd4a78 100644
--- a/net/cert/cert_verifier.cc
+++ b/net/cert/cert_verifier.cc
@@ -19,12 +19,14 @@ bool CertVerifier::SupportsOCSPStapling() {
return false;
}
-CertVerifier* CertVerifier::CreateDefault() {
+scoped_ptr<CertVerifier> CertVerifier::CreateDefault() {
#if defined(OS_NACL)
NOTIMPLEMENTED();
- return nullptr;
+ return scoped_ptr<CertVerifier>();
#else
- return new MultiThreadedCertVerifier(CertVerifyProc::CreateDefault());
+ return make_scoped_ptr(
+ new MultiThreadedCertVerifier(CertVerifyProc::CreateDefault()))
+ .Pass();
#endif
}
diff --git a/net/cert/cert_verifier.h b/net/cert/cert_verifier.h
index 6e5eac9..64f4a86 100644
--- a/net/cert/cert_verifier.h
+++ b/net/cert/cert_verifier.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
#include "net/base/completion_callback.h"
#include "net/base/net_export.h"
@@ -128,7 +129,7 @@ class NET_EXPORT CertVerifier {
// Creates a CertVerifier implementation that verifies certificates using
// the preferred underlying cryptographic libraries.
- static CertVerifier* CreateDefault();
+ static scoped_ptr<CertVerifier> CreateDefault();
};
} // namespace net
diff --git a/net/cert_net/cert_net_fetcher_impl_unittest.cc b/net/cert_net/cert_net_fetcher_impl_unittest.cc
index e602418..0c2ee35 100644
--- a/net/cert_net/cert_net_fetcher_impl_unittest.cc
+++ b/net/cert_net/cert_net_fetcher_impl_unittest.cc
@@ -34,8 +34,9 @@ class RequestContext : public URLRequestContext {
RequestContext() : storage_(this) {
ProxyConfig no_proxy;
storage_.set_host_resolver(scoped_ptr<HostResolver>(new MockHostResolver));
- storage_.set_cert_verifier(new MockCertVerifier);
- storage_.set_transport_security_state(new TransportSecurityState);
+ storage_.set_cert_verifier(make_scoped_ptr(new MockCertVerifier).Pass());
+ storage_.set_transport_security_state(
+ make_scoped_ptr(new TransportSecurityState));
storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy));
storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
storage_.set_http_server_properties(
@@ -50,10 +51,12 @@ class RequestContext : public URLRequestContext {
params.http_server_properties = http_server_properties();
scoped_refptr<HttpNetworkSession> network_session(
new HttpNetworkSession(params));
- storage_.set_http_transaction_factory(new HttpCache(
- network_session.get(), HttpCache::DefaultBackend::InMemory(0)));
- URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl();
- storage_.set_job_factory(job_factory);
+ storage_.set_http_transaction_factory(
+ make_scoped_ptr(new HttpCache(network_session.get(),
+ HttpCache::DefaultBackend::InMemory(0)))
+ .Pass());
+ storage_.set_job_factory(
+ make_scoped_ptr(new URLRequestJobFactoryImpl()).Pass());
}
~RequestContext() override { AssertNoURLRequests(); }
diff --git a/net/http/http_auth_handler_factory.cc b/net/http/http_auth_handler_factory.cc
index b148aad..5a89964 100644
--- a/net/http/http_auth_handler_factory.cc
+++ b/net/http/http_auth_handler_factory.cc
@@ -43,11 +43,11 @@ int HttpAuthHandlerFactory::CreatePreemptiveAuthHandlerFromString(
}
// static
-HttpAuthHandlerRegistryFactory* HttpAuthHandlerFactory::CreateDefault(
- HostResolver* host_resolver) {
+scoped_ptr<HttpAuthHandlerRegistryFactory>
+HttpAuthHandlerFactory::CreateDefault(HostResolver* host_resolver) {
DCHECK(host_resolver);
- HttpAuthHandlerRegistryFactory* registry_factory =
- new HttpAuthHandlerRegistryFactory();
+ scoped_ptr<HttpAuthHandlerRegistryFactory> registry_factory =
+ make_scoped_ptr(new HttpAuthHandlerRegistryFactory());
registry_factory->RegisterSchemeFactory(
"basic", new HttpAuthHandlerBasic::Factory());
registry_factory->RegisterSchemeFactory(
diff --git a/net/http/http_auth_handler_factory.h b/net/http/http_auth_handler_factory.h
index 30b1896c..1261bed 100644
--- a/net/http/http_auth_handler_factory.h
+++ b/net/http/http_auth_handler_factory.h
@@ -115,7 +115,8 @@ class NET_EXPORT HttpAuthHandlerFactory {
// non-NULL. |resolver| must remain valid for the lifetime of the
// HttpAuthHandlerRegistryFactory and any HttpAuthHandlers created by said
// factory.
- static HttpAuthHandlerRegistryFactory* CreateDefault(HostResolver* resolver);
+ static scoped_ptr<HttpAuthHandlerRegistryFactory> CreateDefault(
+ HostResolver* resolver);
private:
// The URL security manager
diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc
index 9128cdd3..153423e 100644
--- a/net/http/http_network_layer_unittest.cc
+++ b/net/http/http_network_layer_unittest.cc
@@ -32,10 +32,10 @@ class HttpNetworkLayerTest : public PlatformTest {
ConfigureTestDependencies(ProxyService::CreateDirect());
}
- void ConfigureTestDependencies(ProxyService* proxy_service) {
+ void ConfigureTestDependencies(scoped_ptr<ProxyService> proxy_service) {
cert_verifier_.reset(new MockCertVerifier);
transport_security_state_.reset(new TransportSecurityState);
- proxy_service_.reset(proxy_service);
+ proxy_service_ = proxy_service.Pass();
HttpNetworkSession::Params session_params;
session_params.client_socket_factory = &mock_socket_factory_;
session_params.host_resolver = &host_resolver_;
diff --git a/net/http/http_network_transaction_ssl_unittest.cc b/net/http/http_network_transaction_ssl_unittest.cc
index 2db5a99..da28d9c 100644
--- a/net/http/http_network_transaction_ssl_unittest.cc
+++ b/net/http/http_network_transaction_ssl_unittest.cc
@@ -65,7 +65,7 @@ class HttpNetworkTransactionSSLTest : public testing::Test {
auth_handler_factory_.reset(new HttpAuthHandlerMock::Factory());
session_params_.http_auth_handler_factory = auth_handler_factory_.get();
- proxy_service_.reset(ProxyService::CreateDirect());
+ proxy_service_ = ProxyService::CreateDirect();
session_params_.proxy_service = proxy_service_.get();
session_params_.client_socket_factory = &mock_socket_factory_;
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 25af22f..d200a43 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -2418,8 +2418,8 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) {
request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("PROXY myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -2542,8 +2542,8 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) {
request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("PROXY myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -2667,7 +2667,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) {
request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -2774,7 +2774,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) {
request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -2880,7 +2880,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHangupDuringBody) {
request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
scoped_ptr<HttpTransaction> trans(
@@ -2969,7 +2969,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) {
request.load_flags = 0;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3029,7 +3029,7 @@ TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) {
request.load_flags = 0;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3137,7 +3137,7 @@ TEST_P(HttpNetworkTransactionTest,
request.method = "GET";
request.url = GURL("https://www.example.org/");
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3202,8 +3202,7 @@ TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) {
request2.url = GURL("https://www.example.org/2");
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("PROXY myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("PROXY myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3303,8 +3302,8 @@ TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingWithPacTwoRequests) {
request2.url = GURL("https://www.example.org/2");
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("PROXY myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3401,8 +3400,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) {
request.url = GURL("http://www.example.org/");
// Configure against https proxy server "proxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed(
- "https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3464,8 +3462,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) {
request.load_flags = 0;
// Configure against https proxy server "proxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed(
- "https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3525,8 +3522,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) {
request.load_flags = 0;
// Configure SPDY proxy server "proxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3595,8 +3591,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) {
request.load_flags = 0;
// Configure against https proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("https://myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3696,8 +3691,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) {
request.load_flags = 0;
// Configure against https proxy server "proxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed(
- "https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3781,8 +3775,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) {
request.load_flags = 0;
// Configure against https proxy server "proxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed(
- "https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3873,8 +3866,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) {
request.load_flags = 0;
// Configure against https proxy server "proxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed(
- "https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -3925,8 +3917,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) {
TEST_P(HttpNetworkTransactionTest,
HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) {
// Configure against https proxy server "proxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed(
- "https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(
@@ -4068,8 +4059,7 @@ TEST_P(HttpNetworkTransactionTest,
TEST_P(HttpNetworkTransactionTest,
HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) {
// Configure against https proxy server "proxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed(
- "https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(
@@ -4192,8 +4182,7 @@ TEST_P(HttpNetworkTransactionTest,
// Proxy to different servers.
TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) {
// Configure against https proxy server "proxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed(
- "https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(
@@ -4299,8 +4288,7 @@ TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) {
request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against https proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("https://myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -4399,7 +4387,7 @@ void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus(
request.load_flags = 0;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
// Since we have proxy, should try to establish tunnel.
@@ -4617,7 +4605,7 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) {
request.load_flags = 0;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
scoped_ptr<HttpTransaction> trans(
@@ -5120,7 +5108,7 @@ TEST_P(HttpNetworkTransactionTest,
request.load_flags = 0;
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -6436,7 +6424,7 @@ TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificate) {
// Test HTTPS connections to a site with a bad certificate, going through a
// proxy
TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) {
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
HttpRequestInfo request;
request.method = "GET";
@@ -6518,8 +6506,8 @@ TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) {
// Test HTTPS connections to a site, going through an HTTPS proxy
TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("HTTPS proxy:70");
TestNetLog net_log;
session_deps_.net_log = &net_log;
@@ -6584,8 +6572,8 @@ TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) {
// Test an HTTPS Proxy's ability to redirect a CONNECT request
TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("HTTPS proxy:70");
TestNetLog net_log;
session_deps_.net_log = &net_log;
@@ -6661,8 +6649,7 @@ TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) {
// Test an HTTPS (SPDY) Proxy's ability to redirect a CONNECT request
TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaSpdyProxy) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
HttpRequestInfo request;
request.method = "GET";
@@ -6721,8 +6708,7 @@ TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaSpdyProxy) {
// Test that an HTTPS proxy's response to a CONNECT request is filtered.
TEST_P(HttpNetworkTransactionTest,
ErrorResponseToHttpsConnectViaHttpsProxy) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
HttpRequestInfo request;
request.method = "GET";
@@ -6768,8 +6754,7 @@ TEST_P(HttpNetworkTransactionTest,
// Test that a SPDY proxy's response to a CONNECT request is filtered.
TEST_P(HttpNetworkTransactionTest,
ErrorResponseToHttpsConnectViaSpdyProxy) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
HttpRequestInfo request;
request.method = "GET";
@@ -6833,8 +6818,8 @@ TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) {
request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against https proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -6974,8 +6959,8 @@ TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPush) {
push_request.url = GURL("http://www.another-origin.com/foo.dat");
// Configure against https proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
@@ -7088,8 +7073,7 @@ TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) {
request.url = GURL("http://www.example.org/");
// Configure against https proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("https://myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
@@ -7164,8 +7148,7 @@ TEST_P(HttpNetworkTransactionTest, CrossOriginProxyPushCorrectness) {
// Test HTTPS connections to a site with a bad certificate, going through an
// HTTPS proxy
TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaHttpsProxy) {
- session_deps_.proxy_service.reset(ProxyService::CreateFixed(
- "https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
HttpRequestInfo request;
request.method = "GET";
@@ -7294,7 +7277,7 @@ TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) {
request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent,
"Chromium Ultra Awesome X Edition");
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
@@ -7648,8 +7631,8 @@ TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) {
request.url = GURL("http://www.example.org/");
request.load_flags = 0;
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080");
TestNetLog net_log;
session_deps_.net_log = &net_log;
@@ -7707,8 +7690,8 @@ TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) {
request.url = GURL("https://www.example.org/");
request.load_flags = 0;
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080");
TestNetLog net_log;
session_deps_.net_log = &net_log;
@@ -7771,8 +7754,8 @@ TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) {
request.url = GURL("http://www.example.org/");
request.load_flags = 0;
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("socks4://myproxy:1080"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixed("socks4://myproxy:1080");
TestNetLog net_log;
session_deps_.net_log = &net_log;
@@ -7830,8 +7813,8 @@ TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) {
request.url = GURL("http://www.example.org/");
request.load_flags = 0;
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080");
TestNetLog net_log;
session_deps_.net_log = &net_log;
@@ -7902,8 +7885,8 @@ TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) {
request.url = GURL("https://www.example.org/");
request.load_flags = 0;
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080");
TestNetLog net_log;
session_deps_.net_log = &net_log;
@@ -8059,8 +8042,8 @@ TEST_P(HttpNetworkTransactionTest, GroupNameForDirectConnections) {
session_deps_.use_alternative_services = true;
for (size_t i = 0; i < arraysize(tests); ++i) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed(tests[i].proxy_server));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixed(tests[i].proxy_server);
scoped_refptr<HttpNetworkSession> session(
SetupSessionForGroupNameTests(GetParam(), &session_deps_));
@@ -8121,8 +8104,8 @@ TEST_P(HttpNetworkTransactionTest, GroupNameForHTTPProxyConnections) {
session_deps_.use_alternative_services = true;
for (size_t i = 0; i < arraysize(tests); ++i) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed(tests[i].proxy_server));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixed(tests[i].proxy_server);
scoped_refptr<HttpNetworkSession> session(
SetupSessionForGroupNameTests(GetParam(), &session_deps_));
@@ -8191,8 +8174,8 @@ TEST_P(HttpNetworkTransactionTest, GroupNameForSOCKSConnections) {
session_deps_.use_alternative_services = true;
for (size_t i = 0; i < arraysize(tests); ++i) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed(tests[i].proxy_server));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixed(tests[i].proxy_server);
scoped_refptr<HttpNetworkSession> session(
SetupSessionForGroupNameTests(GetParam(), &session_deps_));
@@ -8229,8 +8212,8 @@ TEST_P(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) {
request.method = "GET";
request.url = GURL("http://www.example.org/");
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("myproxy:70;foobar:80"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixed("myproxy:70;foobar:80");
// This simulates failure resolving all hostnames; that means we will fail
// connecting to both proxies (myproxy:70 and foobar:80).
@@ -8467,7 +8450,7 @@ TEST_P(HttpNetworkTransactionTest, DrainResetOK) {
// Test HTTPS connections going through a proxy that sends extra data.
TEST_P(HttpNetworkTransactionTest, HTTPSViaProxyWithExtraData) {
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
HttpRequestInfo request;
request.method = "GET";
@@ -10515,10 +10498,10 @@ TEST_P(HttpNetworkTransactionTest, GenerateAuthToken) {
auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER);
}
if (test_config.proxy_url) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed(test_config.proxy_url));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixed(test_config.proxy_url);
} else {
- session_deps_.proxy_service.reset(ProxyService::CreateDirect());
+ session_deps_.proxy_service = ProxyService::CreateDirect();
}
HttpRequestInfo request;
@@ -10604,7 +10587,7 @@ TEST_P(HttpNetworkTransactionTest, MultiRoundAuth) {
HttpAuthHandlerMock::Factory* auth_factory(
new HttpAuthHandlerMock::Factory());
session_deps_.http_auth_handler_factory.reset(auth_factory);
- session_deps_.proxy_service.reset(ProxyService::CreateDirect());
+ session_deps_.proxy_service = ProxyService::CreateDirect();
session_deps_.host_resolver->rules()->AddRule("www.example.com", "10.0.0.1");
session_deps_.host_resolver->set_synchronous_mode(true);
@@ -10915,8 +10898,8 @@ TEST_P(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) {
session_deps_.use_alternative_services = true;
session_deps_.next_protos = SpdyNextProtos();
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("PROXY myproxy:70");
TestNetLog net_log;
session_deps_.net_log = &net_log;
GURL request_url;
@@ -11161,8 +11144,8 @@ TEST_P(HttpNetworkTransactionTest, CancelAfterHeaders) {
// Test a basic GET request through a proxy.
TEST_P(HttpNetworkTransactionTest, ProxyGet) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("PROXY myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -11225,8 +11208,8 @@ TEST_P(HttpNetworkTransactionTest, ProxyGet) {
// Test a basic HTTPS GET request through a proxy.
TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("PROXY myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -11303,7 +11286,7 @@ TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) {
// Test a basic HTTPS GET request through a proxy, but the server hangs up
// while establishing the tunnel.
TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) {
- session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -11674,8 +11657,7 @@ TEST_P(HttpNetworkTransactionTest,
// The test is repeated twice, first for connecting to an HTTPS endpoint,
// then for connecting to an HTTP endpoint.
TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) {
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixed("https://proxy:70"));
+ session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70");
BoundTestNetLog log;
session_deps_.net_log = log.bound().net_log();
@@ -12660,8 +12642,8 @@ TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionForHttpOverTunnel) {
MockConnect connect_data1(ASYNC, OK);
data1.set_connect_data(connect_data1);
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("HTTPS proxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("HTTPS proxy:70");
TestNetLog log;
session_deps_.net_log = &log;
SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy
@@ -14427,8 +14409,8 @@ TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) {
AddWebSocketHeaders(&request.extra_headers);
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("PROXY myproxy:70");
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -14534,8 +14516,8 @@ TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) {
AddWebSocketHeaders(&request.extra_headers);
// Configure against proxy server "myproxy:70".
- session_deps_.proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
+ session_deps_.proxy_service =
+ ProxyService::CreateFixedFromPacResult("PROXY myproxy:70");
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
diff --git a/net/http/http_stream_factory_impl_request_unittest.cc b/net/http/http_stream_factory_impl_request_unittest.cc
index c4173ea..7a54831 100644
--- a/net/http/http_stream_factory_impl_request_unittest.cc
+++ b/net/http/http_stream_factory_impl_request_unittest.cc
@@ -4,6 +4,7 @@
#include "net/http/http_stream_factory_impl_request.h"
+#include "base/memory/scoped_ptr.h"
#include "net/http/http_stream_factory_impl_job.h"
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_service.h"
diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc
index 9bf70e0..30d93a3 100644
--- a/net/http/http_stream_factory_impl_unittest.cc
+++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -618,8 +618,8 @@ TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) {
ERR_MSG_TOO_BIG};
for (size_t i = 0; i < arraysize(mock_error); ++i) {
scoped_ptr<ProxyService> proxy_service;
- proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT"));
+ proxy_service =
+ ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT");
HttpNetworkSession::Params params;
params.enable_quic = true;
@@ -680,8 +680,7 @@ TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) {
TEST_P(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad) {
// Checks if a
scoped_ptr<ProxyService> proxy_service;
- proxy_service.reset(
- ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT"));
+ proxy_service = ProxyService::CreateFixedFromPacResult("QUIC bad:99; DIRECT");
HttpNetworkSession::Params params;
params.enable_quic = true;
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc
index 0ffe0c0..3dfd3ce 100644
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc
@@ -61,8 +61,9 @@ class RequestContext : public URLRequestContext {
RequestContext() : storage_(this) {
ProxyConfig no_proxy;
storage_.set_host_resolver(scoped_ptr<HostResolver>(new MockHostResolver));
- storage_.set_cert_verifier(new MockCertVerifier);
- storage_.set_transport_security_state(new TransportSecurityState);
+ storage_.set_cert_verifier(make_scoped_ptr(new MockCertVerifier).Pass());
+ storage_.set_transport_security_state(
+ make_scoped_ptr(new TransportSecurityState));
storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy));
storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
storage_.set_http_server_properties(
@@ -77,15 +78,18 @@ class RequestContext : public URLRequestContext {
params.http_server_properties = http_server_properties();
scoped_refptr<HttpNetworkSession> network_session(
new HttpNetworkSession(params));
- storage_.set_http_transaction_factory(new HttpCache(
- network_session.get(), HttpCache::DefaultBackend::InMemory(0)));
- URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl();
+ storage_.set_http_transaction_factory(
+ make_scoped_ptr(new HttpCache(network_session.get(),
+ HttpCache::DefaultBackend::InMemory(0)))
+ .Pass());
+ scoped_ptr<URLRequestJobFactoryImpl> job_factory =
+ make_scoped_ptr(new URLRequestJobFactoryImpl());
#if !defined(DISABLE_FILE_SUPPORT)
job_factory->SetProtocolHandler("file",
make_scoped_ptr(new FileProtocolHandler(
base::ThreadTaskRunnerHandle::Get())));
#endif
- storage_.set_job_factory(job_factory);
+ storage_.set_job_factory(job_factory.Pass());
}
~RequestContext() override { AssertNoURLRequests(); }
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 28f0bd8..7a00448 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -935,7 +935,7 @@ ProxyService::ProxyService(ProxyConfigService* config_service,
}
// static
-ProxyService* ProxyService::CreateUsingSystemProxyResolver(
+scoped_ptr<ProxyService> ProxyService::CreateUsingSystemProxyResolver(
ProxyConfigService* proxy_config_service,
size_t num_pac_threads,
NetLog* net_log) {
@@ -949,23 +949,23 @@ ProxyService* ProxyService::CreateUsingSystemProxyResolver(
if (num_pac_threads == 0)
num_pac_threads = kDefaultNumPacThreads;
- return new ProxyService(
+ return make_scoped_ptr(new ProxyService(
proxy_config_service,
make_scoped_ptr(new ProxyResolverFactoryForSystem(num_pac_threads)),
- net_log);
+ net_log));
}
// static
-ProxyService* ProxyService::CreateWithoutProxyResolver(
+scoped_ptr<ProxyService> ProxyService::CreateWithoutProxyResolver(
ProxyConfigService* proxy_config_service,
NetLog* net_log) {
- return new ProxyService(
+ return make_scoped_ptr(new ProxyService(
proxy_config_service,
- make_scoped_ptr(new ProxyResolverFactoryForNullResolver), net_log);
+ make_scoped_ptr(new ProxyResolverFactoryForNullResolver), net_log));
}
// static
-ProxyService* ProxyService::CreateFixed(const ProxyConfig& pc) {
+scoped_ptr<ProxyService> ProxyService::CreateFixed(const ProxyConfig& pc) {
// TODO(eroman): This isn't quite right, won't work if |pc| specifies
// a PAC script.
return CreateUsingSystemProxyResolver(new ProxyConfigServiceFixed(pc),
@@ -973,36 +973,35 @@ ProxyService* ProxyService::CreateFixed(const ProxyConfig& pc) {
}
// static
-ProxyService* ProxyService::CreateFixed(const std::string& proxy) {
+scoped_ptr<ProxyService> ProxyService::CreateFixed(const std::string& proxy) {
ProxyConfig proxy_config;
proxy_config.proxy_rules().ParseFromString(proxy);
return ProxyService::CreateFixed(proxy_config);
}
// static
-ProxyService* ProxyService::CreateDirect() {
+scoped_ptr<ProxyService> ProxyService::CreateDirect() {
return CreateDirectWithNetLog(NULL);
}
-ProxyService* ProxyService::CreateDirectWithNetLog(NetLog* net_log) {
+scoped_ptr<ProxyService> ProxyService::CreateDirectWithNetLog(NetLog* net_log) {
// Use direct connections.
- return new ProxyService(
+ return make_scoped_ptr(new ProxyService(
new ProxyConfigServiceDirect,
- make_scoped_ptr(new ProxyResolverFactoryForNullResolver), net_log);
+ make_scoped_ptr(new ProxyResolverFactoryForNullResolver), net_log));
}
// static
-ProxyService* ProxyService::CreateFixedFromPacResult(
+scoped_ptr<ProxyService> ProxyService::CreateFixedFromPacResult(
const std::string& pac_string) {
-
// We need the settings to contain an "automatic" setting, otherwise the
// ProxyResolver dependency we give it will never be used.
scoped_ptr<ProxyConfigService> proxy_config_service(
new ProxyConfigServiceFixed(ProxyConfig::CreateAutoDetect()));
- return new ProxyService(
+ return make_scoped_ptr(new ProxyService(
proxy_config_service.release(),
- make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL);
+ make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL));
}
int ProxyService::ResolveProxy(const GURL& raw_url,
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index 76fd4e0..ee74252 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -235,32 +235,33 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver,
// Same as CreateProxyServiceUsingV8ProxyResolver, except it uses system
// libraries for evaluating the PAC script if available, otherwise skips
// proxy autoconfig.
- static ProxyService* CreateUsingSystemProxyResolver(
+ static scoped_ptr<ProxyService> CreateUsingSystemProxyResolver(
ProxyConfigService* proxy_config_service,
size_t num_pac_threads,
NetLog* net_log);
// Creates a ProxyService without support for proxy autoconfig.
- static ProxyService* CreateWithoutProxyResolver(
+ static scoped_ptr<ProxyService> CreateWithoutProxyResolver(
ProxyConfigService* proxy_config_service,
NetLog* net_log);
// Convenience methods that creates a proxy service using the
// specified fixed settings.
- static ProxyService* CreateFixed(const ProxyConfig& pc);
- static ProxyService* CreateFixed(const std::string& proxy);
+ static scoped_ptr<ProxyService> CreateFixed(const ProxyConfig& pc);
+ static scoped_ptr<ProxyService> CreateFixed(const std::string& proxy);
// Creates a proxy service that uses a DIRECT connection for all requests.
- static ProxyService* CreateDirect();
+ static scoped_ptr<ProxyService> CreateDirect();
// |net_log|'s lifetime must exceed ProxyService.
- static ProxyService* CreateDirectWithNetLog(NetLog* net_log);
+ static scoped_ptr<ProxyService> CreateDirectWithNetLog(NetLog* net_log);
// This method is used by tests to create a ProxyService that returns a
// hardcoded proxy fallback list (|pac_string|) for every URL.
//
// |pac_string| is a list of proxy servers, in the format that a PAC script
// would return it. For example, "PROXY foobar:99; SOCKS fml:2; DIRECT"
- static ProxyService* CreateFixedFromPacResult(const std::string& pac_string);
+ static scoped_ptr<ProxyService> CreateFixedFromPacResult(
+ const std::string& pac_string);
// Creates a config service appropriate for this platform that fetches the
// system proxy settings.
diff --git a/net/proxy/proxy_service_mojo.cc b/net/proxy/proxy_service_mojo.cc
index 92f8938..0205f13 100644
--- a/net/proxy/proxy_service_mojo.cc
+++ b/net/proxy/proxy_service_mojo.cc
@@ -5,6 +5,7 @@
#include "net/proxy/proxy_service_mojo.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/thread_task_runner_handle.h"
#include "net/dns/mojo_host_resolver_impl.h"
#include "net/interfaces/proxy_resolver_service.mojom.h"
@@ -19,7 +20,7 @@
namespace net {
-ProxyService* CreateProxyServiceUsingMojoFactory(
+scoped_ptr<ProxyService> CreateProxyServiceUsingMojoFactory(
MojoProxyResolverFactory* mojo_proxy_factory,
ProxyConfigService* proxy_config_service,
ProxyScriptFetcher* proxy_script_fetcher,
@@ -32,14 +33,14 @@ ProxyService* CreateProxyServiceUsingMojoFactory(
DCHECK(dhcp_proxy_script_fetcher);
DCHECK(host_resolver);
- ProxyService* proxy_service = new ProxyService(
+ scoped_ptr<ProxyService> proxy_service(new ProxyService(
proxy_config_service,
make_scoped_ptr(new ProxyResolverFactoryMojo(
mojo_proxy_factory, host_resolver,
base::Bind(&NetworkDelegateErrorObserver::Create, network_delegate,
base::ThreadTaskRunnerHandle::Get()),
net_log)),
- net_log);
+ net_log));
// Configure fetchers to use for PAC script downloads and auto-detect.
proxy_service->SetProxyScriptFetchers(proxy_script_fetcher,
@@ -48,7 +49,7 @@ ProxyService* CreateProxyServiceUsingMojoFactory(
return proxy_service;
}
-ProxyService* CreateProxyServiceUsingMojoInProcess(
+scoped_ptr<ProxyService> CreateProxyServiceUsingMojoInProcess(
ProxyConfigService* proxy_config_service,
ProxyScriptFetcher* proxy_script_fetcher,
scoped_ptr<DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher,
diff --git a/net/proxy/proxy_service_mojo.h b/net/proxy/proxy_service_mojo.h
index d7faf08..7546723 100644
--- a/net/proxy/proxy_service_mojo.h
+++ b/net/proxy/proxy_service_mojo.h
@@ -36,7 +36,7 @@ class ProxyService;
// |host_resolver| points to the host resolving dependency the PAC script
// should use for any DNS queries. It must remain valid throughout the
// lifetime of the ProxyService.
-ProxyService* CreateProxyServiceUsingMojoFactory(
+scoped_ptr<ProxyService> CreateProxyServiceUsingMojoFactory(
MojoProxyResolverFactory* mojo_proxy_factory,
ProxyConfigService* proxy_config_service,
ProxyScriptFetcher* proxy_script_fetcher,
@@ -53,7 +53,7 @@ ProxyService* CreateProxyServiceUsingMojoFactory(
// # multi-threading model. In order for this to be safe to use, *ALL* the
// # other V8's running in the process must use v8::Locker.
// ##########################################################################
-ProxyService* CreateProxyServiceUsingMojoInProcess(
+scoped_ptr<ProxyService> CreateProxyServiceUsingMojoInProcess(
ProxyConfigService* proxy_config_service,
ProxyScriptFetcher* proxy_script_fetcher,
scoped_ptr<DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher,
diff --git a/net/proxy/proxy_service_mojo_unittest.cc b/net/proxy/proxy_service_mojo_unittest.cc
index 28ad77b..aeb262b 100644
--- a/net/proxy/proxy_service_mojo_unittest.cc
+++ b/net/proxy/proxy_service_mojo_unittest.cc
@@ -126,11 +126,11 @@ class ProxyServiceMojoTest : public testing::Test,
mock_host_resolver_.rules()->AddRule("example.com", "1.2.3.4");
fetcher_ = new MockProxyScriptFetcher;
- proxy_service_.reset(CreateProxyServiceUsingMojoFactory(
+ proxy_service_ = CreateProxyServiceUsingMojoFactory(
this, new ProxyConfigServiceFixed(
ProxyConfig::CreateFromCustomPacURL(GURL(kPacUrl))),
fetcher_, make_scoped_ptr(new DoNothingDhcpProxyScriptFetcher()),
- &mock_host_resolver_, &net_log_, &network_delegate_));
+ &mock_host_resolver_, &net_log_, &network_delegate_);
}
scoped_ptr<base::ScopedClosureRunner> CreateResolver(
diff --git a/net/proxy/proxy_service_v8.cc b/net/proxy/proxy_service_v8.cc
index 6815564..2370b23 100644
--- a/net/proxy/proxy_service_v8.cc
+++ b/net/proxy/proxy_service_v8.cc
@@ -5,6 +5,7 @@
#include "net/proxy/proxy_service_v8.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_checker.h"
#include "net/proxy/network_delegate_error_observer.h"
@@ -16,7 +17,7 @@
namespace net {
// static
-ProxyService* CreateProxyServiceUsingV8ProxyResolver(
+scoped_ptr<ProxyService> CreateProxyServiceUsingV8ProxyResolver(
ProxyConfigService* proxy_config_service,
ProxyScriptFetcher* proxy_script_fetcher,
scoped_ptr<DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher,
@@ -28,13 +29,13 @@ ProxyService* CreateProxyServiceUsingV8ProxyResolver(
DCHECK(dhcp_proxy_script_fetcher);
DCHECK(host_resolver);
- ProxyService* proxy_service = new ProxyService(
+ scoped_ptr<ProxyService> proxy_service(new ProxyService(
proxy_config_service,
make_scoped_ptr(new ProxyResolverFactoryV8TracingWrapper(
host_resolver, net_log,
base::Bind(&NetworkDelegateErrorObserver::Create, network_delegate,
base::ThreadTaskRunnerHandle::Get()))),
- net_log);
+ net_log));
// Configure fetchers to use for PAC script downloads and auto-detect.
proxy_service->SetProxyScriptFetchers(proxy_script_fetcher,
diff --git a/net/proxy/proxy_service_v8.h b/net/proxy/proxy_service_v8.h
index 65e5d7c..5341afe 100644
--- a/net/proxy/proxy_service_v8.h
+++ b/net/proxy/proxy_service_v8.h
@@ -37,7 +37,7 @@ class ProxyService;
// # multi-threading model. In order for this to be safe to use, *ALL* the
// # other V8's running in the process must use v8::Locker.
// ##########################################################################
-NET_EXPORT ProxyService* CreateProxyServiceUsingV8ProxyResolver(
+NET_EXPORT scoped_ptr<ProxyService> CreateProxyServiceUsingV8ProxyResolver(
ProxyConfigService* proxy_config_service,
ProxyScriptFetcher* proxy_script_fetcher,
scoped_ptr<DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher,
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc
index ffd1918..b0b5de2 100644
--- a/net/quic/quic_network_transaction_unittest.cc
+++ b/net/quic/quic_network_transaction_unittest.cc
@@ -474,8 +474,7 @@ TEST_P(QuicNetworkTransactionTest, ForceQuic) {
TEST_P(QuicNetworkTransactionTest, QuicProxy) {
params_.enable_insecure_quic = true;
params_.enable_quic_for_proxies = true;
- proxy_service_.reset(
- ProxyService::CreateFixedFromPacResult("QUIC myproxy:70"));
+ proxy_service_ = ProxyService::CreateFixedFromPacResult("QUIC myproxy:70");
MockQuicData mock_quic_data;
mock_quic_data.AddWrite(
@@ -509,8 +508,8 @@ TEST_P(QuicNetworkTransactionTest, QuicProxyWithCert) {
params_.enable_insecure_quic = true;
params_.enable_quic_for_proxies = true;
- proxy_service_.reset(
- ProxyService::CreateFixedFromPacResult("QUIC " + proxy_host + ":70"));
+ proxy_service_ =
+ ProxyService::CreateFixedFromPacResult("QUIC " + proxy_host + ":70");
maker_.set_hostname(origin_host);
MockQuicData mock_quic_data;
@@ -1370,8 +1369,7 @@ TEST_P(QuicNetworkTransactionTest, ZeroRTTWithNoHttpRace) {
TEST_P(QuicNetworkTransactionTest, ZeroRTTWithProxy) {
params_.enable_insecure_quic = true;
- proxy_service_.reset(
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
+ proxy_service_ = ProxyService::CreateFixedFromPacResult("PROXY myproxy:70");
// Since we are using a proxy, the QUIC job will not succeed.
MockWrite http_writes[] = {
diff --git a/net/quic/test_tools/crypto_test_utils_chromium.cc b/net/quic/test_tools/crypto_test_utils_chromium.cc
index 6abc1c1..366dd5e 100644
--- a/net/quic/test_tools/crypto_test_utils_chromium.cc
+++ b/net/quic/test_tools/crypto_test_utils_chromium.cc
@@ -25,13 +25,15 @@ namespace {
class TestProofVerifierChromium : public ProofVerifierChromium {
public:
- // TODO(rch): |transport_security_state| should be a scoped_ptr.
- TestProofVerifierChromium(CertVerifier* cert_verifier,
- TransportSecurityState* transport_security_state,
- const std::string& cert_file)
- : ProofVerifierChromium(cert_verifier, nullptr, transport_security_state),
- cert_verifier_(cert_verifier),
- transport_security_state_(transport_security_state) {
+ TestProofVerifierChromium(
+ scoped_ptr<CertVerifier> cert_verifier,
+ scoped_ptr<TransportSecurityState> transport_security_state,
+ const std::string& cert_file)
+ : ProofVerifierChromium(cert_verifier.get(),
+ nullptr,
+ transport_security_state.get()),
+ cert_verifier_(cert_verifier.Pass()),
+ transport_security_state_(transport_security_state.Pass()) {
// Load and install the root for the validated chain.
scoped_refptr<X509Certificate> root_cert =
ImportCertFromFile(GetTestCertsDirectory(), cert_file);
@@ -122,7 +124,7 @@ ProofSource* CryptoTestUtils::ProofSourceForTesting() {
// static
ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() {
// TODO(rch): use a real cert verifier?
- MockCertVerifier* cert_verifier = new MockCertVerifier();
+ scoped_ptr<MockCertVerifier> cert_verifier(new MockCertVerifier());
net::CertVerifyResult verify_result;
verify_result.verified_cert =
ImportCertFromFile(GetTestCertsDirectory(), "quic_test.example.com.crt");
@@ -133,7 +135,8 @@ ProofVerifier* CryptoTestUtils::ProofVerifierForTesting() {
cert_verifier->AddResultForCertAndHost(verify_result.verified_cert.get(),
"test.example.com", verify_result, OK);
return new TestProofVerifierChromium(
- cert_verifier, new TransportSecurityState, "quic_root.crt");
+ cert_verifier.Pass(), make_scoped_ptr(new TransportSecurityState),
+ "quic_root.crt");
}
// static
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index cc7ba20..fa4f03b 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -105,20 +105,20 @@ void UpdateSpdySessionDependencies(SpdyNetworkTransactionTestParams test_params,
}
}
-SpdySessionDependencies* CreateSpdySessionDependencies(
+scoped_ptr<SpdySessionDependencies> CreateSpdySessionDependencies(
SpdyNetworkTransactionTestParams test_params) {
- SpdySessionDependencies* session_deps =
- new SpdySessionDependencies(test_params.protocol);
- UpdateSpdySessionDependencies(test_params, session_deps);
+ scoped_ptr<SpdySessionDependencies> session_deps(
+ new SpdySessionDependencies(test_params.protocol));
+ UpdateSpdySessionDependencies(test_params, session_deps.get());
return session_deps;
}
-SpdySessionDependencies* CreateSpdySessionDependencies(
+scoped_ptr<SpdySessionDependencies> CreateSpdySessionDependencies(
SpdyNetworkTransactionTestParams test_params,
- ProxyService* proxy_service) {
- SpdySessionDependencies* session_deps =
- new SpdySessionDependencies(test_params.protocol, proxy_service);
- UpdateSpdySessionDependencies(test_params, session_deps);
+ scoped_ptr<ProxyService> proxy_service) {
+ scoped_ptr<SpdySessionDependencies> session_deps(
+ new SpdySessionDependencies(test_params.protocol, proxy_service.Pass()));
+ UpdateSpdySessionDependencies(test_params, session_deps.get());
return session_deps;
}
@@ -155,16 +155,17 @@ class SpdyNetworkTransactionTest
// A helper class that handles all the initial npn/ssl setup.
class NormalSpdyTransactionHelper {
public:
- NormalSpdyTransactionHelper(const HttpRequestInfo& request,
- RequestPriority priority,
- const BoundNetLog& log,
- SpdyNetworkTransactionTestParams test_params,
- SpdySessionDependencies* session_deps)
+ NormalSpdyTransactionHelper(
+ const HttpRequestInfo& request,
+ RequestPriority priority,
+ const BoundNetLog& log,
+ SpdyNetworkTransactionTestParams test_params,
+ scoped_ptr<SpdySessionDependencies> session_deps)
: request_(request),
priority_(priority),
- session_deps_(session_deps == NULL
+ session_deps_(session_deps.get() == NULL
? CreateSpdySessionDependencies(test_params)
- : session_deps),
+ : session_deps.Pass()),
session_(
SpdySessionDependencies::SpdyCreateSession(session_deps_.get())),
log_(log),
@@ -198,7 +199,7 @@ class SpdyNetworkTransactionTest
void RunPreTestSetup() {
if (!session_deps_.get())
- session_deps_.reset(CreateSpdySessionDependencies(test_params_));
+ session_deps_ = CreateSpdySessionDependencies(test_params_);
if (!session_.get()) {
session_ = SpdySessionDependencies::SpdyCreateSession(
session_deps_.get());
@@ -3537,11 +3538,12 @@ TEST_P(SpdyNetworkTransactionTest, DecompressFailureOnSynReply) {
};
SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes));
- SpdySessionDependencies* session_deps =
+ scoped_ptr<SpdySessionDependencies> session_deps =
CreateSpdySessionDependencies(GetParam());
session_deps->enable_compression = true;
NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
- BoundNetLog(), GetParam(), session_deps);
+ BoundNetLog(), GetParam(),
+ session_deps.Pass());
helper.RunToCompletion(&data);
TransactionHelperResult out = helper.output();
EXPECT_EQ(ERR_SPDY_COMPRESSION_ERROR, out.rv);
@@ -4400,7 +4402,7 @@ TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredRetry) {
// Do not force SPDY so that second socket can negotiate HTTP/1.1.
session_deps->next_protos = SpdyNextProtos();
NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(),
- GetParam(), session_deps.release());
+ GetParam(), session_deps.Pass());
// First socket: HTTP/2 request rejected with HTTP_1_1_REQUIRED.
const char* url = request.url.spec().c_str();
@@ -4492,7 +4494,7 @@ TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredProxyRetry) {
// Do not force SPDY so that second socket can negotiate HTTP/1.1.
session_deps->next_protos = SpdyNextProtos();
NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(),
- GetParam(), session_deps.release());
+ GetParam(), session_deps.Pass());
// First socket: HTTP/2 CONNECT rejected with HTTP_1_1_REQUIRED.
scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect(
@@ -4580,9 +4582,8 @@ TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredProxyRetry) {
TEST_P(SpdyNetworkTransactionTest, ProxyConnect) {
NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
BoundNetLog(), GetParam(), NULL);
- helper.session_deps().reset(CreateSpdySessionDependencies(
- GetParam(),
- ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")));
+ helper.session_deps() = CreateSpdySessionDependencies(
+ GetParam(), ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"));
helper.SetSession(make_scoped_refptr(
SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())));
helper.RunPreTestSetup();
@@ -4645,9 +4646,9 @@ TEST_P(SpdyNetworkTransactionTest, DirectConnectProxyReconnect) {
// myproxy:70. For this test there will be no fallback, so it is equivalent
// to simply DIRECT. The reason for appending the second proxy is to verify
// that the session pool key used does is just "DIRECT".
- helper.session_deps().reset(CreateSpdySessionDependencies(
+ helper.session_deps() = CreateSpdySessionDependencies(
GetParam(),
- ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70")));
+ ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70"));
helper.SetSession(make_scoped_refptr(
SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get())));
@@ -5586,9 +5587,8 @@ TEST_P(SpdyNetworkTransactionTest, ServerPushCrossOriginCorrectness) {
scoped_ptr<SpdySessionDependencies> session_deps(
CreateSpdySessionDependencies(GetParam()));
session_deps->trusted_spdy_proxy = "123.45.67.89:8080";
- NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY,
- BoundNetLog(), GetParam(),
- session_deps.release());
+ NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(),
+ GetParam(), session_deps.Pass());
helper.RunPreTestSetup();
helper.AddData(&data);
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc
index 7fe1896..2b9b2b7 100644
--- a/net/spdy/spdy_test_util_common.cc
+++ b/net/spdy/spdy_test_util_common.cc
@@ -386,12 +386,13 @@ SpdySessionDependencies::SpdySessionDependencies(NextProto protocol)
host_resolver->set_synchronous_mode(true);
}
-SpdySessionDependencies::SpdySessionDependencies(NextProto protocol,
- ProxyService* proxy_service)
+SpdySessionDependencies::SpdySessionDependencies(
+ NextProto protocol,
+ scoped_ptr<ProxyService> proxy_service)
: host_resolver(new MockHostResolver),
cert_verifier(new MockCertVerifier),
transport_security_state(new TransportSecurityState),
- proxy_service(proxy_service),
+ proxy_service(proxy_service.Pass()),
ssl_config_service(new SSLConfigServiceDefaults),
socket_factory(new MockClientSocketFactory),
deterministic_socket_factory(new DeterministicMockClientSocketFactory),
@@ -476,15 +477,17 @@ SpdyURLRequestContext::SpdyURLRequestContext(NextProto protocol)
DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol;
storage_.set_host_resolver(scoped_ptr<HostResolver>(new MockHostResolver));
- storage_.set_cert_verifier(new MockCertVerifier);
- storage_.set_transport_security_state(new TransportSecurityState);
+ storage_.set_cert_verifier(make_scoped_ptr(new MockCertVerifier).Pass());
+ storage_.set_transport_security_state(
+ make_scoped_ptr(new TransportSecurityState));
storage_.set_proxy_service(ProxyService::CreateDirect());
storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
- storage_.set_http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault(
- host_resolver()));
+ storage_.set_http_auth_handler_factory(
+ HttpAuthHandlerFactory::CreateDefault(host_resolver()));
storage_.set_http_server_properties(
scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
- storage_.set_job_factory(new URLRequestJobFactoryImpl());
+ storage_.set_job_factory(
+ make_scoped_ptr(new URLRequestJobFactoryImpl()).Pass());
HttpNetworkSession::Params params;
params.client_socket_factory = &socket_factory_;
params.host_resolver = host_resolver();
@@ -502,8 +505,10 @@ SpdyURLRequestContext::SpdyURLRequestContext(NextProto protocol)
new HttpNetworkSession(params));
SpdySessionPoolPeer pool_peer(network_session->spdy_session_pool());
pool_peer.SetEnableSendingInitialData(false);
- storage_.set_http_transaction_factory(new HttpCache(
- network_session.get(), HttpCache::DefaultBackend::InMemory(0)));
+ storage_.set_http_transaction_factory(
+ make_scoped_ptr(new HttpCache(network_session.get(),
+ HttpCache::DefaultBackend::InMemory(0)))
+ .Pass());
}
SpdyURLRequestContext::~SpdyURLRequestContext() {
diff --git a/net/spdy/spdy_test_util_common.h b/net/spdy/spdy_test_util_common.h
index 5364fe3..68bdfdf 100644
--- a/net/spdy/spdy_test_util_common.h
+++ b/net/spdy/spdy_test_util_common.h
@@ -189,7 +189,8 @@ struct SpdySessionDependencies {
explicit SpdySessionDependencies(NextProto protocol);
// Custom proxy service dependency.
- SpdySessionDependencies(NextProto protocol, ProxyService* proxy_service);
+ SpdySessionDependencies(NextProto protocol,
+ scoped_ptr<ProxyService> proxy_service);
~SpdySessionDependencies();
diff --git a/net/tools/quic/quic_client_bin.cc b/net/tools/quic/quic_client_bin.cc
index f47894c..2e1c277 100644
--- a/net/tools/quic/quic_client_bin.cc
+++ b/net/tools/quic/quic_client_bin.cc
@@ -216,7 +216,7 @@ int main(int argc, char *argv[]) {
client.set_initial_max_packet_length(
FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize);
// For secure QUIC we need to verify the cert chain.
- cert_verifier.reset(CertVerifier::CreateDefault());
+ cert_verifier = CertVerifier::CreateDefault();
transport_security_state.reset(new TransportSecurityState);
client.SetProofVerifier(new ProofVerifierChromium(
cert_verifier.get(), nullptr, transport_security_state.get()));
diff --git a/net/tools/quic/quic_simple_client_bin.cc b/net/tools/quic/quic_simple_client_bin.cc
index d8b5a07..762a917 100644
--- a/net/tools/quic/quic_simple_client_bin.cc
+++ b/net/tools/quic/quic_simple_client_bin.cc
@@ -218,7 +218,7 @@ int main(int argc, char *argv[]) {
client.set_initial_max_packet_length(
FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize);
// For secure QUIC we need to verify the cert chain.
- cert_verifier.reset(CertVerifier::CreateDefault());
+ cert_verifier = CertVerifier::CreateDefault();
transport_security_state.reset(new TransportSecurityState);
client.SetProofVerifier(new ProofVerifierChromium(
cert_verifier.get(), nullptr, transport_security_state.get()));
diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc
index 5432391..37e6902 100644
--- a/net/url_request/url_fetcher_impl_unittest.cc
+++ b/net/url_request/url_fetcher_impl_unittest.cc
@@ -15,6 +15,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/location.h"
#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
@@ -168,7 +169,8 @@ class FetcherTestURLRequestContext : public TestURLRequestContext {
// Pass ownership to ContextStorage to ensure correct destruction order.
context_storage_.set_host_resolver(
scoped_ptr<HostResolver>(mock_resolver_));
- context_storage_.set_throttler_manager(new URLRequestThrottlerManager());
+ context_storage_.set_throttler_manager(
+ make_scoped_ptr(new URLRequestThrottlerManager()));
Init();
}
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc
index 508b182..177bea7 100644
--- a/net/url_request/url_request_context_builder.cc
+++ b/net/url_request/url_request_context_builder.cc
@@ -270,20 +270,21 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
new ContainerURLRequestContext(file_task_runner_));
URLRequestContextStorage* storage = context->storage();
- storage->set_http_user_agent_settings(new StaticHttpUserAgentSettings(
- accept_language_, user_agent_));
+ storage->set_http_user_agent_settings(
+ make_scoped_ptr(
+ new StaticHttpUserAgentSettings(accept_language_, user_agent_))
+ .Pass());
if (!network_delegate_)
network_delegate_.reset(new BasicNetworkDelegate);
- NetworkDelegate* network_delegate = network_delegate_.release();
- storage->set_network_delegate(network_delegate);
+ storage->set_network_delegate(network_delegate_.Pass());
if (net_log_) {
// Unlike the other builder parameters, |net_log_| is not owned by the
// builder or resulting context.
context->set_net_log(net_log_);
} else {
- storage->set_net_log(new NetLog);
+ storage->set_net_log(make_scoped_ptr(new NetLog));
}
if (!host_resolver_) {
@@ -306,23 +307,23 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
context->GetFileTaskRunner());
}
#endif // defined(OS_LINUX) || defined(OS_ANDROID)
- proxy_service_.reset(
- ProxyService::CreateUsingSystemProxyResolver(
- proxy_config_service,
- 0, // This results in using the default value.
- context->net_log()));
+ proxy_service_ = ProxyService::CreateUsingSystemProxyResolver(
+ proxy_config_service,
+ 0, // This results in using the default value.
+ context->net_log());
}
- storage->set_proxy_service(proxy_service_.release());
+ storage->set_proxy_service(proxy_service_.Pass());
storage->set_ssl_config_service(new SSLConfigServiceDefaults);
- HttpAuthHandlerRegistryFactory* http_auth_handler_registry_factory =
- HttpAuthHandlerRegistryFactory::CreateDefault(context->host_resolver());
+ scoped_ptr<HttpAuthHandlerRegistryFactory> http_auth_handler_registry_factory(
+ HttpAuthHandlerRegistryFactory::CreateDefault(context->host_resolver()));
for (size_t i = 0; i < extra_http_auth_handlers_.size(); ++i) {
http_auth_handler_registry_factory->RegisterSchemeFactory(
extra_http_auth_handlers_[i].scheme,
extra_http_auth_handlers_[i].factory);
}
- storage->set_http_auth_handler_factory(http_auth_handler_registry_factory);
+ storage->set_http_auth_handler_factory(
+ http_auth_handler_registry_factory.Pass());
if (cookie_store_) {
storage->set_cookie_store(cookie_store_.get());
@@ -340,7 +341,8 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
scoped_ptr<net::SdchManager>(new SdchManager()).Pass());
}
- storage->set_transport_security_state(new TransportSecurityState());
+ storage->set_transport_security_state(
+ make_scoped_ptr(new TransportSecurityState()));
if (!transport_security_persister_path_.empty()) {
context->set_transport_security_persister(
make_scoped_ptr<TransportSecurityPersister>(
@@ -359,11 +361,15 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
storage->set_cert_verifier(CertVerifier::CreateDefault());
- if (throttling_enabled_)
- storage->set_throttler_manager(new URLRequestThrottlerManager());
+ if (throttling_enabled_) {
+ storage->set_throttler_manager(
+ make_scoped_ptr(new URLRequestThrottlerManager()));
+ }
- if (backoff_enabled_)
- storage->set_backoff_manager(new URLRequestBackoffManager());
+ if (backoff_enabled_) {
+ storage->set_backoff_manager(
+ make_scoped_ptr(new URLRequestBackoffManager()));
+ }
HttpNetworkSession::Params network_session_params;
SetHttpNetworkSessionComponents(context.get(), &network_session_params);
@@ -387,7 +393,7 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
network_session_params.quic_connection_options =
http_network_session_params_.quic_connection_options;
- HttpTransactionFactory* http_transaction_factory = NULL;
+ scoped_ptr<HttpTransactionFactory> http_transaction_factory;
if (http_cache_enabled_) {
HttpCache::BackendFactory* http_cache_backend = NULL;
if (http_cache_params_.type == HttpCacheParams::DISK) {
@@ -399,15 +405,15 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size);
}
- http_transaction_factory = new HttpCache(
- network_session_params, http_cache_backend);
+ http_transaction_factory.reset(
+ new HttpCache(network_session_params, http_cache_backend));
} else {
scoped_refptr<HttpNetworkSession> network_session(
new HttpNetworkSession(network_session_params));
- http_transaction_factory = new HttpNetworkLayer(network_session.get());
+ http_transaction_factory.reset(new HttpNetworkLayer(network_session.get()));
}
- storage->set_http_transaction_factory(http_transaction_factory);
+ storage->set_http_transaction_factory(http_transaction_factory.Pass());
URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl;
if (data_enabled_)
@@ -444,7 +450,7 @@ scoped_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
}
url_request_interceptors_.weak_clear();
}
- storage->set_job_factory(top_job_factory.release());
+ storage->set_job_factory(top_job_factory.Pass());
// TODO(willchan): Support sdch.
return context.Pass();
diff --git a/net/url_request/url_request_context_storage.cc b/net/url_request/url_request_context_storage.cc
index b334632..451fa96 100644
--- a/net/url_request/url_request_context_storage.cc
+++ b/net/url_request/url_request_context_storage.cc
@@ -32,9 +32,9 @@ URLRequestContextStorage::URLRequestContextStorage(URLRequestContext* context)
URLRequestContextStorage::~URLRequestContextStorage() {}
-void URLRequestContextStorage::set_net_log(NetLog* net_log) {
- context_->set_net_log(net_log);
- net_log_.reset(net_log);
+void URLRequestContextStorage::set_net_log(scoped_ptr<NetLog> net_log) {
+ context_->set_net_log(net_log.get());
+ net_log_ = net_log.Pass();
}
void URLRequestContextStorage::set_host_resolver(
@@ -43,9 +43,10 @@ void URLRequestContextStorage::set_host_resolver(
host_resolver_ = host_resolver.Pass();
}
-void URLRequestContextStorage::set_cert_verifier(CertVerifier* cert_verifier) {
- context_->set_cert_verifier(cert_verifier);
- cert_verifier_.reset(cert_verifier);
+void URLRequestContextStorage::set_cert_verifier(
+ scoped_ptr<CertVerifier> cert_verifier) {
+ context_->set_cert_verifier(cert_verifier.get());
+ cert_verifier_ = cert_verifier.Pass();
}
void URLRequestContextStorage::set_channel_id_service(
@@ -55,14 +56,15 @@ void URLRequestContextStorage::set_channel_id_service(
}
void URLRequestContextStorage::set_http_auth_handler_factory(
- HttpAuthHandlerFactory* http_auth_handler_factory) {
- context_->set_http_auth_handler_factory(http_auth_handler_factory);
- http_auth_handler_factory_.reset(http_auth_handler_factory);
+ scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory) {
+ context_->set_http_auth_handler_factory(http_auth_handler_factory.get());
+ http_auth_handler_factory_ = http_auth_handler_factory.Pass();
}
-void URLRequestContextStorage::set_proxy_service(ProxyService* proxy_service) {
- context_->set_proxy_service(proxy_service);
- proxy_service_.reset(proxy_service);
+void URLRequestContextStorage::set_proxy_service(
+ scoped_ptr<ProxyService> proxy_service) {
+ context_->set_proxy_service(proxy_service.get());
+ proxy_service_ = proxy_service.Pass();
}
void URLRequestContextStorage::set_ssl_config_service(
@@ -72,9 +74,9 @@ void URLRequestContextStorage::set_ssl_config_service(
}
void URLRequestContextStorage::set_network_delegate(
- NetworkDelegate* network_delegate) {
- context_->set_network_delegate(network_delegate);
- network_delegate_.reset(network_delegate);
+ scoped_ptr<NetworkDelegate> network_delegate) {
+ context_->set_network_delegate(network_delegate.get());
+ network_delegate_ = network_delegate.Pass();
}
void URLRequestContextStorage::set_http_server_properties(
@@ -89,39 +91,39 @@ void URLRequestContextStorage::set_cookie_store(CookieStore* cookie_store) {
}
void URLRequestContextStorage::set_transport_security_state(
- TransportSecurityState* transport_security_state) {
- context_->set_transport_security_state(transport_security_state);
- transport_security_state_.reset(transport_security_state);
+ scoped_ptr<TransportSecurityState> transport_security_state) {
+ context_->set_transport_security_state(transport_security_state.get());
+ transport_security_state_ = transport_security_state.Pass();
}
void URLRequestContextStorage::set_http_transaction_factory(
- HttpTransactionFactory* http_transaction_factory) {
- context_->set_http_transaction_factory(http_transaction_factory);
- http_transaction_factory_.reset(http_transaction_factory);
+ scoped_ptr<HttpTransactionFactory> http_transaction_factory) {
+ context_->set_http_transaction_factory(http_transaction_factory.get());
+ http_transaction_factory_ = http_transaction_factory.Pass();
}
void URLRequestContextStorage::set_job_factory(
- URLRequestJobFactory* job_factory) {
- context_->set_job_factory(job_factory);
- job_factory_.reset(job_factory);
+ scoped_ptr<URLRequestJobFactory> job_factory) {
+ context_->set_job_factory(job_factory.get());
+ job_factory_ = job_factory.Pass();
}
void URLRequestContextStorage::set_throttler_manager(
- URLRequestThrottlerManager* throttler_manager) {
- context_->set_throttler_manager(throttler_manager);
- throttler_manager_.reset(throttler_manager);
+ scoped_ptr<URLRequestThrottlerManager> throttler_manager) {
+ context_->set_throttler_manager(throttler_manager.get());
+ throttler_manager_ = throttler_manager.Pass();
}
void URLRequestContextStorage::set_backoff_manager(
- URLRequestBackoffManager* backoff_manager) {
- context_->set_backoff_manager(backoff_manager);
- backoff_manager_.reset(backoff_manager);
+ scoped_ptr<URLRequestBackoffManager> backoff_manager) {
+ context_->set_backoff_manager(backoff_manager.get());
+ backoff_manager_ = backoff_manager.Pass();
}
void URLRequestContextStorage::set_http_user_agent_settings(
- HttpUserAgentSettings* http_user_agent_settings) {
- context_->set_http_user_agent_settings(http_user_agent_settings);
- http_user_agent_settings_.reset(http_user_agent_settings);
+ scoped_ptr<HttpUserAgentSettings> http_user_agent_settings) {
+ context_->set_http_user_agent_settings(http_user_agent_settings.get());
+ http_user_agent_settings_ = http_user_agent_settings.Pass();
}
void URLRequestContextStorage::set_sdch_manager(
diff --git a/net/url_request/url_request_context_storage.h b/net/url_request/url_request_context_storage.h
index fd3c4a2..8e2bf0e 100644
--- a/net/url_request/url_request_context_storage.h
+++ b/net/url_request/url_request_context_storage.h
@@ -45,27 +45,29 @@ class NET_EXPORT URLRequestContextStorage {
// These setters will set both the member variables and call the setter on the
// URLRequestContext object. In all cases, ownership is passed to |this|.
- void set_net_log(NetLog* net_log);
+ void set_net_log(scoped_ptr<NetLog> net_log);
void set_host_resolver(scoped_ptr<HostResolver> host_resolver);
- void set_cert_verifier(CertVerifier* cert_verifier);
+ void set_cert_verifier(scoped_ptr<CertVerifier> cert_verifier);
void set_channel_id_service(scoped_ptr<ChannelIDService> channel_id_service);
void set_http_auth_handler_factory(
- HttpAuthHandlerFactory* http_auth_handler_factory);
- void set_proxy_service(ProxyService* proxy_service);
+ scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory);
+ void set_proxy_service(scoped_ptr<ProxyService> proxy_service);
void set_ssl_config_service(SSLConfigService* ssl_config_service);
- void set_network_delegate(NetworkDelegate* network_delegate);
+ void set_network_delegate(scoped_ptr<NetworkDelegate> network_delegate);
void set_http_server_properties(
scoped_ptr<HttpServerProperties> http_server_properties);
void set_cookie_store(CookieStore* cookie_store);
void set_transport_security_state(
- TransportSecurityState* transport_security_state);
+ scoped_ptr<TransportSecurityState> transport_security_state);
void set_http_transaction_factory(
- HttpTransactionFactory* http_transaction_factory);
- void set_job_factory(URLRequestJobFactory* job_factory);
- void set_throttler_manager(URLRequestThrottlerManager* throttler_manager);
- void set_backoff_manager(URLRequestBackoffManager* backoff_manager);
+ scoped_ptr<HttpTransactionFactory> http_transaction_factory);
+ void set_job_factory(scoped_ptr<URLRequestJobFactory> job_factory);
+ void set_throttler_manager(
+ scoped_ptr<URLRequestThrottlerManager> throttler_manager);
+ void set_backoff_manager(
+ scoped_ptr<URLRequestBackoffManager> backoff_manager);
void set_http_user_agent_settings(
- HttpUserAgentSettings* http_user_agent_settings);
+ scoped_ptr<HttpUserAgentSettings> http_user_agent_settings);
void set_sdch_manager(scoped_ptr<SdchManager> sdch_manager);
private:
diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc
index 093b74a..3e388c5 100644
--- a/net/url_request/url_request_ftp_job_unittest.cc
+++ b/net/url_request/url_request_ftp_job_unittest.cc
@@ -48,18 +48,19 @@ class MockProxyResolverFactory : public ProxyResolverFactory {
class FtpTestURLRequestContext : public TestURLRequestContext {
public:
FtpTestURLRequestContext(ClientSocketFactory* socket_factory,
- ProxyService* proxy_service,
+ scoped_ptr<ProxyService> proxy_service,
NetworkDelegate* network_delegate,
FtpTransactionFactory* ftp_transaction_factory)
: TestURLRequestContext(true),
ftp_protocol_handler_(new FtpProtocolHandler(ftp_transaction_factory)) {
set_client_socket_factory(socket_factory);
- context_storage_.set_proxy_service(proxy_service);
+ context_storage_.set_proxy_service(proxy_service.Pass());
set_network_delegate(network_delegate);
- URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl;
+ scoped_ptr<URLRequestJobFactoryImpl> job_factory =
+ make_scoped_ptr(new URLRequestJobFactoryImpl);
job_factory->SetProtocolHandler("ftp",
make_scoped_ptr(ftp_protocol_handler_));
- context_storage_.set_job_factory(job_factory);
+ context_storage_.set_job_factory(job_factory.Pass());
Init();
}
@@ -67,8 +68,8 @@ class FtpTestURLRequestContext : public TestURLRequestContext {
return ftp_protocol_handler_->ftp_auth_cache_.get();
}
- void set_proxy_service(ProxyService* proxy_service) {
- context_storage_.set_proxy_service(proxy_service);
+ void set_proxy_service(scoped_ptr<ProxyService> proxy_service) {
+ context_storage_.set_proxy_service(proxy_service.Pass());
}
private:
@@ -226,12 +227,12 @@ TEST_F(URLRequestFtpJobPriorityTest, SetSubsequentTransactionPriority) {
class URLRequestFtpJobTest : public testing::Test {
public:
URLRequestFtpJobTest()
- : request_context_(&socket_factory_,
- new ProxyService(
- new SimpleProxyConfigService, NULL, NULL),
- &network_delegate_,
- &ftp_transaction_factory_) {
- }
+ : request_context_(
+ &socket_factory_,
+ make_scoped_ptr(
+ new ProxyService(new SimpleProxyConfigService, NULL, NULL)),
+ &network_delegate_,
+ &ftp_transaction_factory_) {}
~URLRequestFtpJobTest() override {
// Clean up any remaining tasks that mess up unrelated tests.
@@ -295,10 +296,10 @@ TEST_F(URLRequestFtpJobTest, FtpProxyRequest) {
// Regression test for http://crbug.com/237526 .
TEST_F(URLRequestFtpJobTest, FtpProxyRequestOrphanJob) {
// Use a PAC URL so that URLRequestFtpJob's |pac_request_| field is non-NULL.
- request_context()->set_proxy_service(new ProxyService(
+ request_context()->set_proxy_service(make_scoped_ptr(new ProxyService(
new ProxyConfigServiceFixed(
ProxyConfig::CreateFromCustomPacURL(GURL("http://foo"))),
- make_scoped_ptr(new MockProxyResolverFactory), NULL));
+ make_scoped_ptr(new MockProxyResolverFactory), NULL)));
TestDelegate request_delegate;
scoped_ptr<URLRequest> url_request(request_context()->CreateRequest(
diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc
index 2692034..af8d139 100644
--- a/net/url_request/url_request_test_util.cc
+++ b/net/url_request/url_request_test_util.cc
@@ -79,9 +79,10 @@ void TestURLRequestContext::Init() {
if (!cert_verifier())
context_storage_.set_cert_verifier(CertVerifier::CreateDefault());
if (!transport_security_state())
- context_storage_.set_transport_security_state(new TransportSecurityState);
+ context_storage_.set_transport_security_state(
+ make_scoped_ptr(new TransportSecurityState()));
if (!ssl_config_service())
- context_storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
+ context_storage_.set_ssl_config_service(new SSLConfigServiceDefaults());
if (!http_auth_handler_factory()) {
context_storage_.set_http_auth_handler_factory(
HttpAuthHandlerFactory::CreateDefault(host_resolver()));
@@ -90,10 +91,6 @@ void TestURLRequestContext::Init() {
context_storage_.set_http_server_properties(
scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
}
- if (!transport_security_state()) {
- context_storage_.set_transport_security_state(
- new TransportSecurityState());
- }
if (http_transaction_factory()) {
// Make sure we haven't been passed an object we're not going to use.
EXPECT_FALSE(client_socket_factory_);
@@ -111,9 +108,10 @@ void TestURLRequestContext::Init() {
params.network_delegate = network_delegate();
params.http_server_properties = http_server_properties();
params.net_log = net_log();
- context_storage_.set_http_transaction_factory(new HttpCache(
- new HttpNetworkSession(params),
- HttpCache::DefaultBackend::InMemory(0)));
+ context_storage_.set_http_transaction_factory(
+ make_scoped_ptr(new HttpCache(new HttpNetworkSession(params),
+ HttpCache::DefaultBackend::InMemory(0)))
+ .Pass());
}
// In-memory cookie store.
if (!cookie_store())
@@ -126,10 +124,14 @@ void TestURLRequestContext::Init() {
}
if (!http_user_agent_settings()) {
context_storage_.set_http_user_agent_settings(
- new StaticHttpUserAgentSettings("en-us,fr", std::string()));
+ make_scoped_ptr(
+ new StaticHttpUserAgentSettings("en-us,fr", std::string()))
+ .Pass());
+ }
+ if (!job_factory()) {
+ context_storage_.set_job_factory(
+ make_scoped_ptr(new URLRequestJobFactoryImpl()).Pass());
}
- if (!job_factory())
- context_storage_.set_job_factory(new URLRequestJobFactoryImpl);
}
TestURLRequestContextGetter::TestURLRequestContextGetter(
diff --git a/net/websockets/websocket_test_util.cc b/net/websockets/websocket_test_util.cc
index 1df0552..fd5421a 100644
--- a/net/websockets/websocket_test_util.cc
+++ b/net/websockets/websocket_test_util.cc
@@ -164,7 +164,7 @@ void WebSocketTestURLRequestContextHost::AddSSLSocketDataProvider(
void WebSocketTestURLRequestContextHost::SetProxyConfig(
const std::string& proxy_rules) {
DCHECK(!url_request_context_initialized_);
- proxy_service_.reset(ProxyService::CreateFixed(proxy_rules));
+ proxy_service_ = ProxyService::CreateFixed(proxy_rules);
url_request_context_.set_proxy_service(proxy_service_.get());
}
diff --git a/remoting/host/token_validator_factory_impl_unittest.cc b/remoting/host/token_validator_factory_impl_unittest.cc
index 38a7e82..2b5e0aa 100644
--- a/remoting/host/token_validator_factory_impl_unittest.cc
+++ b/remoting/host/token_validator_factory_impl_unittest.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/json/json_writer.h"
+#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "net/http/http_status_code.h"
#include "net/url_request/url_request_job_factory.h"
@@ -55,11 +56,11 @@ class FakeProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
class SetResponseURLRequestContext: public net::TestURLRequestContext {
public:
void SetResponse(const std::string& headers, const std::string& response) {
- net::URLRequestJobFactoryImpl* factory =
- new net::URLRequestJobFactoryImpl();
+ scoped_ptr<net::URLRequestJobFactoryImpl> factory =
+ make_scoped_ptr(new net::URLRequestJobFactoryImpl());
factory->SetProtocolHandler(
"https", make_scoped_ptr(new FakeProtocolHandler(headers, response)));
- context_storage_.set_job_factory(factory);
+ context_storage_.set_job_factory(factory.Pass());
}
};
diff --git a/remoting/signaling/xmpp_signal_strategy.cc b/remoting/signaling/xmpp_signal_strategy.cc
index 5edbb37..e107ec8 100644
--- a/remoting/signaling/xmpp_signal_strategy.cc
+++ b/remoting/signaling/xmpp_signal_strategy.cc
@@ -287,7 +287,7 @@ void XmppSignalStrategy::Core::StartTls() {
new net::ClientSocketHandle());
socket_handle->SetSocket(socket_.Pass());
- cert_verifier_.reset(net::CertVerifier::CreateDefault());
+ cert_verifier_ = net::CertVerifier::CreateDefault();
transport_security_state_.reset(new net::TransportSecurityState());
net::SSLClientSocketContext context;
context.cert_verifier = cert_verifier_.get();
diff --git a/sync/tools/sync_client.cc b/sync/tools/sync_client.cc
index 5999e11..d64041f 100644
--- a/sync/tools/sync_client.cc
+++ b/sync/tools/sync_client.cc
@@ -75,7 +75,7 @@ class MyTestURLRequestContext : public net::TestURLRequestContext {
context_storage_.set_host_resolver(
net::HostResolver::CreateDefaultResolver(NULL));
context_storage_.set_transport_security_state(
- new net::TransportSecurityState());
+ make_scoped_ptr(new net::TransportSecurityState()));
Init();
}
diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc
index 2cdd4df..3a1d808 100644
--- a/sync/tools/sync_listen_notifications.cc
+++ b/sync/tools/sync_listen_notifications.cc
@@ -81,7 +81,7 @@ class MyTestURLRequestContext : public net::TestURLRequestContext {
context_storage_.set_host_resolver(
net::HostResolver::CreateDefaultResolver(NULL));
context_storage_.set_transport_security_state(
- new net::TransportSecurityState());
+ make_scoped_ptr(new net::TransportSecurityState()));
Init();
}