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

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

Issue 2273403003: Moving gRPC support interfaces out of cronet and into a new component. (Closed)
Patch Set: Address comments 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| 47 // |user_agent_partial| is true, or will be used as the complete user-agent
48 // is true, or will be used as complete user-agent otherwise. 48 // 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 26 matching lines...) Expand all
85 } 85 }
86 86
87 void set_host_resolver_rules(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; 88 host_resolver_rules_ = host_resolver_rules;
89 } 89 }
90 90
91 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) {
92 ssl_key_log_file_name_ = ssl_key_log_file_name; 92 ssl_key_log_file_name_ = ssl_key_log_file_name;
93 } 93 }
94 94
95 // Returns the URLRequestContext associated with this object.
95 net::URLRequestContext* GetURLRequestContext() const; 96 net::URLRequestContext* GetURLRequestContext() const;
96 97
98 // Return the URLRequestContextGetter associated with this object.
97 net::URLRequestContextGetter* GetURLRequestContextGetter() const; 99 net::URLRequestContextGetter* GetURLRequestContextGetter() const;
98 100
99 bool IsOnNetworkThread(); 101 private:
102 // Performs initialization tasks that must happen on the network thread.
103 void InitializeOnNetworkThread();
100 104
101 // Runs a closure on the network thread. 105 // Runs a closure on the network thread.
102 void PostToNetworkThread(const tracked_objects::Location& from_here, 106 void PostToNetworkThread(const tracked_objects::Location& from_here,
103 const base::Closure& task); 107 const base::Closure& task);
104 108
105 private:
106 // Performs initialization tasks that must happen on the network thread.
107 void InitializeOnNetworkThread();
108
109 // Runs a closure on the file user blocking thread. 109 // Runs a closure on the file user blocking thread.
110 void PostToFileUserBlockingThread(const tracked_objects::Location& from_here, 110 void PostToFileUserBlockingThread(const tracked_objects::Location& from_here,
111 const base::Closure& task); 111 const base::Closure& task);
112 112
113 // Helper methods that start/stop net logging on the network thread. 113 // Helper methods that start/stop net logging on the network thread.
114 void StartNetLogOnNetworkThread(const base::FilePath::StringType& file_name, 114 void StartNetLogOnNetworkThread(const base::FilePath::StringType& file_name,
115 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
(...skipping 24 matching lines...) Expand all
143 bool user_agent_partial_; 143 bool user_agent_partial_;
144 std::unique_ptr<net::NetLog> net_log_; 144 std::unique_ptr<net::NetLog> net_log_;
145 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; 145 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_;
146 146
147 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); 147 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment);
148 }; 148 };
149 149
150 } // namespace cronet 150 } // namespace cronet
151 151
152 #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