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

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

Issue 1010963002: favor DCHECK_CURRENTLY_ON for better logs in content/{public,shell,test}/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 5 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/shell_url_request_context_getter.h" 5 #include "content/shell/browser/shell_url_request_context_getter.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ProtocolHandlerMap* protocol_handlers, 67 ProtocolHandlerMap* protocol_handlers,
68 URLRequestInterceptorScopedVector request_interceptors, 68 URLRequestInterceptorScopedVector request_interceptors,
69 net::NetLog* net_log) 69 net::NetLog* net_log)
70 : ignore_certificate_errors_(ignore_certificate_errors), 70 : ignore_certificate_errors_(ignore_certificate_errors),
71 base_path_(base_path), 71 base_path_(base_path),
72 io_loop_(io_loop), 72 io_loop_(io_loop),
73 file_loop_(file_loop), 73 file_loop_(file_loop),
74 net_log_(net_log), 74 net_log_(net_log),
75 request_interceptors_(request_interceptors.Pass()) { 75 request_interceptors_(request_interceptors.Pass()) {
76 // Must first be created on the UI thread. 76 // Must first be created on the UI thread.
77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 77 DCHECK_CURRENTLY_ON(BrowserThread::UI);
78 78
79 std::swap(protocol_handlers_, *protocol_handlers); 79 std::swap(protocol_handlers_, *protocol_handlers);
80 80
81 // We must create the proxy config service on the UI loop on Linux because it 81 // We must create the proxy config service on the UI loop on Linux because it
82 // must synchronously run on the glib message loop. This will be passed to 82 // must synchronously run on the glib message loop. This will be passed to
83 // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). 83 // the URLRequestContextStorage on the IO thread in GetURLRequestContext().
84 proxy_config_service_.reset(GetProxyConfigService()); 84 proxy_config_service_.reset(GetProxyConfigService());
85 } 85 }
86 86
87 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { 87 ShellURLRequestContextGetter::~ShellURLRequestContextGetter() {
88 } 88 }
89 89
90 net::NetworkDelegate* ShellURLRequestContextGetter::CreateNetworkDelegate() { 90 net::NetworkDelegate* ShellURLRequestContextGetter::CreateNetworkDelegate() {
91 return new ShellNetworkDelegate; 91 return new ShellNetworkDelegate;
92 } 92 }
93 93
94 net::ProxyConfigService* ShellURLRequestContextGetter::GetProxyConfigService() { 94 net::ProxyConfigService* ShellURLRequestContextGetter::GetProxyConfigService() {
95 return net::ProxyService::CreateSystemProxyConfigService( 95 return net::ProxyService::CreateSystemProxyConfigService(
96 io_loop_->message_loop_proxy(), file_loop_->message_loop_proxy()); 96 io_loop_->message_loop_proxy(), file_loop_->message_loop_proxy());
97 } 97 }
98 98
99 net::ProxyService* ShellURLRequestContextGetter::GetProxyService() { 99 net::ProxyService* ShellURLRequestContextGetter::GetProxyService() {
100 // TODO(jam): use v8 if possible, look at chrome code. 100 // TODO(jam): use v8 if possible, look at chrome code.
101 return net::ProxyService::CreateUsingSystemProxyResolver( 101 return net::ProxyService::CreateUsingSystemProxyResolver(
102 proxy_config_service_.release(), 0, url_request_context_->net_log()); 102 proxy_config_service_.release(), 0, url_request_context_->net_log());
103 } 103 }
104 104
105 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { 105 net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 106 DCHECK_CURRENTLY_ON(BrowserThread::IO);
107 107
108 if (!url_request_context_) { 108 if (!url_request_context_) {
109 const base::CommandLine& command_line = 109 const base::CommandLine& command_line =
110 *base::CommandLine::ForCurrentProcess(); 110 *base::CommandLine::ForCurrentProcess();
111 111
112 url_request_context_.reset(new net::URLRequestContext()); 112 url_request_context_.reset(new net::URLRequestContext());
113 url_request_context_->set_net_log(net_log_); 113 url_request_context_->set_net_log(net_log_);
114 network_delegate_.reset(CreateNetworkDelegate()); 114 network_delegate_.reset(CreateNetworkDelegate());
115 url_request_context_->set_network_delegate(network_delegate_.get()); 115 url_request_context_->set_network_delegate(network_delegate_.get());
116 storage_.reset( 116 storage_.reset(
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 scoped_refptr<base::SingleThreadTaskRunner> 240 scoped_refptr<base::SingleThreadTaskRunner>
241 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { 241 ShellURLRequestContextGetter::GetNetworkTaskRunner() const {
242 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 242 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
243 } 243 }
244 244
245 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { 245 net::HostResolver* ShellURLRequestContextGetter::host_resolver() {
246 return url_request_context_->host_resolver(); 246 return url_request_context_->host_resolver();
247 } 247 }
248 248
249 } // namespace content 249 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_login_dialog_mac.mm ('k') | content/test/net/url_request_abort_on_end_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698