| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ | 5 #ifndef COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ |
| 6 #define COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ | 6 #define COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "components/cronet/url_request_context_config.h" | 16 #include "components/cronet/url_request_context_config.h" |
| 17 #include "net/cert/cert_verifier.h" | 17 #include "net/cert/cert_verifier.h" |
| 18 #include "net/url_request/url_request.h" | 18 #include "net/url_request/url_request.h" |
| 19 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
| 20 #include "net/url_request/url_request_context_getter.h" |
| 20 | 21 |
| 21 class JsonPrefStore; | 22 class JsonPrefStore; |
| 22 | 23 |
| 23 namespace base { | 24 namespace base { |
| 24 class WaitableEvent; | 25 class WaitableEvent; |
| 25 } // namespace base | 26 } // namespace base |
| 26 | 27 |
| 27 namespace net { | 28 namespace net { |
| 28 class HttpCache; | 29 class HttpCache; |
| 29 class NetworkChangeNotifier; | 30 class NetworkChangeNotifier; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 75 } |
| 75 | 76 |
| 76 void set_host_resolver_rules(const std::string& host_resolver_rules) { | 77 void set_host_resolver_rules(const std::string& host_resolver_rules) { |
| 77 host_resolver_rules_ = host_resolver_rules; | 78 host_resolver_rules_ = host_resolver_rules; |
| 78 } | 79 } |
| 79 | 80 |
| 80 void set_ssl_key_log_file_name(const std::string& ssl_key_log_file_name) { | 81 void set_ssl_key_log_file_name(const std::string& ssl_key_log_file_name) { |
| 81 ssl_key_log_file_name_ = ssl_key_log_file_name; | 82 ssl_key_log_file_name_ = ssl_key_log_file_name; |
| 82 } | 83 } |
| 83 | 84 |
| 84 net::URLRequestContext* GetURLRequestContext() const; | 85 // Return the URLRequestContextGetter associated with this object. |
| 86 net::URLRequestContextGetter* GetURLRequestContextGetter(); |
| 85 | 87 |
| 86 bool IsOnNetworkThread(); | 88 private: |
| 89 // Performs initialization tasks that must happen on the network thread. |
| 90 void InitializeOnNetworkThread(); |
| 87 | 91 |
| 88 // Runs a closure on the network thread. | 92 // Runs a closure on the network thread. |
| 89 void PostToNetworkThread(const tracked_objects::Location& from_here, | 93 void PostToNetworkThread(const tracked_objects::Location& from_here, |
| 90 const base::Closure& task); | 94 const base::Closure& task); |
| 91 | 95 |
| 92 private: | |
| 93 // Performs initialization tasks that must happen on the network thread. | |
| 94 void InitializeOnNetworkThread(); | |
| 95 | |
| 96 // Runs a closure on the file user blocking thread. | 96 // Runs a closure on the file user blocking thread. |
| 97 void PostToFileUserBlockingThread(const tracked_objects::Location& from_here, | 97 void PostToFileUserBlockingThread(const tracked_objects::Location& from_here, |
| 98 const base::Closure& task); | 98 const base::Closure& task); |
| 99 | 99 |
| 100 // Helper methods that start/stop net logging on the network thread. | 100 // Helper methods that start/stop net logging on the network thread. |
| 101 void StartNetLogOnNetworkThread(const base::FilePath::StringType& file_name, | 101 void StartNetLogOnNetworkThread(const base::FilePath::StringType& file_name, |
| 102 bool log_bytes); | 102 bool log_bytes); |
| 103 void StopNetLogOnNetworkThread(base::WaitableEvent* log_stopped_event); | 103 void StopNetLogOnNetworkThread(base::WaitableEvent* log_stopped_event); |
| 104 | 104 |
| 105 // Returns the HttpNetworkSession object from the passed in | 105 // Returns the HttpNetworkSession object from the passed in |
| (...skipping 11 matching lines...) Expand all Loading... |
| 117 std::unique_ptr<base::Thread> network_io_thread_; | 117 std::unique_ptr<base::Thread> network_io_thread_; |
| 118 std::unique_ptr<base::Thread> network_cache_thread_; | 118 std::unique_ptr<base::Thread> network_cache_thread_; |
| 119 std::unique_ptr<base::Thread> file_thread_; | 119 std::unique_ptr<base::Thread> file_thread_; |
| 120 std::unique_ptr<base::Thread> file_user_blocking_thread_; | 120 std::unique_ptr<base::Thread> file_user_blocking_thread_; |
| 121 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; | 121 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; |
| 122 scoped_refptr<JsonPrefStore> net_pref_store_; | 122 scoped_refptr<JsonPrefStore> net_pref_store_; |
| 123 std::unique_ptr<net::CertVerifier> cert_verifier_; | 123 std::unique_ptr<net::CertVerifier> cert_verifier_; |
| 124 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; | 124 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; |
| 125 std::unique_ptr<net::HttpServerProperties> http_server_properties_; | 125 std::unique_ptr<net::HttpServerProperties> http_server_properties_; |
| 126 std::unique_ptr<net::URLRequestContext> main_context_; | 126 std::unique_ptr<net::URLRequestContext> main_context_; |
| 127 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 127 std::string user_agent_product_name_; | 128 std::string user_agent_product_name_; |
| 128 std::unique_ptr<net::NetLog> net_log_; | 129 std::unique_ptr<net::NetLog> net_log_; |
| 129 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; | 130 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; |
| 130 | 131 |
| 131 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); | 132 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 } // namespace cronet | 135 } // namespace cronet |
| 135 | 136 |
| 136 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ | 137 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ |
| OLD | NEW |