| 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 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/files/scoped_file.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
| 16 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 17 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 18 #include "components/cronet/ios/version.h" | 19 #include "components/cronet/ios/version.h" |
| 19 #include "components/cronet/url_request_context_config.h" | 20 #include "components/cronet/url_request_context_config.h" |
| 20 #include "net/cert/cert_verifier.h" | 21 #include "net/cert/cert_verifier.h" |
| 21 #include "net/url_request/url_request_context.h" | 22 #include "net/url_request/url_request_context.h" |
| 22 #include "net/url_request/url_request_context_getter.h" | 23 #include "net/url_request/url_request_context_getter.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 50 void Start(); | 51 void Start(); |
| 51 | 52 |
| 52 // The full user-agent. | 53 // The full user-agent. |
| 53 std::string user_agent(); | 54 std::string user_agent(); |
| 54 | 55 |
| 55 // Get global UMA histogram deltas. | 56 // Get global UMA histogram deltas. |
| 56 std::vector<uint8_t> GetHistogramDeltas(); | 57 std::vector<uint8_t> GetHistogramDeltas(); |
| 57 | 58 |
| 58 // Creates a new net log (overwrites existing file with this name). If | 59 // Creates a new net log (overwrites existing file with this name). If |
| 59 // actively logging, this call is ignored. | 60 // actively logging, this call is ignored. |
| 60 void StartNetLog(base::FilePath::StringType file_name, bool log_bytes); | 61 bool StartNetLog(base::FilePath::StringType file_name, bool log_bytes); |
| 61 // Stops logging and flushes file. If not currently logging this call is | 62 // Stops logging and flushes file. If not currently logging this call is |
| 62 // ignored. | 63 // ignored. |
| 63 void StopNetLog(); | 64 void StopNetLog(); |
| 64 | 65 |
| 65 void AddQuicHint(const std::string& host, int port, int alternate_port); | 66 void AddQuicHint(const std::string& host, int port, int alternate_port); |
| 66 | 67 |
| 67 // Setters and getters for |http2_enabled_|, |quic_enabled_|, and | 68 // Setters and getters for |http2_enabled_|, |quic_enabled_|, and |
| 68 // |forced_quic_origin_|. These only have any effect before Start() is | 69 // |forced_quic_origin_|. These only have any effect before Start() is |
| 69 // called. | 70 // called. |
| 70 void set_http2_enabled(bool enabled) { http2_enabled_ = enabled; } | 71 void set_http2_enabled(bool enabled) { http2_enabled_ = enabled; } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 105 |
| 105 // Runs a closure on the network thread. | 106 // Runs a closure on the network thread. |
| 106 void PostToNetworkThread(const tracked_objects::Location& from_here, | 107 void PostToNetworkThread(const tracked_objects::Location& from_here, |
| 107 const base::Closure& task); | 108 const base::Closure& task); |
| 108 | 109 |
| 109 // Runs a closure on the file user blocking thread. | 110 // Runs a closure on the file user blocking thread. |
| 110 void PostToFileUserBlockingThread(const tracked_objects::Location& from_here, | 111 void PostToFileUserBlockingThread(const tracked_objects::Location& from_here, |
| 111 const base::Closure& task); | 112 const base::Closure& task); |
| 112 | 113 |
| 113 // Helper methods that start/stop net logging on the network thread. | 114 // Helper methods that start/stop net logging on the network thread. |
| 114 void StartNetLogOnNetworkThread(const base::FilePath::StringType& file_name, | 115 void StartNetLogOnNetworkThread(base::ScopedFILE file, bool log_bytes); |
| 115 bool log_bytes); | |
| 116 void StopNetLogOnNetworkThread(base::WaitableEvent* log_stopped_event); | 116 void StopNetLogOnNetworkThread(base::WaitableEvent* log_stopped_event); |
| 117 | 117 |
| 118 // Returns the HttpNetworkSession object from the passed in | 118 // Returns the HttpNetworkSession object from the passed in |
| 119 // URLRequestContext or NULL if none exists. | 119 // URLRequestContext or NULL if none exists. |
| 120 net::HttpNetworkSession* GetHttpNetworkSession( | 120 net::HttpNetworkSession* GetHttpNetworkSession( |
| 121 net::URLRequestContext* context); | 121 net::URLRequestContext* context); |
| 122 | 122 |
| 123 // Sets host resolver rules on the network_io_thread_. | 123 // Sets host resolver rules on the network_io_thread_. |
| 124 void SetHostResolverRulesOnNetworkThread(const std::string& rules, | 124 void SetHostResolverRulesOnNetworkThread(const std::string& rules, |
| 125 base::WaitableEvent* event); | 125 base::WaitableEvent* event); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 147 bool user_agent_partial_; | 147 bool user_agent_partial_; |
| 148 std::unique_ptr<net::NetLog> net_log_; | 148 std::unique_ptr<net::NetLog> net_log_; |
| 149 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; | 149 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; |
| 150 | 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); | 151 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace cronet | 154 } // namespace cronet |
| 155 | 155 |
| 156 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ | 156 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ |
| OLD | NEW |