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