Handle nullptr in RequestConextGetter
This commit is contained in:
parent
f70ece1669
commit
5ce6592e1c
1 changed files with 20 additions and 9 deletions
|
@ -200,6 +200,7 @@ URLRequestContextGetter::URLRequestContextGetter(
|
||||||
// Must first be created on the UI thread.
|
// Must first be created on the UI thread.
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||||
|
|
||||||
|
if (protocol_handlers)
|
||||||
std::swap(protocol_handlers_, *protocol_handlers);
|
std::swap(protocol_handlers_, *protocol_handlers);
|
||||||
|
|
||||||
// We must create the proxy config service on the UI loop on Linux because it
|
// We must create the proxy config service on the UI loop on Linux because it
|
||||||
|
@ -231,8 +232,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// --log-net-log
|
// --log-net-log
|
||||||
|
if (net_log_) {
|
||||||
net_log_->StartLogging(url_request_context_.get());
|
net_log_->StartLogging(url_request_context_.get());
|
||||||
url_request_context_->set_net_log(net_log_);
|
url_request_context_->set_net_log(net_log_);
|
||||||
|
}
|
||||||
|
|
||||||
network_delegate_.reset(delegate_->CreateNetworkDelegate());
|
network_delegate_.reset(delegate_->CreateNetworkDelegate());
|
||||||
url_request_context_->set_network_delegate(network_delegate_.get());
|
url_request_context_->set_network_delegate(network_delegate_.get());
|
||||||
|
@ -365,12 +368,20 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
} else {
|
} else {
|
||||||
backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_));
|
backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (controller_) {
|
||||||
storage_->set_http_transaction_factory(make_scoped_ptr(
|
storage_->set_http_transaction_factory(make_scoped_ptr(
|
||||||
new net::HttpCache(
|
new net::HttpCache(
|
||||||
make_scoped_ptr(new DevToolsNetworkTransactionFactory(
|
make_scoped_ptr(new DevToolsNetworkTransactionFactory(
|
||||||
controller_, http_network_session_.get())),
|
controller_, http_network_session_.get())),
|
||||||
std::move(backend),
|
std::move(backend),
|
||||||
false)));
|
false)));
|
||||||
|
} else {
|
||||||
|
storage_->set_http_transaction_factory(make_scoped_ptr(
|
||||||
|
new net::HttpCache(http_network_session_.get(),
|
||||||
|
std::move(backend),
|
||||||
|
false)));
|
||||||
|
}
|
||||||
|
|
||||||
storage_->set_job_factory(delegate_->CreateURLRequestJobFactory(
|
storage_->set_job_factory(delegate_->CreateURLRequestJobFactory(
|
||||||
&protocol_handlers_, &protocol_interceptors_));
|
&protocol_handlers_, &protocol_interceptors_));
|
||||||
|
|
Loading…
Reference in a new issue