Chromium Code Reviews| Index: net/url_request/url_request_context_builder.cc |
| diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc |
| index 771bc3f25f28e91c929b3e60c4baae85ce8ca54b..3598cce1354f98b4306e77ba2bfbaa14f7c3ba2b 100644 |
| --- a/net/url_request/url_request_context_builder.cc |
| +++ b/net/url_request/url_request_context_builder.cc |
| @@ -26,6 +26,7 @@ |
| #include "net/http/http_network_layer.h" |
| #include "net/http/http_network_session.h" |
| #include "net/http/http_server_properties_impl.h" |
| +#include "net/http/http_server_properties_manager.h" |
| #include "net/http/transport_security_persister.h" |
| #include "net/http/transport_security_state.h" |
| #include "net/ssl/channel_id_service.h" |
| @@ -150,8 +151,23 @@ class BasicURLRequestContext : public URLRequestContext { |
| transport_security_persister = transport_security_persister.Pass(); |
| } |
| + // Sets a HttpServerPropertiesManager. Note that the manager must be |
| + // initialized prior to this call. |
| + void set_http_server_properties_manager( |
| + scoped_ptr<HttpServerPropertiesManager> http_server_properties_manager) { |
| + http_server_properties_manager_ = http_server_properties_manager.Pass(); |
| + set_http_server_properties(http_server_properties_manager_->GetWeakPtr()); |
| + } |
| + |
| protected: |
| - ~BasicURLRequestContext() override { AssertNoURLRequests(); } |
| + ~BasicURLRequestContext() override { |
| + AssertNoURLRequests(); |
| + // Shut down the |http_server_properties_manager_| if there is one, since |
| + // this is the only place in BasicURLRequestContext to do so. |
| + // Note that the shutdown is performed on the network thread. |
| + if (http_server_properties_manager_) |
| + http_server_properties_manager_->ShutdownOnPrefThread(); |
| + } |
| private: |
| // The thread should be torn down last. |
| @@ -160,6 +176,7 @@ class BasicURLRequestContext : public URLRequestContext { |
| URLRequestContextStorage storage_; |
| scoped_ptr<TransportSecurityPersister> transport_security_persister_; |
| + scoped_ptr<HttpServerPropertiesManager> http_server_properties_manager_; |
| DISALLOW_COPY_AND_ASSIGN(BasicURLRequestContext); |
| }; |
| @@ -243,6 +260,11 @@ void URLRequestContextBuilder::SetFileTaskRunner( |
| file_task_runner_ = task_runner; |
| } |
| +void URLRequestContextBuilder::SetHttpServerPropertiesManager( |
| + scoped_ptr<HttpServerPropertiesManager> http_server_properties_manager) { |
| + http_server_properties_manager_ = http_server_properties_manager.Pass(); |
| +} |
| + |
| URLRequestContext* URLRequestContextBuilder::Build() { |
| BasicURLRequestContext* context = |
| new BasicURLRequestContext(file_task_runner_); |
| @@ -326,8 +348,14 @@ URLRequestContext* URLRequestContextBuilder::Build() { |
| false))); |
| } |
| - storage->set_http_server_properties( |
| - scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); |
| + if (http_server_properties_manager_) { |
| + context->set_http_server_properties_manager( |
| + http_server_properties_manager_.Pass()); |
|
mmenke
2015/07/07 19:18:29
Why can't you just do:
storage->set_http_server_p
xunjieli
2015/07/07 19:37:35
I agree that the naming is very confusing here. (T
|
| + } else { |
| + storage->set_http_server_properties( |
| + scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); |
| + } |
| + |
| storage->set_cert_verifier(CertVerifier::CreateDefault()); |
| if (throttling_enabled_) |