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

Side by Side Diff: content/shell/shell_url_request_context_getter.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 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 | « content/shell/shell_url_request_context_getter.h ('k') | content/test/mock_resource_context.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/shell_url_request_context_getter.h" 5 #include "content/shell/shell_url_request_context_getter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_split.h" 8 #include "base/string_split.h"
9 #include "base/threading/worker_pool.h" 9 #include "base/threading/worker_pool.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 net::ProxyService::CreateSystemProxyConfigService( 42 net::ProxyService::CreateSystemProxyConfigService(
43 io_loop_, file_loop_)); 43 io_loop_, file_loop_));
44 } 44 }
45 45
46 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { 46 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() {
47 } 47 }
48 48
49 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { 49 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
51 51
52 if (!url_request_context_) { 52 if (!url_request_context_.get()) {
53 url_request_context_ = new net::URLRequestContext(); 53 url_request_context_.reset(new net::URLRequestContext());
54 network_delegate_.reset(new ShellNetworkDelegate); 54 network_delegate_.reset(new ShellNetworkDelegate);
55 url_request_context_->set_network_delegate(network_delegate_.get()); 55 url_request_context_->set_network_delegate(network_delegate_.get());
56 storage_.reset(new net::URLRequestContextStorage(url_request_context_)); 56 storage_.reset(
57 new net::URLRequestContextStorage(url_request_context_.get()));
57 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL)); 58 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL));
58 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( 59 storage_->set_server_bound_cert_service(new net::ServerBoundCertService(
59 new net::DefaultServerBoundCertStore(NULL), 60 new net::DefaultServerBoundCertStore(NULL),
60 base::WorkerPool::GetTaskRunner(true))); 61 base::WorkerPool::GetTaskRunner(true)));
61 url_request_context_->set_accept_language("en-us,en"); 62 url_request_context_->set_accept_language("en-us,en");
62 url_request_context_->set_accept_charset("iso-8859-1,*,utf-8"); 63 url_request_context_->set_accept_charset("iso-8859-1,*,utf-8");
63 64
64 storage_->set_host_resolver( 65 storage_->set_host_resolver(
65 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, 66 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism,
66 net::HostResolver::kDefaultRetryAttempts, 67 net::HostResolver::kDefaultRetryAttempts,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 url_request_context_->network_delegate(), 100 url_request_context_->network_delegate(),
100 url_request_context_->http_server_properties(), 101 url_request_context_->http_server_properties(),
101 NULL, 102 NULL,
102 main_backend, 103 main_backend,
103 "" /* trusted_spdy_proxy */ ); 104 "" /* trusted_spdy_proxy */ );
104 storage_->set_http_transaction_factory(main_cache); 105 storage_->set_http_transaction_factory(main_cache);
105 106
106 storage_->set_job_factory(new net::URLRequestJobFactory); 107 storage_->set_job_factory(new net::URLRequestJobFactory);
107 } 108 }
108 109
109 return url_request_context_; 110 return url_request_context_.get();
110 } 111 }
111 112
112 scoped_refptr<base::MessageLoopProxy> 113 scoped_refptr<base::MessageLoopProxy>
113 ShellURLRequestContextGetter::GetIOMessageLoopProxy() const { 114 ShellURLRequestContextGetter::GetIOMessageLoopProxy() const {
114 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 115 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
115 } 116 }
116 117
117 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { 118 net::HostResolver* ShellURLRequestContextGetter::host_resolver() {
118 return url_request_context_->host_resolver(); 119 return url_request_context_->host_resolver();
119 } 120 }
120 121
121 } // namespace content 122 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_url_request_context_getter.h ('k') | content/test/mock_resource_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698