diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-27 21:37:12 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-27 21:37:12 +0000 |
commit | 6104ea5d0b3eb19a923ae94a5f7fcae8e0e091e2 (patch) | |
tree | 93a11c09778f638718cd19be3249e54defd1f90f | |
parent | 418e953e7285de2f29f6523c741cbca951f26562 (diff) | |
download | chromium_src-6104ea5d0b3eb19a923ae94a5f7fcae8e0e091e2.zip chromium_src-6104ea5d0b3eb19a923ae94a5f7fcae8e0e091e2.tar.gz chromium_src-6104ea5d0b3eb19a923ae94a5f7fcae8e0e091e2.tar.bz2 |
Stop refcounting ProxyService.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6873096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83222 0039d316-1c4b-4281-b951-d872f2087c98
37 files changed, 320 insertions, 334 deletions
diff --git a/chrome/browser/automation/automation_util.cc b/chrome/browser/automation/automation_util.cc index 89224ef..2291a37 100644 --- a/chrome/browser/automation/automation_util.cc +++ b/chrome/browser/automation/automation_util.cc @@ -7,6 +7,7 @@ #include <string> #include "base/memory/scoped_ptr.h" +#include "base/synchronization/waitable_event.h" #include "base/time.h" #include "base/values.h" #include "chrome/browser/automation/automation_provider.h" diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index 5045ba9..cda8366 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -54,6 +54,7 @@ #include "googleurl/src/gurl.h" #include "net/base/cookie_store.h" #include "net/proxy/proxy_config_service.h" +#include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" #include "views/widget/widget_gtk.h" diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index fd3b443..faef46c 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -40,7 +40,6 @@ #include "net/base/host_resolver_impl.h" #include "net/base/mapped_host_resolver.h" #include "net/base/net_util.h" -#include "net/proxy/proxy_config_service.h" #include "net/ftp/ftp_network_layer.h" #include "net/http/http_auth_filter.h" #include "net/http/http_auth_handler_factory.h" @@ -49,7 +48,9 @@ #if defined(USE_NSS) #include "net/ocsp/nss_ocsp.h" #endif // defined(USE_NSS) +#include "net/proxy/proxy_config_service.h" #include "net/proxy/proxy_script_fetcher_impl.h" +#include "net/proxy/proxy_service.h" #include "webkit/glue/webkit_glue.h" namespace { @@ -428,8 +429,8 @@ void IOThread::Init() { globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( globals_->host_resolver.get())); // For the ProxyScriptFetcher, we use a direct ProxyService. - globals_->proxy_script_fetcher_proxy_service = - net::ProxyService::CreateDirectWithNetLog(net_log_); + globals_->proxy_script_fetcher_proxy_service.reset( + net::ProxyService::CreateDirectWithNetLog(net_log_)); net::HttpNetworkSession::Params session_params; session_params.host_resolver = globals_->host_resolver.get(); session_params.cert_verifier = globals_->cert_verifier.get(); @@ -625,16 +626,16 @@ void IOThread::ClearHostCache() { void IOThread::InitSystemRequestContext() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(!globals_->system_proxy_service); + DCHECK(!globals_->system_proxy_service.get()); DCHECK(system_proxy_config_service_.get()); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - globals_->system_proxy_service = + globals_->system_proxy_service.reset( ProxyServiceFactory::CreateProxyService( net_log_, globals_->proxy_script_fetcher_context, system_proxy_config_service_.release(), - command_line); + command_line)); net::HttpNetworkSession::Params system_params; system_params.host_resolver = globals_->host_resolver.get(); system_params.cert_verifier = globals_->cert_verifier.get(); diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index 050067b..a989c93 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h @@ -59,16 +59,16 @@ class IOThread : public BrowserProcessSubThread { scoped_ptr<net::DnsRRResolver> dnsrr_resolver; scoped_refptr<net::SSLConfigService> ssl_config_service; scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; - scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service; + scoped_ptr<net::ProxyService> proxy_script_fetcher_proxy_service; scoped_ptr<net::HttpTransactionFactory> proxy_script_fetcher_http_transaction_factory; scoped_ptr<net::FtpTransactionFactory> proxy_script_fetcher_ftp_transaction_factory; scoped_ptr<net::URLSecurityManager> url_security_manager; scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; + scoped_ptr<net::ProxyService> system_proxy_service; scoped_ptr<net::HttpTransactionFactory> system_http_transaction_factory; scoped_ptr<net::FtpTransactionFactory> system_ftp_transaction_factory; - scoped_refptr<net::ProxyService> system_proxy_service; // NOTE(willchan): This request context is unusable until a system // SSLConfigService is provided that doesn't rely on // Profiles. Do NOT use this yet. diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc index 80a884e..241d0d0 100644 --- a/chrome/browser/memory_purger.cc +++ b/chrome/browser/memory_purger.cc @@ -20,6 +20,7 @@ #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/common/notification_service.h" #include "net/proxy/proxy_resolver.h" +#include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index 53d8490..c90a9d2 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -6,6 +6,7 @@ #include "base/message_loop.h" #include "base/message_loop_proxy.h" +#include "base/synchronization/waitable_event.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/io_thread.h" #include "chrome/browser/profiles/profile.h" diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index b8f1582..3bfeaf40 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -28,16 +28,19 @@ class ChromeURLDataManagerBackend; class ChromeURLRequestContextFactory; class IOThread; +class PrefService; +class Profile; +class ProfileIOData; +namespace base { +class WaitableEvent; +} namespace net { class DnsCertProvenanceChecker; class NetworkDelegate; } -class PrefService; namespace prerender { class PrerenderManager; } -class Profile; -class ProfileIOData; // Subclass of net::URLRequestContext which can be used to store extra // information for requests. diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc index e046ac1..47023e3 100644 --- a/chrome/browser/net/connection_tester.cc +++ b/chrome/browser/net/connection_tester.cc @@ -28,8 +28,10 @@ #include "net/http/http_network_session.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_script_fetcher_impl.h" +#include "net/proxy/proxy_service.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_storage.h" namespace { @@ -42,62 +44,58 @@ class ExperimentURLRequestContext : public net::URLRequestContext { public: explicit ExperimentURLRequestContext( net::URLRequestContext* proxy_request_context) - : proxy_request_context_(proxy_request_context) {} + : proxy_request_context_(proxy_request_context), + ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) {} int Init(const ConnectionTester::Experiment& experiment) { int rv; // Create a custom HostResolver for this experiment. - net::HostResolver* host_resolver_tmp = NULL; + scoped_ptr<net::HostResolver> host_resolver_tmp; rv = CreateHostResolver(experiment.host_resolver_experiment, &host_resolver_tmp); if (rv != net::OK) return rv; // Failure. - set_host_resolver(host_resolver_tmp); + storage_.set_host_resolver(host_resolver_tmp.release()); // Create a custom ProxyService for this this experiment. - scoped_refptr<net::ProxyService> proxy_service_tmp = NULL; + scoped_ptr<net::ProxyService> proxy_service_tmp; rv = CreateProxyService(experiment.proxy_settings_experiment, &proxy_service_tmp); if (rv != net::OK) return rv; // Failure. - set_proxy_service(proxy_service_tmp); + storage_.set_proxy_service(proxy_service_tmp.release()); // The rest of the dependencies are standard, and don't depend on the // experiment being run. - set_cert_verifier(new net::CertVerifier); - set_dnsrr_resolver(new net::DnsRRResolver); - set_ftp_transaction_factory(new net::FtpNetworkLayer(host_resolver_tmp)); - set_ssl_config_service(new net::SSLConfigServiceDefaults); - set_http_auth_handler_factory(net::HttpAuthHandlerFactory::CreateDefault( - host_resolver_tmp)); + storage_.set_cert_verifier(new net::CertVerifier); + storage_.set_dnsrr_resolver(new net::DnsRRResolver); + storage_.set_ftp_transaction_factory( + new net::FtpNetworkLayer(host_resolver())); + storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); + storage_.set_http_auth_handler_factory( + net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); net::HttpNetworkSession::Params session_params; - session_params.host_resolver = host_resolver_tmp; + session_params.host_resolver = host_resolver(); session_params.dnsrr_resolver = dnsrr_resolver(); session_params.cert_verifier = cert_verifier(); - session_params.proxy_service = proxy_service_tmp; + session_params.proxy_service = proxy_service(); session_params.http_auth_handler_factory = http_auth_handler_factory(); session_params.ssl_config_service = ssl_config_service(); scoped_refptr<net::HttpNetworkSession> network_session( new net::HttpNetworkSession(session_params)); - set_http_transaction_factory(new net::HttpCache( + storage_.set_http_transaction_factory(new net::HttpCache( network_session, net::HttpCache::DefaultBackend::InMemory(0))); // In-memory cookie store. - set_cookie_store(new net::CookieMonster(NULL, NULL)); + storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); return net::OK; } protected: virtual ~ExperimentURLRequestContext() { - delete ftp_transaction_factory(); - delete http_transaction_factory(); - delete http_auth_handler_factory(); - delete dnsrr_resolver(); - delete cert_verifier(); - delete host_resolver(); } private: @@ -106,13 +104,13 @@ class ExperimentURLRequestContext : public net::URLRequestContext { // error code. int CreateHostResolver( ConnectionTester::HostResolverExperiment experiment, - net::HostResolver** host_resolver) { + scoped_ptr<net::HostResolver>* host_resolver) { // Create a vanilla HostResolver that disables caching. const size_t kMaxJobs = 50u; net::HostResolverImpl* impl = new net::HostResolverImpl(NULL, NULL, kMaxJobs, NULL); - *host_resolver = impl; + host_resolver->reset(impl); // Modify it slightly based on the experiment being run. switch (experiment) { @@ -170,7 +168,7 @@ class ExperimentURLRequestContext : public net::URLRequestContext { // error code. int CreateProxyService( ConnectionTester::ProxySettingsExperiment experiment, - scoped_refptr<net::ProxyService>* proxy_service) { + scoped_ptr<net::ProxyService>* proxy_service) { // Create an appropriate proxy config service. scoped_ptr<net::ProxyConfigService> config_service; int rv = CreateProxyConfigService(experiment, &config_service); @@ -184,12 +182,12 @@ class ExperimentURLRequestContext : public net::URLRequestContext { return net::ERR_NOT_IMPLEMENTED; } - *proxy_service = net::ProxyService::CreateUsingV8ProxyResolver( + proxy_service->reset(net::ProxyService::CreateUsingV8ProxyResolver( config_service.release(), 0u, new net::ProxyScriptFetcherImpl(proxy_request_context_), host_resolver(), - NULL); + NULL)); return net::OK; } @@ -235,6 +233,7 @@ class ExperimentURLRequestContext : public net::URLRequestContext { } const scoped_refptr<net::URLRequestContext> proxy_request_context_; + net::URLRequestContextStorage storage_; }; } // namespace diff --git a/chrome/browser/net/connection_tester_unittest.cc b/chrome/browser/net/connection_tester_unittest.cc index 4192495..457b850 100644 --- a/chrome/browser/net/connection_tester_unittest.cc +++ b/chrome/browser/net/connection_tester_unittest.cc @@ -16,6 +16,7 @@ #include "net/http/http_network_layer.h" #include "net/http/http_network_session.h" #include "net/proxy/proxy_config_service_fixed.h" +#include "net/proxy/proxy_service.h" #include "net/test/test_server.h" #include "net/url_request/url_request_context.h" #include "testing/gtest/include/gtest/gtest.h" @@ -105,7 +106,7 @@ class ConnectionTesterTest : public PlatformTest { net::MockHostResolver host_resolver_; net::CertVerifier cert_verifier_; net::DnsRRResolver dnsrr_resolver_; - scoped_refptr<net::ProxyService> proxy_service_; + scoped_ptr<net::ProxyService> proxy_service_; scoped_refptr<net::SSLConfigService> ssl_config_service_; scoped_ptr<net::HttpTransactionFactory> http_transaction_factory_; net::HttpAuthHandlerRegistryFactory http_auth_handler_factory_; @@ -118,8 +119,8 @@ class ConnectionTesterTest : public PlatformTest { proxy_script_fetcher_context_->set_dnsrr_resolver(&dnsrr_resolver_); proxy_script_fetcher_context_->set_http_auth_handler_factory( &http_auth_handler_factory_); - proxy_service_ = net::ProxyService::CreateDirect(); - proxy_script_fetcher_context_->set_proxy_service(proxy_service_); + proxy_service_.reset(net::ProxyService::CreateDirect()); + proxy_script_fetcher_context_->set_proxy_service(proxy_service_.get()); ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); net::HttpNetworkSession::Params session_params; session_params.host_resolver = &host_resolver_; @@ -127,7 +128,7 @@ class ConnectionTesterTest : public PlatformTest { session_params.dnsrr_resolver = &dnsrr_resolver_; session_params.http_auth_handler_factory = &http_auth_handler_factory_; session_params.ssl_config_service = ssl_config_service_; - session_params.proxy_service = proxy_service_; + session_params.proxy_service = proxy_service_.get(); scoped_refptr<net::HttpNetworkSession> network_session( new net::HttpNetworkSession(session_params)); http_transaction_factory_.reset( diff --git a/chrome/browser/net/proxy_service_factory.cc b/chrome/browser/net/proxy_service_factory.cc index 8a34ea9..ad9afd0 100644 --- a/chrome/browser/net/proxy_service_factory.cc +++ b/chrome/browser/net/proxy_service_factory.cc @@ -14,6 +14,7 @@ #include "net/base/net_log.h" #include "net/proxy/proxy_config_service.h" #include "net/proxy/proxy_script_fetcher_impl.h" +#include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" #if defined(OS_CHROMEOS) diff --git a/chrome/browser/net/resolve_proxy_msg_helper.cc b/chrome/browser/net/resolve_proxy_msg_helper.cc index b2ad9f9..49ce3e4 100644 --- a/chrome/browser/net/resolve_proxy_msg_helper.cc +++ b/chrome/browser/net/resolve_proxy_msg_helper.cc @@ -82,8 +82,7 @@ void ResolveProxyMsgHelper::StartPendingRequest() { OnResolveProxyCompleted(result); } -bool ResolveProxyMsgHelper::GetProxyService( - scoped_refptr<net::ProxyService>* out) const { +bool ResolveProxyMsgHelper::GetProxyService(net::ProxyService** out) const { // Unit-tests specify their own proxy service to use. if (proxy_service_override_) { *out = proxy_service_override_; @@ -102,8 +101,10 @@ bool ResolveProxyMsgHelper::GetProxyService( } ResolveProxyMsgHelper::~ResolveProxyMsgHelper() { - // Clear all pending requests. - if (!pending_requests_.empty()) { + // Clear all pending requests if the ProxyService is still alive (if we have a + // default request context or override). + if (!pending_requests_.empty() && + (Profile::GetDefaultRequestContext() || proxy_service_override_)) { PendingRequest req = pending_requests_.front(); proxy_service_->CancelPacRequest(req.pac_req); } diff --git a/chrome/browser/net/resolve_proxy_msg_helper.h b/chrome/browser/net/resolve_proxy_msg_helper.h index ac20c96..95ebaf9 100644 --- a/chrome/browser/net/resolve_proxy_msg_helper.h +++ b/chrome/browser/net/resolve_proxy_msg_helper.h @@ -50,7 +50,7 @@ class ResolveProxyMsgHelper : public BrowserMessageFilter { // Get the proxy service instance to use. On success returns true and // sets |*out|. Otherwise returns false. - bool GetProxyService(scoped_refptr<net::ProxyService>* out) const; + bool GetProxyService(net::ProxyService** out) const; // A PendingRequest is a resolve request that is in progress, or queued. struct PendingRequest { @@ -69,7 +69,7 @@ class ResolveProxyMsgHelper : public BrowserMessageFilter { }; // Members for the current outstanding proxy request. - scoped_refptr<net::ProxyService> proxy_service_; + net::ProxyService* proxy_service_; net::CompletionCallbackImpl<ResolveProxyMsgHelper> callback_; net::ProxyInfo proxy_info_; @@ -79,7 +79,7 @@ class ResolveProxyMsgHelper : public BrowserMessageFilter { // Specified by unit-tests, to use this proxy service in place of the // global one. - scoped_refptr<net::ProxyService> proxy_service_override_; + net::ProxyService* proxy_service_override_; }; #endif // CHROME_BROWSER_NET_RESOLVE_PROXY_MSG_HELPER_H_ diff --git a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc index bb3c1d8..a32ab78 100644 --- a/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc +++ b/chrome/browser/net/resolve_proxy_msg_helper_unittest.cc @@ -9,6 +9,7 @@ #include "net/base/net_errors.h" #include "net/proxy/mock_proxy_resolver.h" #include "net/proxy/proxy_config_service.h" +#include "net/proxy/proxy_service.h" #include "testing/gtest/include/gtest/gtest.h" // This ProxyConfigService always returns "http://pac" as the PAC url to use. @@ -61,7 +62,7 @@ class ResolveProxyMsgHelperTest : public testing::Test, } net::MockAsyncProxyResolver* resolver_; - scoped_refptr<net::ProxyService> service_; + scoped_ptr<net::ProxyService> service_; scoped_refptr<ResolveProxyMsgHelper> helper_; scoped_ptr<PendingResult> pending_result_; diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 16c3c88..2eb46b6 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -302,12 +302,12 @@ void ProfileIOData::LazyInitialize() const { CreateDnsCertProvenanceChecker(io_thread_globals->dnsrr_resolver.get(), main_request_context_)); - proxy_service_ = + proxy_service_.reset( ProxyServiceFactory::CreateProxyService( io_thread->net_log(), io_thread_globals->proxy_script_fetcher_context.get(), profile_params_->proxy_config_service.release(), - command_line); + command_line)); // Take ownership over these parameters. database_tracker_ = profile_params_->database_tracker; diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h index ce5f954..544e9f4 100644 --- a/chrome/browser/profiles/profile_io_data.h +++ b/chrome/browser/profiles/profile_io_data.h @@ -213,7 +213,7 @@ class ProfileIOData : public base::RefCountedThreadSafe<ProfileIOData> { // Pointed to by URLRequestContext. mutable scoped_ptr<net::NetworkDelegate> network_delegate_; mutable scoped_ptr<net::DnsCertProvenanceChecker> dns_cert_checker_; - mutable scoped_refptr<net::ProxyService> proxy_service_; + mutable scoped_ptr<net::ProxyService> proxy_service_; mutable scoped_ptr<net::CookiePolicy> cookie_policy_; // Pointed to by ResourceContext. diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc index b3f47f6..9e876d9 100644 --- a/chrome/service/net/service_url_request_context.cc +++ b/chrome/service/net/service_url_request_context.cc @@ -8,6 +8,7 @@ #include <sys/utsname.h> #endif +#include "base/compiler_specific.h" #include "base/message_loop_proxy.h" #include "base/string_util.h" #include "base/sys_info.h" @@ -105,17 +106,20 @@ std::string MakeUserAgentForServiceProcess() { ServiceURLRequestContext::ServiceURLRequestContext( const std::string& user_agent, - net::ProxyService* net_proxy_service) : user_agent_(user_agent) { - set_host_resolver( + net::ProxyService* net_proxy_service) + : user_agent_(user_agent), + ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { + storage_.set_host_resolver( net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, NULL)); - set_proxy_service(net_proxy_service); - set_cert_verifier(new net::CertVerifier); - set_dnsrr_resolver(new net::DnsRRResolver); - set_ftp_transaction_factory(new net::FtpNetworkLayer(host_resolver())); - set_ssl_config_service(new net::SSLConfigServiceDefaults); - set_http_auth_handler_factory(net::HttpAuthHandlerFactory::CreateDefault( - host_resolver())); + storage_.set_proxy_service(net_proxy_service); + storage_.set_cert_verifier(new net::CertVerifier); + storage_.set_dnsrr_resolver(new net::DnsRRResolver); + storage_.set_ftp_transaction_factory( + new net::FtpNetworkLayer(host_resolver())); + storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); + storage_.set_http_auth_handler_factory( + net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); net::HttpNetworkSession::Params session_params; session_params.host_resolver = host_resolver(); @@ -126,12 +130,12 @@ ServiceURLRequestContext::ServiceURLRequestContext( session_params.http_auth_handler_factory = http_auth_handler_factory(); scoped_refptr<net::HttpNetworkSession> network_session( new net::HttpNetworkSession(session_params)); - set_http_transaction_factory( + storage_.set_http_transaction_factory( new net::HttpCache( network_session, net::HttpCache::DefaultBackend::InMemory(0))); // In-memory cookie store. - set_cookie_store(new net::CookieMonster(NULL, NULL)); + storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); set_accept_language("en-us,fr"); set_accept_charset("iso-8859-1,*,utf-8"); } @@ -145,12 +149,6 @@ const std::string& ServiceURLRequestContext::GetUserAgent( } ServiceURLRequestContext::~ServiceURLRequestContext() { - delete ftp_transaction_factory(); - delete http_transaction_factory(); - delete http_auth_handler_factory(); - delete cert_verifier(); - delete dnsrr_resolver(); - delete host_resolver(); } ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() @@ -162,19 +160,23 @@ ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() #if defined(OS_LINUX) // Create the proxy service now, at initialization time, on the main thread, // only for Linux, which requires that. - CreateProxyService(); + CreateProxyConfigService(); #endif } net::URLRequestContext* ServiceURLRequestContextGetter::GetURLRequestContext() { #if !defined(OS_LINUX) - if (!proxy_service_) - CreateProxyService(); + if (!proxy_config_service_.get()) + CreateProxyConfigService(); #endif - if (!url_request_context_) + if (!url_request_context_) { + net::ProxyService* proxy_service = + net::ProxyService::CreateUsingSystemProxyResolver( + proxy_config_service_.release(), 0u, NULL); url_request_context_ = new ServiceURLRequestContext(user_agent_, - proxy_service_); + proxy_service); + } return url_request_context_; } @@ -185,14 +187,12 @@ ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const { ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {} -void ServiceURLRequestContextGetter::CreateProxyService() { +void ServiceURLRequestContextGetter::CreateProxyConfigService() { // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a // MessageLoopProxy* instead of MessageLoop*. DCHECK(g_service_process); - net::ProxyConfigService * proxy_config_service = + proxy_config_service_.reset( net::ProxyService::CreateSystemProxyConfigService( g_service_process->io_thread()->message_loop(), - g_service_process->file_thread()->message_loop()); - proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( - proxy_config_service, 0u, NULL); + g_service_process->file_thread()->message_loop())); } diff --git a/chrome/service/net/service_url_request_context.h b/chrome/service/net/service_url_request_context.h index 6d3463d..3cf286e 100644 --- a/chrome/service/net/service_url_request_context.h +++ b/chrome/service/net/service_url_request_context.h @@ -20,6 +20,7 @@ #include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" +#include "net/url_request/url_request_context_storage.h" namespace base { class MessageLoopProxy; @@ -31,6 +32,7 @@ class MessageLoopProxy; // class ServiceURLRequestContext : public net::URLRequestContext { public: + // This context takes ownership of |net_proxy_service|. explicit ServiceURLRequestContext(const std::string& user_agent, net::ProxyService* net_proxy_service); @@ -42,6 +44,7 @@ class ServiceURLRequestContext : public net::URLRequestContext { private: std::string user_agent_; + net::URLRequestContextStorage storage_; }; class ServiceURLRequestContextGetter : public net::URLRequestContextGetter { @@ -61,12 +64,12 @@ class ServiceURLRequestContextGetter : public net::URLRequestContextGetter { ServiceURLRequestContextGetter(); virtual ~ServiceURLRequestContextGetter(); - void CreateProxyService(); + void CreateProxyConfigService(); std::string user_agent_; scoped_refptr<net::URLRequestContext> url_request_context_; scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; - scoped_refptr<net::ProxyService> proxy_service_; + scoped_ptr<net::ProxyConfigService> proxy_config_service_; }; #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc index 5120fac..3bd6db8 100644 --- a/net/http/http_network_layer_unittest.cc +++ b/net/http/http_network_layer_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,7 +28,7 @@ class HttpNetworkLayerTest : public PlatformTest { session_params.client_socket_factory = &mock_socket_factory_; session_params.host_resolver = &host_resolver_; session_params.cert_verifier = &cert_verifier_; - session_params.proxy_service = proxy_service_; + session_params.proxy_service = proxy_service_.get(); session_params.ssl_config_service = ssl_config_service_; network_session_ = new HttpNetworkSession(session_params); factory_.reset(new HttpNetworkLayer(network_session_)); @@ -37,7 +37,7 @@ class HttpNetworkLayerTest : public PlatformTest { MockClientSocketFactory mock_socket_factory_; MockHostResolver host_resolver_; CertVerifier cert_verifier_; - const scoped_refptr<ProxyService> proxy_service_; + const scoped_ptr<ProxyService> proxy_service_; const scoped_refptr<SSLConfigService> ssl_config_service_; scoped_refptr<HttpNetworkSession> network_session_; scoped_ptr<HttpNetworkLayer> factory_; diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 14b85ae..1efc302 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -161,7 +161,7 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>, HttpAuthHandlerFactory* const http_auth_handler_factory_; // Not const since it's modified by HttpNetworkSessionPeer for testing. - scoped_refptr<ProxyService> proxy_service_; + ProxyService* proxy_service_; const scoped_refptr<SSLConfigService> ssl_config_service_; HttpAuthCache http_auth_cache_; diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index db490c1..64d53ba 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -94,7 +94,7 @@ struct SessionDependencies { scoped_ptr<MockHostResolverBase> host_resolver; scoped_ptr<CertVerifier> cert_verifier; - scoped_refptr<ProxyService> proxy_service; + scoped_ptr<ProxyService> proxy_service; scoped_refptr<SSLConfigService> ssl_config_service; MockClientSocketFactory socket_factory; scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; @@ -106,7 +106,7 @@ HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { params.client_socket_factory = &session_deps->socket_factory; params.host_resolver = session_deps->host_resolver.get(); params.cert_verifier = session_deps->cert_verifier.get(); - params.proxy_service = session_deps->proxy_service; + params.proxy_service = session_deps->proxy_service.get(); params.ssl_config_service = session_deps->ssl_config_service; params.http_auth_handler_factory = session_deps->http_auth_handler_factory.get(); @@ -7410,10 +7410,10 @@ TEST_F(HttpNetworkTransactionTest, GenerateAuthToken) { auth_factory->set_mock_handler(auth_handler, HttpAuth::AUTH_SERVER); } if (test_config.proxy_url) { - session_deps.proxy_service = - ProxyService::CreateFixed(test_config.proxy_url); + session_deps.proxy_service.reset( + ProxyService::CreateFixed(test_config.proxy_url)); } else { - session_deps.proxy_service = ProxyService::CreateDirect(); + session_deps.proxy_service.reset(ProxyService::CreateDirect()); } HttpRequestInfo request; @@ -7489,7 +7489,7 @@ TEST_F(HttpNetworkTransactionTest, MultiRoundAuth) { HttpAuthHandlerMock::Factory* auth_factory( new HttpAuthHandlerMock::Factory()); session_deps.http_auth_handler_factory.reset(auth_factory); - session_deps.proxy_service = ProxyService::CreateDirect(); + session_deps.proxy_service.reset(ProxyService::CreateDirect()); session_deps.host_resolver->rules()->AddRule("www.example.com", "10.0.0.1"); session_deps.host_resolver->set_synchronous_mode(true); diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc index fb6bef0..febd4c4 100644 --- a/net/http/http_proxy_client_socket_pool_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_unittest.cc @@ -180,7 +180,7 @@ class HttpProxyClientSocketPoolTest : public TestWithHttpParam { HttpNetworkSession::Params params; params.host_resolver = &host_resolver_; params.cert_verifier = &cert_verifier_; - params.proxy_service = proxy_service_; + params.proxy_service = proxy_service_.get(); params.client_socket_factory = &socket_factory_; params.ssl_config_service = ssl_config_service_; params.http_auth_handler_factory = http_auth_handler_factory_.get(); @@ -198,7 +198,7 @@ class HttpProxyClientSocketPoolTest : public TestWithHttpParam { ClientSocketPoolHistograms ssl_histograms_; MockHostResolver host_resolver_; CertVerifier cert_verifier_; - const scoped_refptr<ProxyService> proxy_service_; + const scoped_ptr<ProxyService> proxy_service_; const scoped_refptr<SSLConfigService> ssl_config_service_; SSLClientSocketPool ssl_socket_pool_; diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc index ea9d299..9feed17 100644 --- a/net/http/http_response_body_drainer_unittest.cc +++ b/net/http/http_response_body_drainer_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -185,12 +185,12 @@ class HttpResponseBodyDrainerTest : public testing::Test { HttpNetworkSession* CreateNetworkSession() const { HttpNetworkSession::Params params; - params.proxy_service = proxy_service_; + params.proxy_service = proxy_service_.get(); params.ssl_config_service = ssl_config_service_; return new HttpNetworkSession(params); } - scoped_refptr<ProxyService> proxy_service_; + scoped_ptr<ProxyService> proxy_service_; scoped_refptr<SSLConfigService> ssl_config_service_; const scoped_refptr<HttpNetworkSession> session_; CloseResultWaiter result_waiter_; diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index b37c173..3b76958 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc @@ -68,7 +68,7 @@ struct SessionDependencies { scoped_ptr<MockHostResolverBase> host_resolver; scoped_ptr<CertVerifier> cert_verifier; - scoped_refptr<ProxyService> proxy_service; + scoped_ptr<ProxyService> proxy_service; scoped_refptr<SSLConfigService> ssl_config_service; MockClientSocketFactory socket_factory; scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; @@ -79,7 +79,7 @@ HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { HttpNetworkSession::Params params; params.host_resolver = session_deps->host_resolver.get(); params.cert_verifier = session_deps->cert_verifier.get(); - params.proxy_service = session_deps->proxy_service; + params.proxy_service = session_deps->proxy_service.get(); params.ssl_config_service = session_deps->ssl_config_service; params.client_socket_factory = &session_deps->socket_factory; params.http_auth_handler_factory = diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc index 89db823..911022f 100644 --- a/net/proxy/proxy_script_fetcher_impl_unittest.cc +++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc @@ -16,6 +16,7 @@ #include "net/disk_cache/disk_cache.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" +#include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -39,14 +40,14 @@ struct FetchResult { // A non-mock URL request which can access http:// and file:// urls. class RequestContext : public URLRequestContext { public: - RequestContext() { + RequestContext() : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { ProxyConfig no_proxy; - set_host_resolver( + storage_.set_host_resolver( CreateSystemHostResolver(HostResolver::kDefaultParallelism, NULL)); - set_cert_verifier(new CertVerifier); - set_proxy_service(ProxyService::CreateFixed(no_proxy)); - set_ssl_config_service(new SSLConfigServiceDefaults); + storage_.set_cert_verifier(new CertVerifier); + storage_.set_proxy_service(ProxyService::CreateFixed(no_proxy)); + storage_.set_ssl_config_service(new SSLConfigServiceDefaults); HttpNetworkSession::Params params; params.host_resolver = host_resolver(); @@ -55,17 +56,16 @@ class RequestContext : public URLRequestContext { params.ssl_config_service = ssl_config_service(); scoped_refptr<HttpNetworkSession> network_session( new HttpNetworkSession(params)); - set_http_transaction_factory(new HttpCache( + storage_.set_http_transaction_factory(new HttpCache( network_session, HttpCache::DefaultBackend::InMemory(0))); } private: ~RequestContext() { - delete http_transaction_factory(); - delete cert_verifier(); - delete host_resolver(); } + + URLRequestContextStorage storage_; }; // Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest. diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h index 8146470..5f6cbf2 100644 --- a/net/proxy/proxy_service.h +++ b/net/proxy/proxy_service.h @@ -34,8 +34,7 @@ class URLRequestContext; // This class can be used to resolve the proxy server to use when loading a // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy // resolution. See ProxyResolverV8 for example. -class ProxyService : public base::RefCounted<ProxyService>, - public NetworkChangeNotifier::IPAddressObserver, +class ProxyService : public NetworkChangeNotifier::IPAddressObserver, public ProxyConfigService::Observer, public base::NonThreadSafe { public: @@ -46,6 +45,8 @@ class ProxyService : public base::RefCounted<ProxyService>, ProxyResolver* resolver, NetLog* net_log); + virtual ~ProxyService(); + // Used internally to handle PAC queries. // TODO(eroman): consider naming this simply "Request". class PacRequest; @@ -217,7 +218,6 @@ class ProxyService : public base::RefCounted<ProxyService>, #endif private: - friend class base::RefCounted<ProxyService>; FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); friend class PacRequest; @@ -235,8 +235,6 @@ class ProxyService : public base::RefCounted<ProxyService>, STATE_READY, }; - virtual ~ProxyService(); - // Resets all the variables associated with the current proxy configuration, // and rewinds the current state to |STATE_NONE|. Returns the previous value // of |current_state_|. If |reset_fetched_config| is true then diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc index 7326c67..4e6d38a 100644 --- a/net/proxy/proxy_service_unittest.cc +++ b/net/proxy/proxy_service_unittest.cc @@ -116,16 +116,15 @@ class MockProxyScriptFetcher : public ProxyScriptFetcher { TEST(ProxyServiceTest, Direct) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(new MockProxyConfigService( - ProxyConfig::CreateDirect()), resolver, NULL)); + ProxyService service(new MockProxyConfigService( + ProxyConfig::CreateDirect()), resolver, NULL); GURL url("http://www.google.com/"); ProxyInfo info; TestCompletionCallback callback; CapturingBoundNetLog log(CapturingNetLog::kUnbounded); - int rv = service->ResolveProxy(url, &info, &callback, NULL, log.bound()); + int rv = service.ResolveProxy(url, &info, &callback, NULL, log.bound()); EXPECT_EQ(OK, rv); EXPECT_TRUE(resolver->pending_requests().empty()); @@ -151,8 +150,7 @@ TEST(ProxyServiceTest, PAC) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); GURL url("http://www.google.com/"); @@ -160,7 +158,7 @@ TEST(ProxyServiceTest, PAC) { TestCompletionCallback callback; CapturingBoundNetLog log(CapturingNetLog::kUnbounded); - int rv = service->ResolveProxy(url, &info, &callback, NULL, log.bound()); + int rv = service.ResolveProxy(url, &info, &callback, NULL, log.bound()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -201,14 +199,13 @@ TEST(ProxyServiceTest, PAC_NoIdentityOrHash) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); GURL url("http://username:password@www.google.com/?ref#hash#hash"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(url, &info, &callback, NULL, BoundNetLog()); + int rv = service.ResolveProxy(url, &info, &callback, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -229,14 +226,13 @@ TEST(ProxyServiceTest, PAC_FailoverWithoutDirect) { new MockProxyConfigService("http://foopy/proxy.pac"); MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); GURL url("http://www.google.com/"); ProxyInfo info; TestCompletionCallback callback1; - int rv = service->ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); + int rv = service.ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -258,8 +254,8 @@ TEST(ProxyServiceTest, PAC_FailoverWithoutDirect) { // left to fallback to, since our proxy list was NOT terminated by // DIRECT. TestCompletionCallback callback2; - rv = service->ReconsiderProxyAfterError(url, &info, &callback2, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL, + BoundNetLog()); // ReconsiderProxyAfterError returns error indicating nothing left. EXPECT_EQ(ERR_FAILED, rv); EXPECT_TRUE(info.is_empty()); @@ -287,14 +283,13 @@ TEST(ProxyServiceTest, PAC_FailoverAfterDirect) { new MockProxyConfigService("http://foopy/proxy.pac"); MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); GURL url("http://www.google.com/"); ProxyInfo info; TestCompletionCallback callback1; - int rv = service->ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); + int rv = service.ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -314,31 +309,31 @@ TEST(ProxyServiceTest, PAC_FailoverAfterDirect) { // Fallback 1. TestCompletionCallback callback2; - rv = service->ReconsiderProxyAfterError(url, &info, &callback2, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foobar:10", info.proxy_server().ToURI()); // Fallback 2. TestCompletionCallback callback3; - rv = service->ReconsiderProxyAfterError(url, &info, &callback3, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback3, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); // Fallback 3. TestCompletionCallback callback4; - rv = service->ReconsiderProxyAfterError(url, &info, &callback4, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback4, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foobar:20", info.proxy_server().ToURI()); // Fallback 4 -- Nothing to fall back to! TestCompletionCallback callback5; - rv = service->ReconsiderProxyAfterError(url, &info, &callback5, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback5, NULL, + BoundNetLog()); EXPECT_EQ(ERR_FAILED, rv); EXPECT_TRUE(info.is_empty()); } @@ -353,14 +348,13 @@ TEST(ProxyServiceTest, ProxyResolverFails) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); // Start first resolve request. GURL url("http://www.google.com/"); ProxyInfo info; TestCompletionCallback callback1; - int rv = service->ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); + int rv = service.ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -381,7 +375,7 @@ TEST(ProxyServiceTest, ProxyResolverFails) { // The second resolve request will try to run through the proxy resolver, // regardless of whether the first request failed in it. TestCompletionCallback callback2; - rv = service->ResolveProxy(url, &info, &callback2, NULL, BoundNetLog()); + rv = service.ResolveProxy(url, &info, &callback2, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(1u, resolver->pending_requests().size()); @@ -406,15 +400,14 @@ TEST(ProxyServiceTest, ProxyFallback) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); GURL url("http://www.google.com/"); // Get the proxy information. ProxyInfo info; TestCompletionCallback callback1; - int rv = service->ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); + int rv = service.ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -436,15 +429,15 @@ TEST(ProxyServiceTest, ProxyFallback) { // Fake an error on the proxy. TestCompletionCallback callback2; - rv = service->ReconsiderProxyAfterError(url, &info, &callback2, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); // The second proxy should be specified. EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI()); TestCompletionCallback callback3; - rv = service->ResolveProxy(url, &info, &callback3, NULL, BoundNetLog()); + rv = service.ResolveProxy(url, &info, &callback3, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(1u, resolver->pending_requests().size()); @@ -462,8 +455,8 @@ TEST(ProxyServiceTest, ProxyFallback) { // We fake another error. It should now try the third one. TestCompletionCallback callback4; - rv = service->ReconsiderProxyAfterError(url, &info, &callback4, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback4, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI()); @@ -471,16 +464,16 @@ TEST(ProxyServiceTest, ProxyFallback) { // proxy servers we thought were valid; next we try the proxy server // that was in our bad proxies map (foopy1:8080). TestCompletionCallback callback5; - rv = service->ReconsiderProxyAfterError(url, &info, &callback5, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback5, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI()); // Fake another error, the last proxy is gone, the list should now be empty, // so there is nothing left to try. TestCompletionCallback callback6; - rv = service->ReconsiderProxyAfterError(url, &info, &callback6, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback6, NULL, + BoundNetLog()); EXPECT_EQ(ERR_FAILED, rv); EXPECT_FALSE(info.is_direct()); EXPECT_TRUE(info.is_empty()); @@ -496,15 +489,14 @@ TEST(ProxyServiceTest, ProxyFallbackToDirect) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); GURL url("http://www.google.com/"); // Get the proxy information. ProxyInfo info; TestCompletionCallback callback1; - int rv = service->ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); + int rv = service.ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -526,8 +518,8 @@ TEST(ProxyServiceTest, ProxyFallbackToDirect) { // Fake an error on the proxy. TestCompletionCallback callback2; - rv = service->ReconsiderProxyAfterError(url, &info, &callback2, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); // Now we get back the second proxy. @@ -535,8 +527,8 @@ TEST(ProxyServiceTest, ProxyFallbackToDirect) { // Fake an error on this proxy as well. TestCompletionCallback callback3; - rv = service->ReconsiderProxyAfterError(url, &info, &callback3, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback3, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); // Finally, we get back DIRECT. @@ -544,8 +536,8 @@ TEST(ProxyServiceTest, ProxyFallbackToDirect) { // Now we tell the proxy service that even DIRECT failed. TestCompletionCallback callback4; - rv = service->ReconsiderProxyAfterError(url, &info, &callback4, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback4, NULL, + BoundNetLog()); // There was nothing left to try after DIRECT, so we are out of // choices. EXPECT_EQ(ERR_FAILED, rv); @@ -559,15 +551,14 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); GURL url("http://www.google.com/"); // Get the proxy information. ProxyInfo info; TestCompletionCallback callback1; - int rv = service->ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); + int rv = service.ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -592,8 +583,8 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) { ProxyConfig::CreateFromCustomPacURL(GURL("http://foopy-new/proxy.pac"))); TestCompletionCallback callback2; - rv = service->ReconsiderProxyAfterError(url, &info, &callback2, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy-new/proxy.pac"), @@ -613,8 +604,8 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) { // We fake another error. It should now ignore the first one. TestCompletionCallback callback3; - rv = service->ReconsiderProxyAfterError(url, &info, &callback3, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback3, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI()); @@ -625,8 +616,8 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) { // We fake another error. It should go back to the first proxy. TestCompletionCallback callback4; - rv = service->ReconsiderProxyAfterError(url, &info, &callback4, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback4, NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy-new2/proxy.pac"), @@ -652,15 +643,14 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); GURL url("http://www.google.com/"); // Get the proxy information. ProxyInfo info; TestCompletionCallback callback1; - int rv = service->ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); + int rv = service.ResolveProxy(url, &info, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), @@ -680,8 +670,8 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) { // Fake a proxy error. TestCompletionCallback callback2; - rv = service->ReconsiderProxyAfterError(url, &info, &callback2, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); // The first proxy is ignored, and the second one is selected. @@ -691,7 +681,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) { // Fake a PAC failure. ProxyInfo info2; TestCompletionCallback callback3; - rv = service->ResolveProxy(url, &info2, &callback3, NULL, BoundNetLog()); + rv = service.ResolveProxy(url, &info2, &callback3, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(1u, resolver->pending_requests().size()); @@ -711,8 +701,8 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) { // "just work" the next time we call it. ProxyInfo info3; TestCompletionCallback callback4; - rv = service->ReconsiderProxyAfterError(url, &info3, &callback4, NULL, - BoundNetLog()); + rv = service.ReconsiderProxyAfterError(url, &info3, &callback4, NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(1u, resolver->pending_requests().size()); @@ -739,20 +729,20 @@ TEST(ProxyServiceTest, ProxyBypassList) { config.set_auto_detect(false); config.proxy_rules().bypass_rules.ParseFromString("*.org"); - scoped_refptr<ProxyService> service(new ProxyService( - new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL)); + ProxyService service( + new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL); int rv; GURL url1("http://www.webkit.org"); GURL url2("http://www.webkit.com"); // Request for a .org domain should bypass proxy. - rv = service->ResolveProxy(url1, &info[0], &callback[0], NULL, BoundNetLog()); + rv = service.ResolveProxy(url1, &info[0], &callback[0], NULL, BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_TRUE(info[0].is_direct()); // Request for a .com domain hits the proxy. - rv = service->ResolveProxy(url2, &info[1], &callback[1], NULL, BoundNetLog()); + rv = service.ResolveProxy(url2, &info[1], &callback[1], NULL, BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy1:8080", info[1].proxy_server().ToURI()); } @@ -763,50 +753,50 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) { config.proxy_rules().ParseFromString("http=foopy1:8080;https=foopy2:8080"); config.set_auto_detect(false); { - scoped_refptr<ProxyService> service(new ProxyService( - new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL)); + ProxyService service( + new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL); GURL test_url("http://www.msn.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(test_url, &info, &callback, NULL, - BoundNetLog()); + int rv = service.ResolveProxy(test_url, &info, &callback, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI()); } { - scoped_refptr<ProxyService> service(new ProxyService( - new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL)); + ProxyService service( + new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL); GURL test_url("ftp://ftp.google.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(test_url, &info, &callback, NULL, - BoundNetLog()); + int rv = service.ResolveProxy(test_url, &info, &callback, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_TRUE(info.is_direct()); EXPECT_EQ("direct://", info.proxy_server().ToURI()); } { - scoped_refptr<ProxyService> service(new ProxyService( - new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL)); + ProxyService service( + new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL); GURL test_url("https://webbranch.techcu.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(test_url, &info, &callback, NULL, - BoundNetLog()); + int rv = service.ResolveProxy(test_url, &info, &callback, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foopy2:8080", info.proxy_server().ToURI()); } { config.proxy_rules().ParseFromString("foopy1:8080"); - scoped_refptr<ProxyService> service(new ProxyService( - new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL)); + ProxyService service( + new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL); GURL test_url("http://www.microsoft.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(test_url, &info, &callback, NULL, - BoundNetLog()); + int rv = service.ResolveProxy(test_url, &info, &callback, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI()); @@ -823,49 +813,49 @@ TEST(ProxyServiceTest, DefaultProxyFallbackToSOCKS) { config.proxy_rules().type); { - scoped_refptr<ProxyService> service(new ProxyService( - new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL)); + ProxyService service( + new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL); GURL test_url("http://www.msn.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(test_url, &info, &callback, NULL, - BoundNetLog()); + int rv = service.ResolveProxy(test_url, &info, &callback, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI()); } { - scoped_refptr<ProxyService> service(new ProxyService( - new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL)); + ProxyService service( + new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL); GURL test_url("ftp://ftp.google.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(test_url, &info, &callback, NULL, - BoundNetLog()); + int rv = service.ResolveProxy(test_url, &info, &callback, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI()); } { - scoped_refptr<ProxyService> service(new ProxyService( - new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL)); + ProxyService service( + new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL); GURL test_url("https://webbranch.techcu.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(test_url, &info, &callback, NULL, - BoundNetLog()); + int rv = service.ResolveProxy(test_url, &info, &callback, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI()); } { - scoped_refptr<ProxyService> service(new ProxyService( - new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL)); + ProxyService service( + new MockProxyConfigService(config), new MockAsyncProxyResolver, NULL); GURL test_url("unknown://www.microsoft.com"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(test_url, &info, &callback, NULL, - BoundNetLog()); + int rv = service.ResolveProxy(test_url, &info, &callback, NULL, + BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_FALSE(info.is_direct()); EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI()); @@ -879,14 +869,13 @@ TEST(ProxyServiceTest, CancelInProgressRequest) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); // Start 3 requests. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://request1"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -905,7 +894,7 @@ TEST(ProxyServiceTest, CancelInProgressRequest) { ProxyInfo info2; TestCompletionCallback callback2; ProxyService::PacRequest* request2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request2"), &info2, &callback2, &request2, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(2u, resolver->pending_requests().size()); @@ -913,14 +902,14 @@ TEST(ProxyServiceTest, CancelInProgressRequest) { ProxyInfo info3; TestCompletionCallback callback3; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request3"), &info3, &callback3, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ASSERT_EQ(3u, resolver->pending_requests().size()); EXPECT_EQ(GURL("http://request3"), resolver->pending_requests()[2]->url()); // Cancel the second request - service->CancelPacRequest(request2); + service.CancelPacRequest(request2); ASSERT_EQ(2u, resolver->pending_requests().size()); EXPECT_EQ(GURL("http://request1"), resolver->pending_requests()[0]->url()); @@ -954,17 +943,16 @@ TEST(ProxyServiceTest, InitialPACScriptDownload) { MockAsyncProxyResolverExpectsBytes* resolver = new MockAsyncProxyResolverExpectsBytes; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Start 3 requests. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://request1"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -974,13 +962,13 @@ TEST(ProxyServiceTest, InitialPACScriptDownload) { ProxyInfo info2; TestCompletionCallback callback2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request2"), &info2, &callback2, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info3; TestCompletionCallback callback3; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request3"), &info3, &callback3, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1034,17 +1022,16 @@ TEST(ProxyServiceTest, ChangeScriptFetcherWhilePACDownloadInProgress) { MockAsyncProxyResolverExpectsBytes* resolver = new MockAsyncProxyResolverExpectsBytes; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Start 2 requests. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://request1"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1054,7 +1041,7 @@ TEST(ProxyServiceTest, ChangeScriptFetcherWhilePACDownloadInProgress) { ProxyInfo info2; TestCompletionCallback callback2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request2"), &info2, &callback2, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1066,7 +1053,7 @@ TEST(ProxyServiceTest, ChangeScriptFetcherWhilePACDownloadInProgress) { // the initialization with the new fetcher. fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Nothing has been sent to the resolver yet. EXPECT_TRUE(resolver->pending_requests().empty()); @@ -1092,18 +1079,17 @@ TEST(ProxyServiceTest, CancelWhilePACFetching) { MockAsyncProxyResolverExpectsBytes* resolver = new MockAsyncProxyResolverExpectsBytes; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Start 3 requests. ProxyInfo info1; TestCompletionCallback callback1; ProxyService::PacRequest* request1; CapturingBoundNetLog log1(CapturingNetLog::kUnbounded); - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://request1"), &info1, &callback1, &request1, log1.bound()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1114,13 +1100,13 @@ TEST(ProxyServiceTest, CancelWhilePACFetching) { ProxyInfo info2; TestCompletionCallback callback2; ProxyService::PacRequest* request2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request2"), &info2, &callback2, &request2, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info3; TestCompletionCallback callback3; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request3"), &info3, &callback3, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1128,8 +1114,8 @@ TEST(ProxyServiceTest, CancelWhilePACFetching) { EXPECT_TRUE(resolver->pending_requests().empty()); // Cancel the first 2 requests. - service->CancelPacRequest(request1); - service->CancelPacRequest(request2); + service.CancelPacRequest(request1); + service.CancelPacRequest(request2); // At this point the ProxyService should be waiting for the // ProxyScriptFetcher to invoke its completion callback, notifying it of @@ -1184,24 +1170,23 @@ TEST(ProxyServiceTest, FallbackFromAutodetectToCustomPac) { MockProxyConfigService* config_service = new MockProxyConfigService(config); MockAsyncProxyResolverExpectsBytes* resolver = new MockAsyncProxyResolverExpectsBytes; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Start 2 requests. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://request1"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info2; TestCompletionCallback callback2; ProxyService::PacRequest* request2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request2"), &info2, &callback2, &request2, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1255,24 +1240,23 @@ TEST(ProxyServiceTest, FallbackFromAutodetectToCustomPac2) { MockProxyConfigService* config_service = new MockProxyConfigService(config); MockAsyncProxyResolverExpectsBytes* resolver = new MockAsyncProxyResolverExpectsBytes; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Start 2 requests. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://request1"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info2; TestCompletionCallback callback2; ProxyService::PacRequest* request2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request2"), &info2, &callback2, &request2, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1331,24 +1315,23 @@ TEST(ProxyServiceTest, FallbackFromAutodetectToCustomToManual) { MockProxyConfigService* config_service = new MockProxyConfigService(config); MockAsyncProxyResolverExpectsBytes* resolver = new MockAsyncProxyResolverExpectsBytes; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Start 2 requests. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://request1"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); ProxyInfo info2; TestCompletionCallback callback2; ProxyService::PacRequest* request2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request2"), &info2, &callback2, &request2, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1389,17 +1372,16 @@ TEST(ProxyServiceTest, BypassDoesntApplyToPac) { MockProxyConfigService* config_service = new MockProxyConfigService(config); MockAsyncProxyResolverExpectsBytes* resolver = new MockAsyncProxyResolverExpectsBytes; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Start 1 requests. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://www.google.com"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1430,7 +1412,7 @@ TEST(ProxyServiceTest, BypassDoesntApplyToPac) { // Start another request, it should pickup the bypass item. ProxyInfo info2; TestCompletionCallback callback2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://www.google.com"), &info2, &callback2, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1457,17 +1439,16 @@ TEST(ProxyServiceTest, DeleteWhileInitProxyResolverHasOutstandingFetch) { MockProxyConfigService* config_service = new MockProxyConfigService(config); MockAsyncProxyResolverExpectsBytes* resolver = new MockAsyncProxyResolverExpectsBytes; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Start 1 request. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://www.google.com"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1478,9 +1459,6 @@ TEST(ProxyServiceTest, DeleteWhileInitProxyResolverHasOutstandingFetch) { // and be waiting on that to complete. EXPECT_TRUE(fetcher->has_pending_request()); EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); - - // Delete the ProxyService - service = NULL; } // Delete the ProxyService while InitProxyResolver has an outstanding @@ -1493,34 +1471,30 @@ TEST(ProxyServiceTest, DeleteWhileInitProxyResolverHasOutstandingSet) { MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); GURL url("http://www.google.com/"); ProxyInfo info; TestCompletionCallback callback; - int rv = service->ResolveProxy(url, &info, &callback, NULL, BoundNetLog()); + int rv = service.ResolveProxy(url, &info, &callback, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(GURL("http://foopy/proxy.pac"), resolver->pending_set_pac_script_request()->script_data()->url()); - - // Delete the ProxyService. - service = NULL; } TEST(ProxyServiceTest, ResetProxyConfigService) { ProxyConfig config1; config1.proxy_rules().ParseFromString("foopy1:8080"); config1.set_auto_detect(false); - scoped_refptr<ProxyService> service(new ProxyService( + ProxyService service( new MockProxyConfigService(config1), - new MockAsyncProxyResolverExpectsBytes, NULL)); + new MockAsyncProxyResolverExpectsBytes, NULL); ProxyInfo info; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://request1"), &info, &callback1, NULL, BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI()); @@ -1528,9 +1502,9 @@ TEST(ProxyServiceTest, ResetProxyConfigService) { ProxyConfig config2; config2.proxy_rules().ParseFromString("foopy2:8080"); config2.set_auto_detect(false); - service->ResetConfigService(new MockProxyConfigService(config2)); + service.ResetConfigService(new MockProxyConfigService(config2)); TestCompletionCallback callback2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request2"), &info, &callback2, NULL, BoundNetLog()); EXPECT_EQ(OK, rv); EXPECT_EQ("foopy2:8080", info.proxy_server().ToURI()); @@ -1543,14 +1517,13 @@ TEST(ProxyServiceTest, UpdateConfigFromPACToDirect) { MockProxyConfigService* config_service = new MockProxyConfigService(config); MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver; - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, NULL)); + ProxyService service(config_service, resolver, NULL); // Start 1 request. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://www.google.com"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1581,7 +1554,7 @@ TEST(ProxyServiceTest, UpdateConfigFromPACToDirect) { // Start another request -- the effective configuration has changed. ProxyInfo info2; TestCompletionCallback callback2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://www.google.com"), &info2, &callback2, NULL, BoundNetLog()); EXPECT_EQ(OK, rv); @@ -1597,21 +1570,20 @@ TEST(ProxyServiceTest, NetworkChangeTriggersPacRefetch) { CapturingNetLog log(CapturingNetLog::kUnbounded); - scoped_refptr<ProxyService> service( - new ProxyService(config_service, resolver, &log)); + ProxyService service(config_service, resolver, &log); MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; - service->SetProxyScriptFetcher(fetcher); + service.SetProxyScriptFetcher(fetcher); // Disable the "wait after IP address changes" hack, so this unit-test can // complete quickly. - service->set_stall_proxy_auto_config_delay(base::TimeDelta()); + service.set_stall_proxy_auto_config_delay(base::TimeDelta()); // Start 1 request. ProxyInfo info1; TestCompletionCallback callback1; - int rv = service->ResolveProxy( + int rv = service.ResolveProxy( GURL("http://request1"), &info1, &callback1, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -1653,7 +1625,7 @@ TEST(ProxyServiceTest, NetworkChangeTriggersPacRefetch) { // Start a second request. ProxyInfo info2; TestCompletionCallback callback2; - rv = service->ResolveProxy( + rv = service.ResolveProxy( GURL("http://request2"), &info2, &callback2, NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); diff --git a/net/socket/client_socket_pool_manager.h b/net/socket/client_socket_pool_manager.h index 54b13f7..35c82a1 100644 --- a/net/socket/client_socket_pool_manager.h +++ b/net/socket/client_socket_pool_manager.h @@ -172,7 +172,7 @@ class ClientSocketPoolManager : public base::NonThreadSafe, DnsRRResolver* const dnsrr_resolver_; DnsCertProvenanceChecker* const dns_cert_checker_; SSLHostInfoFactory* const ssl_host_info_factory_; - const scoped_refptr<ProxyService> proxy_service_; + ProxyService* const proxy_service_; const scoped_refptr<SSLConfigService> ssl_config_service_; // Note: this ordering is important. diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index b416274..d04ddef 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -133,7 +133,7 @@ class SSLClientSocketPoolTest : public testing::Test { HttpNetworkSession::Params params; params.host_resolver = &host_resolver_; params.cert_verifier = &cert_verifier_; - params.proxy_service = proxy_service_; + params.proxy_service = proxy_service_.get(); params.client_socket_factory = &socket_factory_; params.ssl_config_service = ssl_config_service_; params.http_auth_handler_factory = http_auth_handler_factory_.get(); @@ -143,7 +143,7 @@ class SSLClientSocketPoolTest : public testing::Test { MockClientSocketFactory socket_factory_; MockCachingHostResolver host_resolver_; CertVerifier cert_verifier_; - const scoped_refptr<ProxyService> proxy_service_; + const scoped_ptr<ProxyService> proxy_service_; const scoped_refptr<SSLConfigService> ssl_config_service_; const scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; const scoped_refptr<HttpNetworkSession> session_; diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index b3196b4..4c76419 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -4700,8 +4700,9 @@ TEST_P(SpdyNetworkTransactionTest, DirectConnectProxyReconnect) { NormalSpdyTransactionHelper helper_proxy(request_proxy, BoundNetLog(), GetParam()); HttpNetworkSessionPeer session_peer(session_proxy); - session_peer.SetProxyService( + scoped_ptr<net::ProxyService> proxy_service( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); + session_peer.SetProxyService(proxy_service.get()); helper_proxy.session_deps().swap(ssd_proxy); helper_proxy.SetSession(session_proxy); helper_proxy.RunPreTestSetup(); diff --git a/net/spdy/spdy_test_util.cc b/net/spdy/spdy_test_util.cc index 1adcb24..a130bcd 100644 --- a/net/spdy/spdy_test_util.cc +++ b/net/spdy/spdy_test_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #include <string> #include "base/basictypes.h" +#include "base/compiler_specific.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/http/http_network_session.h" @@ -920,7 +921,7 @@ HttpNetworkSession* SpdySessionDependencies::SpdyCreateSession( params.client_socket_factory = session_deps->socket_factory.get(); params.host_resolver = session_deps->host_resolver.get(); params.cert_verifier = session_deps->cert_verifier.get(); - params.proxy_service = session_deps->proxy_service; + params.proxy_service = session_deps->proxy_service.get(); params.ssl_config_service = session_deps->ssl_config_service; params.http_auth_handler_factory = session_deps->http_auth_handler_factory.get(); @@ -935,19 +936,20 @@ HttpNetworkSession* SpdySessionDependencies::SpdyCreateSessionDeterministic( session_deps->deterministic_socket_factory.get(); params.host_resolver = session_deps->host_resolver.get(); params.cert_verifier = session_deps->cert_verifier.get(); - params.proxy_service = session_deps->proxy_service; + params.proxy_service = session_deps->proxy_service.get(); params.ssl_config_service = session_deps->ssl_config_service; params.http_auth_handler_factory = session_deps->http_auth_handler_factory.get(); return new HttpNetworkSession(params); } -SpdyURLRequestContext::SpdyURLRequestContext() { - set_host_resolver(new MockHostResolver()); - set_cert_verifier(new CertVerifier); - set_proxy_service(ProxyService::CreateDirect()); - set_ssl_config_service(new SSLConfigServiceDefaults); - set_http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault( +SpdyURLRequestContext::SpdyURLRequestContext() + : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { + storage_.set_host_resolver(new MockHostResolver()); + storage_.set_cert_verifier(new CertVerifier); + storage_.set_proxy_service(ProxyService::CreateDirect()); + storage_.set_ssl_config_service(new SSLConfigServiceDefaults); + storage_.set_http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault( host_resolver())); net::HttpNetworkSession::Params params; params.client_socket_factory = &socket_factory_; @@ -959,16 +961,12 @@ SpdyURLRequestContext::SpdyURLRequestContext() { params.network_delegate = network_delegate(); scoped_refptr<HttpNetworkSession> network_session( new HttpNetworkSession(params)); - set_http_transaction_factory(new HttpCache( + storage_.set_http_transaction_factory(new HttpCache( network_session, HttpCache::DefaultBackend::InMemory(0))); } SpdyURLRequestContext::~SpdyURLRequestContext() { - delete http_transaction_factory(); - delete http_auth_handler_factory(); - delete cert_verifier(); - delete host_resolver(); } const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type) { diff --git a/net/spdy/spdy_test_util.h b/net/spdy/spdy_test_util.h index 4cfed13..8bba99e 100644 --- a/net/spdy/spdy_test_util.h +++ b/net/spdy/spdy_test_util.h @@ -20,6 +20,7 @@ #include "net/socket/socket_test_util.h" #include "net/spdy/spdy_framer.h" #include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_storage.h" namespace net { @@ -347,7 +348,7 @@ class SpdySessionDependencies { // NOTE: host_resolver must be ordered before http_auth_handler_factory. scoped_ptr<MockHostResolverBase> host_resolver; scoped_ptr<CertVerifier> cert_verifier; - scoped_refptr<ProxyService> proxy_service; + scoped_ptr<ProxyService> proxy_service; scoped_refptr<SSLConfigService> ssl_config_service; scoped_ptr<MockClientSocketFactory> socket_factory; scoped_ptr<DeterministicMockClientSocketFactory> deterministic_socket_factory; @@ -365,6 +366,7 @@ class SpdyURLRequestContext : public URLRequestContext { private: MockClientSocketFactory socket_factory_; + net::URLRequestContextStorage storage_; }; const SpdyHeaderInfo make_spdy_header(spdy::SpdyControlType type); diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc index abff5e6..f7717a2 100644 --- a/net/tools/fetch/fetch_client.cc +++ b/net/tools/fetch/fetch_client.cc @@ -117,7 +117,7 @@ class Client { net::CompletionCallbackImpl<Client> read_callback_; }; -int main(int argc, char**argv) { +int main(int argc, char** argv) { base::AtExitManager exit; base::StatsTable table("fetchclient", 50, 1000); table.set_current(&table); @@ -142,7 +142,7 @@ int main(int argc, char**argv) { NULL)); scoped_ptr<net::CertVerifier> cert_verifier(new net::CertVerifier); - scoped_refptr<net::ProxyService> proxy_service( + scoped_ptr<net::ProxyService> proxy_service( net::ProxyService::CreateDirect()); scoped_refptr<net::SSLConfigService> ssl_config_service( net::SSLConfigService::CreateSystemSSLConfigService()); @@ -153,7 +153,7 @@ int main(int argc, char**argv) { net::HttpNetworkSession::Params session_params; session_params.host_resolver = host_resolver.get(); session_params.cert_verifier = cert_verifier.get(); - session_params.proxy_service = proxy_service; + session_params.proxy_service = proxy_service.get(); session_params.http_auth_handler_factory = http_auth_handler_factory.get(); session_params.ssl_config_service = ssl_config_service; diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 2c99059..545f629 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -17,7 +17,6 @@ #include "net/base/ssl_config_service.h" #include "net/base/transport_security_state.h" #include "net/ftp/ftp_auth_cache.h" -#include "net/proxy/proxy_service.h" #include "net/socket/dns_cert_provenance_checker.h" namespace net { @@ -31,6 +30,7 @@ class HostResolver; class HttpAuthHandlerFactory; class HttpTransactionFactory; class NetworkDelegate; +class ProxyService; class SSLConfigService; class URLRequest; @@ -205,7 +205,7 @@ class URLRequestContext DnsRRResolver* dnsrr_resolver_; DnsCertProvenanceChecker* dns_cert_checker_; HttpAuthHandlerFactory* http_auth_handler_factory_; - scoped_refptr<ProxyService> proxy_service_; + ProxyService* proxy_service_; scoped_refptr<SSLConfigService> ssl_config_service_; NetworkDelegate* network_delegate_; scoped_refptr<CookieStore> cookie_store_; diff --git a/net/url_request/url_request_context_storage.cc b/net/url_request/url_request_context_storage.cc index dd48887..c2b9be7 100644 --- a/net/url_request/url_request_context_storage.cc +++ b/net/url_request/url_request_context_storage.cc @@ -62,7 +62,7 @@ void URLRequestContextStorage::set_http_auth_handler_factory( void URLRequestContextStorage::set_proxy_service(ProxyService* proxy_service) { context_->set_proxy_service(proxy_service); - proxy_service_ = proxy_service; + proxy_service_.reset(proxy_service); } void URLRequestContextStorage::set_ssl_config_service( diff --git a/net/url_request/url_request_context_storage.h b/net/url_request/url_request_context_storage.h index fa096c1..5397981 100644 --- a/net/url_request/url_request_context_storage.h +++ b/net/url_request/url_request_context_storage.h @@ -73,8 +73,8 @@ class URLRequestContextStorage { scoped_ptr<DnsRRResolver> dnsrr_resolver_; scoped_ptr<DnsCertProvenanceChecker> dns_cert_checker_; scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; + scoped_ptr<ProxyService> proxy_service_; // TODO(willchan): Remove refcounting on these members. - scoped_refptr<ProxyService> proxy_service_; scoped_refptr<SSLConfigService> ssl_config_service_; scoped_ptr<NetworkDelegate> network_delegate_; scoped_refptr<CookieStore> cookie_store_; diff --git a/webkit/tools/test_shell/test_shell_request_context.cc b/webkit/tools/test_shell/test_shell_request_context.cc index 7840afa..932d8c6 100644 --- a/webkit/tools/test_shell/test_shell_request_context.cc +++ b/webkit/tools/test_shell/test_shell_request_context.cc @@ -6,6 +6,7 @@ #include "build/build_config.h" +#include "base/compiler_specific.h" #include "base/file_path.h" #include "net/base/cert_verifier.h" #include "net/base/cookie_monster.h" @@ -25,14 +26,16 @@ #include "webkit/tools/test_shell/simple_file_system.h" #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" -TestShellRequestContext::TestShellRequestContext() { +TestShellRequestContext::TestShellRequestContext() + : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { Init(FilePath(), net::HttpCache::NORMAL, false); } TestShellRequestContext::TestShellRequestContext( const FilePath& cache_path, net::HttpCache::Mode cache_mode, - bool no_proxy) { + bool no_proxy) + : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { Init(cache_path, cache_mode, no_proxy); } @@ -40,8 +43,8 @@ void TestShellRequestContext::Init( const FilePath& cache_path, net::HttpCache::Mode cache_mode, bool no_proxy) { - set_cookie_store(new net::CookieMonster(NULL, NULL)); - set_cookie_policy(new net::StaticCookiePolicy()); + storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); + storage_.set_cookie_policy(new net::StaticCookiePolicy()); // hard-code A-L and A-C for test shells set_accept_language("en-us,en"); @@ -64,16 +67,17 @@ void TestShellRequestContext::Init( net::ProxyService::CreateSystemProxyConfigService( MessageLoop::current(), NULL)); #endif - set_host_resolver( + storage_.set_host_resolver( net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, NULL)); - set_cert_verifier(new net::CertVerifier); - set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( + storage_.set_cert_verifier(new net::CertVerifier); + storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( proxy_config_service.release(), 0, NULL)); - set_ssl_config_service(net::SSLConfigService::CreateSystemSSLConfigService()); + storage_.set_ssl_config_service( + net::SSLConfigService::CreateSystemSSLConfigService()); - set_http_auth_handler_factory(net::HttpAuthHandlerFactory::CreateDefault( - host_resolver())); + storage_.set_http_auth_handler_factory( + net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, @@ -85,9 +89,10 @@ void TestShellRequestContext::Init( http_auth_handler_factory(), NULL, NULL, backend); cache->set_mode(cache_mode); - set_http_transaction_factory(cache); + storage_.set_http_transaction_factory(cache); - set_ftp_transaction_factory(new net::FtpNetworkLayer(host_resolver())); + storage_.set_ftp_transaction_factory( + new net::FtpNetworkLayer(host_resolver())); blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); file_system_context_ = static_cast<SimpleFileSystem*>( @@ -95,12 +100,6 @@ void TestShellRequestContext::Init( } TestShellRequestContext::~TestShellRequestContext() { - delete ftp_transaction_factory(); - delete http_transaction_factory(); - delete http_auth_handler_factory(); - delete cookie_policy(); - delete cert_verifier(); - delete host_resolver(); } const std::string& TestShellRequestContext::GetUserAgent( diff --git a/webkit/tools/test_shell/test_shell_request_context.h b/webkit/tools/test_shell/test_shell_request_context.h index 0f6c4e2..cc74803 100644 --- a/webkit/tools/test_shell/test_shell_request_context.h +++ b/webkit/tools/test_shell/test_shell_request_context.h @@ -8,6 +8,7 @@ #include "base/threading/thread.h" #include "net/http/http_cache.h" #include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_storage.h" class FilePath; @@ -47,6 +48,7 @@ class TestShellRequestContext : public net::URLRequestContext { void Init(const FilePath& cache_path, net::HttpCache::Mode cache_mode, bool no_proxy); + net::URLRequestContextStorage storage_; scoped_ptr<webkit_blob::BlobStorageController> blob_storage_controller_; scoped_refptr<fileapi::FileSystemContext> file_system_context_; }; |