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

Side by Side Diff: android_webview/browser/net/aw_url_request_context_getter.cc

Issue 1298253002: Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add scary comment Created 5 years, 3 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
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 "android_webview/browser/net/aw_url_request_context_getter.h" 5 #include "android_webview/browser/net/aw_url_request_context_getter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_content_browser_client.h" 10 #include "android_webview/browser/aw_content_browser_client.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 return job_factory.Pass(); 176 return job_factory.Pass();
177 } 177 }
178 178
179 } // namespace 179 } // namespace
180 180
181 AwURLRequestContextGetter::AwURLRequestContextGetter( 181 AwURLRequestContextGetter::AwURLRequestContextGetter(
182 const base::FilePath& cache_path, net::CookieStore* cookie_store, 182 const base::FilePath& cache_path, net::CookieStore* cookie_store,
183 scoped_ptr<net::ProxyConfigService> config_service) 183 scoped_ptr<net::ProxyConfigService> config_service)
184 : cache_path_(cache_path), 184 : cache_path_(cache_path),
185 cookie_store_(cookie_store), 185 net_log_(new net::NetLog()),
186 net_log_(new net::NetLog()) { 186 cookie_store_(cookie_store) {
187 proxy_config_service_ = config_service.Pass(); 187 proxy_config_service_ = config_service.Pass();
188 http_user_agent_settings_.reset( 188 http_user_agent_settings_.reset(
189 new AwHttpUserAgentSettings()); 189 new AwHttpUserAgentSettings());
190 // CreateSystemProxyConfigService for Android must be called on main thread. 190 // CreateSystemProxyConfigService for Android must be called on main thread.
191 DCHECK_CURRENTLY_ON(BrowserThread::UI); 191 DCHECK_CURRENTLY_ON(BrowserThread::UI);
192 } 192 }
193 193
194 AwURLRequestContextGetter::~AwURLRequestContextGetter() { 194 AwURLRequestContextGetter::~AwURLRequestContextGetter() {
195 } 195 }
196 196
(...skipping 26 matching lines...) Expand all
223 builder.SetCookieAndChannelIdStores(cookie_store_, NULL); 223 builder.SetCookieAndChannelIdStores(cookie_store_, NULL);
224 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); 224 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder);
225 225
226 url_request_context_.reset(builder.Build()); 226 url_request_context_.reset(builder.Build());
227 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. 227 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads.
228 net::HttpNetworkSession::Params network_session_params; 228 net::HttpNetworkSession::Params network_session_params;
229 229
230 PopulateNetworkSessionParams(url_request_context_.get(), 230 PopulateNetworkSessionParams(url_request_context_.get(),
231 &network_session_params); 231 &network_session_params);
232 232
233 net::HttpCache* main_cache = new net::HttpCache( 233 http_network_session_.reset(
234 network_session_params, 234 new net::HttpNetworkSession(network_session_params));
235 main_http_factory_.reset(new net::HttpCache(
236 http_network_session_.get(),
235 new net::HttpCache::DefaultBackend( 237 new net::HttpCache::DefaultBackend(
236 net::DISK_CACHE, 238 net::DISK_CACHE,
237 net::CACHE_BACKEND_SIMPLE, 239 net::CACHE_BACKEND_SIMPLE,
238 cache_path_, 240 cache_path_,
239 20 * 1024 * 1024, // 20M 241 20 * 1024 * 1024, // 20M
240 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); 242 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)),
243 true));
241 244
242 main_http_factory_.reset(main_cache); 245 url_request_context_->set_http_transaction_factory(main_http_factory_.get());
243 url_request_context_->set_http_transaction_factory(main_cache);
244 246
245 job_factory_ = CreateJobFactory(&protocol_handlers_, 247 job_factory_ = CreateJobFactory(&protocol_handlers_,
246 request_interceptors_.Pass()); 248 request_interceptors_.Pass());
247 249
248 job_factory_.reset(new net::URLRequestInterceptingJobFactory( 250 job_factory_.reset(new net::URLRequestInterceptingJobFactory(
249 job_factory_.Pass(), 251 job_factory_.Pass(),
250 browser_context->GetDataReductionProxyIOData()->CreateInterceptor())); 252 browser_context->GetDataReductionProxyIOData()->CreateInterceptor()));
251 url_request_context_->set_job_factory(job_factory_.get()); 253 url_request_context_->set_job_factory(job_factory_.get());
252 url_request_context_->set_http_user_agent_settings( 254 url_request_context_->set_http_user_agent_settings(
253 http_user_agent_settings_.get()); 255 http_user_agent_settings_.get());
(...skipping 23 matching lines...) Expand all
277 return net_log_.get(); 279 return net_log_.get();
278 } 280 }
279 281
280 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) { 282 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) {
281 DCHECK(AwBrowserContext::GetDefault()->GetDataReductionProxyIOData()); 283 DCHECK(AwBrowserContext::GetDefault()->GetDataReductionProxyIOData());
282 AwBrowserContext::GetDefault()->GetDataReductionProxyIOData()-> 284 AwBrowserContext::GetDefault()->GetDataReductionProxyIOData()->
283 request_options()->SetKeyOnIO(key); 285 request_options()->SetKeyOnIO(key);
284 } 286 }
285 287
286 } // namespace android_webview 288 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698