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

Side by Side Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 165430: Reference count ProxyService.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Sync Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/net/resolve_proxy_msg_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/chrome_url_request_context.h" 5 #include "chrome/browser/net/chrome_url_request_context.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/privacy_blacklist/blacklist.h" 10 #include "chrome/browser/privacy_blacklist/blacklist.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return context; 189 return context;
190 } 190 }
191 191
192 // static 192 // static
193 ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecord( 193 ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecord(
194 Profile* profile) { 194 Profile* profile) {
195 DCHECK(profile->IsOffTheRecord()); 195 DCHECK(profile->IsOffTheRecord());
196 ChromeURLRequestContext* context = new ChromeURLRequestContext(profile); 196 ChromeURLRequestContext* context = new ChromeURLRequestContext(profile);
197 197
198 // Share the same proxy service and host resolver as the original profile. 198 // Share the same proxy service and host resolver as the original profile.
199 // This proxy service's lifespan is dependent on the lifespan of the original 199 // TODO(eroman): although ProxyService is reference counted, this sharing
200 // profile which we reference (see above). 200 // still has a subtle dependency on the lifespan of the original profile --
201 // ProxyService holds a (non referencing) pointer to the URLRequestContext
202 // it uses to download PAC scripts, which in this case is the original
203 // profile...
201 context->host_resolver_ = 204 context->host_resolver_ =
202 profile->GetOriginalProfile()->GetRequestContext()->host_resolver(); 205 profile->GetOriginalProfile()->GetRequestContext()->host_resolver();
203 context->proxy_service_ = 206 context->proxy_service_ =
204 profile->GetOriginalProfile()->GetRequestContext()->proxy_service(); 207 profile->GetOriginalProfile()->GetRequestContext()->proxy_service();
205 208
206 context->http_transaction_factory_ = 209 context->http_transaction_factory_ =
207 new net::HttpCache(context->host_resolver_, context->proxy_service_, 0); 210 new net::HttpCache(context->host_resolver_, context->proxy_service_, 0);
208 context->cookie_store_ = new net::CookieMonster; 211 context->cookie_store_ = new net::CookieMonster;
209 212
210 // The kNewFtp switch is Windows specific because we have multiple FTP 213 // The kNewFtp switch is Windows specific because we have multiple FTP
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 NotificationService::current()->Notify( 509 NotificationService::current()->Notify(
507 NotificationType::URL_REQUEST_CONTEXT_RELEASED, 510 NotificationType::URL_REQUEST_CONTEXT_RELEASED,
508 Source<URLRequestContext>(this), 511 Source<URLRequestContext>(this),
509 NotificationService::NoDetails()); 512 NotificationService::NoDetails());
510 513
511 delete ftp_transaction_factory_; 514 delete ftp_transaction_factory_;
512 delete http_transaction_factory_; 515 delete http_transaction_factory_;
513 516
514 // Do not delete the cookie store in the case of the media context, as it is 517 // Do not delete the cookie store in the case of the media context, as it is
515 // owned by the original context. 518 // owned by the original context.
519 // TODO(eroman): The lifetime expectation of cookie_store_ is not right.
520 // The assumption here is that the original request context (which owns
521 // cookie_store_) is going to outlive the media context (which uses it).
522 // However based on the destruction order of profiles this is not true.
523 // http://crbug.com/15289.
516 if (!is_media_) 524 if (!is_media_)
517 delete cookie_store_; 525 delete cookie_store_;
518
519 // Do not delete the proxy service in the case of OTR or media contexts, as
520 // it is owned by the original URLRequestContext.
521 if (!is_off_the_record_ && !is_media_)
522 delete proxy_service_;
523 } 526 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/resolve_proxy_msg_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698