summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-10 04:11:27 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-10 04:11:27 +0000
commit63de95b265c665320b776c821f4cc44872c65c87 (patch)
treed60769b5e1907b060870af7d88ed567671a24e4e /chrome/browser/profile.cc
parentbcdae8c9c9d90889fa0ca6491ae191a9e2f944b4 (diff)
downloadchromium_src-63de95b265c665320b776c821f4cc44872c65c87.zip
chromium_src-63de95b265c665320b776c821f4cc44872c65c87.tar.gz
chromium_src-63de95b265c665320b776c821f4cc44872c65c87.tar.bz2
Misc proxy service changes.
(1) Changed the proxy service ownership model -- rather than being a detail of the HTTP stack, it is now a dependency owned by UrlRequestContext. - ProxyService is owned by UrlRequestContext (before was HttpNetworkSession) - ProxyResolver is owned by ProxyService (before was HttpNetworkSession) Being able to share the proxy service is needed in several places, including incognito mode http context (http://crbug.com/3564), and for proxy resolving in the new FTP stack. (2) Added an IPC for getting of the ProxyResolverWinHttp dependency in the plugin process. Not hooked up yet, but intent is to route the proxy resolve requests through the browser process. (3) Changed some unit tests which were depending on the system proxy settings (this was a sideffect of their calling HttpNetworkLayer::CreateFactory(NULL)). (4) Moved the first-time ProxyService::UpdateConfig out of the constructor and into the initial request. Done to avoid startup perf regressions, since the ProxyService construction is now done earlier (on the startup critical path). BUG=3564 Review URL: http://codereview.chromium.org/12938 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6693 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile.cc')
-rw-r--r--chrome/browser/profile.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 3430a3d..60f2022 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -124,8 +124,10 @@ class ProfileImpl::RequestContext : public URLRequestContext,
CommandLine command_line;
scoped_ptr<net::ProxyInfo> proxy_info(CreateProxyInfo(command_line));
+ proxy_service_ = net::ProxyService::Create(proxy_info.get());
+
net::HttpCache* cache =
- new net::HttpCache(proxy_info.get(), disk_cache_path, 0);
+ new net::HttpCache(proxy_service_, disk_cache_path, 0);
bool record_mode = chrome::kRecordModeEnabled &&
CommandLine().HasSwitch(switches::kRecordMode);
@@ -216,6 +218,7 @@ class ProfileImpl::RequestContext : public URLRequestContext,
DCHECK(NULL == prefs_);
delete cookie_store_;
delete http_transaction_factory_;
+ delete proxy_service_;
if (default_request_context_ == this)
default_request_context_ = NULL;
@@ -251,10 +254,12 @@ class OffTheRecordRequestContext : public URLRequestContext,
// context to make sure it doesn't go away when we delete the object graph.
original_context_ = profile->GetRequestContext();
- CommandLine command_line;
- scoped_ptr<net::ProxyInfo> proxy_info(CreateProxyInfo(command_line));
+ // Share the same proxy service as the original profile. This proxy
+ // service's lifespan is dependent on the lifespan of the original profile,
+ // which we reference (see above).
+ proxy_service_ = original_context_->proxy_service();
- http_transaction_factory_ = new net::HttpCache(NULL, 0);
+ http_transaction_factory_ = new net::HttpCache(proxy_service_, 0);
cookie_store_ = new net::CookieMonster;
cookie_policy_.SetType(net::CookiePolicy::FromInt(
prefs_->GetInteger(prefs::kCookieBehavior)));
@@ -323,6 +328,8 @@ class OffTheRecordRequestContext : public URLRequestContext,
DCHECK(NULL == prefs_);
delete cookie_store_;
delete http_transaction_factory_;
+ // NOTE: do not delete |proxy_service_| as is owned by the original profile.
+
// The OffTheRecordRequestContext simply act as a proxy to the real context.
// There is nothing else to delete.
}