Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: components/cronet/ios/cronet_environment.h

Issue 2484263005: Revert of Revert "Revert of Moving gRPC support interfaces out of cronet and into a new component. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/cronet/ios/cronet_c_for_grpc.cc ('k') | components/cronet/ios/cronet_environment.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 26 matching lines...) Expand all
37 namespace cronet { 37 namespace cronet {
38 // CronetEnvironment contains all the network stack configuration 38 // CronetEnvironment contains all the network stack configuration
39 // and initialization. 39 // and initialization.
40 class CronetEnvironment { 40 class CronetEnvironment {
41 public: 41 public:
42 // Initialize Cronet environment globals. Must be called only once on the 42 // Initialize Cronet environment globals. Must be called only once on the
43 // main thread. 43 // main thread.
44 static void Initialize(); 44 static void Initialize();
45 45
46 // |user_agent| will be used to generate the user-agent if 46 // |user_agent| will be used to generate the user-agent if
47 // |user_agent_partial| is true, or will be used as the complete user-agent 47 // |user_agent_partial|
48 // otherwise. 48 // is true, or will be used as complete user-agent otherwise.
49 CronetEnvironment(const std::string& user_agent, bool user_agent_partial); 49 CronetEnvironment(const std::string& user_agent, bool user_agent_partial);
50 ~CronetEnvironment(); 50 ~CronetEnvironment();
51 51
52 // Starts this instance of Cronet environment. 52 // Starts this instance of Cronet environment.
53 void Start(); 53 void Start();
54 54
55 // The full user-agent. 55 // The full user-agent.
56 std::string user_agent(); 56 std::string user_agent();
57 57
58 // Get global UMA histogram deltas. 58 // Get global UMA histogram deltas.
(...skipping 18 matching lines...) Expand all
77 bool quic_enabled() const { return quic_enabled_; } 77 bool quic_enabled() const { return quic_enabled_; }
78 78
79 void set_accept_language(const std::string& accept_language) { 79 void set_accept_language(const std::string& accept_language) {
80 accept_language_ = accept_language; 80 accept_language_ = accept_language;
81 } 81 }
82 82
83 void set_cert_verifier(std::unique_ptr<net::CertVerifier> cert_verifier) { 83 void set_cert_verifier(std::unique_ptr<net::CertVerifier> cert_verifier) {
84 cert_verifier_ = std::move(cert_verifier); 84 cert_verifier_ = std::move(cert_verifier);
85 } 85 }
86 86
87 void SetHostResolverRules(const std::string& host_resolver_rules); 87 void set_host_resolver_rules(const std::string& host_resolver_rules) {
88 host_resolver_rules_ = host_resolver_rules;
89 }
88 90
89 void set_ssl_key_log_file_name(const std::string& ssl_key_log_file_name) { 91 void set_ssl_key_log_file_name(const std::string& ssl_key_log_file_name) {
90 ssl_key_log_file_name_ = ssl_key_log_file_name; 92 ssl_key_log_file_name_ = ssl_key_log_file_name;
91 } 93 }
92 94
93 // Returns the URLRequestContext associated with this object.
94 net::URLRequestContext* GetURLRequestContext() const; 95 net::URLRequestContext* GetURLRequestContext() const;
95 96
96 // Return the URLRequestContextGetter associated with this object.
97 net::URLRequestContextGetter* GetURLRequestContextGetter() const; 97 net::URLRequestContextGetter* GetURLRequestContextGetter() const;
98 98
99 bool IsOnNetworkThread();
100
101 // Runs a closure on the network thread.
102 void PostToNetworkThread(const tracked_objects::Location& from_here,
103 const base::Closure& task);
104
99 private: 105 private:
100 // Performs initialization tasks that must happen on the network thread. 106 // Performs initialization tasks that must happen on the network thread.
101 void InitializeOnNetworkThread(); 107 void InitializeOnNetworkThread();
102 108
103 // Runs a closure on the network thread.
104 void PostToNetworkThread(const tracked_objects::Location& from_here,
105 const base::Closure& task);
106
107 // Runs a closure on the file user blocking thread. 109 // Runs a closure on the file user blocking thread.
108 void PostToFileUserBlockingThread(const tracked_objects::Location& from_here, 110 void PostToFileUserBlockingThread(const tracked_objects::Location& from_here,
109 const base::Closure& task); 111 const base::Closure& task);
110 112
111 // Helper methods that start/stop net logging on the network thread. 113 // Helper methods that start/stop net logging on the network thread.
112 void StartNetLogOnNetworkThread(const base::FilePath::StringType& file_name, 114 void StartNetLogOnNetworkThread(const base::FilePath::StringType& file_name,
113 bool log_bytes); 115 bool log_bytes);
114 void StopNetLogOnNetworkThread(base::WaitableEvent* log_stopped_event); 116 void StopNetLogOnNetworkThread(base::WaitableEvent* log_stopped_event);
115 117
116 // Returns the HttpNetworkSession object from the passed in 118 // Returns the HttpNetworkSession object from the passed in
117 // URLRequestContext or NULL if none exists. 119 // URLRequestContext or NULL if none exists.
118 net::HttpNetworkSession* GetHttpNetworkSession( 120 net::HttpNetworkSession* GetHttpNetworkSession(
119 net::URLRequestContext* context); 121 net::URLRequestContext* context);
120 122
121 // Sets host resolver rules on the network_io_thread_.
122 void SetHostResolverRulesOnNetworkThread(const std::string& rules,
123 base::WaitableEvent* event);
124
125 bool http2_enabled_; 123 bool http2_enabled_;
126 bool quic_enabled_; 124 bool quic_enabled_;
127 std::string accept_language_; 125 std::string accept_language_;
126 std::string host_resolver_rules_;
128 std::string ssl_key_log_file_name_; 127 std::string ssl_key_log_file_name_;
129 128
130 std::list<net::HostPortPair> quic_hints_; 129 std::list<net::HostPortPair> quic_hints_;
131 130
132 std::unique_ptr<base::Thread> network_io_thread_; 131 std::unique_ptr<base::Thread> network_io_thread_;
133 std::unique_ptr<base::Thread> network_cache_thread_; 132 std::unique_ptr<base::Thread> network_cache_thread_;
134 std::unique_ptr<base::Thread> file_thread_; 133 std::unique_ptr<base::Thread> file_thread_;
135 std::unique_ptr<base::Thread> file_user_blocking_thread_; 134 std::unique_ptr<base::Thread> file_user_blocking_thread_;
136 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; 135 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_;
137 scoped_refptr<JsonPrefStore> net_pref_store_; 136 scoped_refptr<JsonPrefStore> net_pref_store_;
138 std::unique_ptr<net::CertVerifier> cert_verifier_; 137 std::unique_ptr<net::CertVerifier> cert_verifier_;
139 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; 138 std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
140 std::unique_ptr<net::HttpServerProperties> http_server_properties_; 139 std::unique_ptr<net::HttpServerProperties> http_server_properties_;
141 std::unique_ptr<net::URLRequestContext> main_context_; 140 std::unique_ptr<net::URLRequestContext> main_context_;
142 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; 141 scoped_refptr<net::URLRequestContextGetter> main_context_getter_;
143 std::string user_agent_; 142 std::string user_agent_;
144 bool user_agent_partial_; 143 bool user_agent_partial_;
145 std::unique_ptr<net::NetLog> net_log_; 144 std::unique_ptr<net::NetLog> net_log_;
146 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; 145 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_;
147 146
148 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); 147 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment);
149 }; 148 };
150 149
151 } // namespace cronet 150 } // namespace cronet
152 151
153 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ 152 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_
OLDNEW
« no previous file with comments | « components/cronet/ios/cronet_c_for_grpc.cc ('k') | components/cronet/ios/cronet_environment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698