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

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

Issue 2146643002: [Cronet] Integrate CrNet functionality into Cronet on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync Created 4 years, 2 months 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/InfoTest.plist ('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 11
11 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
15 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
16 #include "components/cronet/url_request_context_config.h" 17 #include "components/cronet/url_request_context_config.h"
17 #include "net/cert/cert_verifier.h" 18 #include "net/cert/cert_verifier.h"
18 #include "net/url_request/url_request.h" 19 #include "net/url_request/url_request.h"
19 #include "net/url_request/url_request_context.h" 20 #include "net/url_request/url_request_context.h"
21 #include "net/url_request/url_request_context_getter.h"
20 22
21 class JsonPrefStore; 23 class JsonPrefStore;
22 24
23 namespace base { 25 namespace base {
24 class WaitableEvent; 26 class WaitableEvent;
25 } // namespace base 27 } // namespace base
26 28
27 namespace net { 29 namespace net {
28 class HttpCache; 30 class HttpCache;
29 class NetworkChangeNotifier; 31 class NetworkChangeNotifier;
30 class NetLog; 32 class NetLog;
31 class ProxyConfigService; 33 class ProxyConfigService;
32 class WriteToFileNetLogObserver; 34 class WriteToFileNetLogObserver;
33 } // namespace net 35 } // namespace net
34 36
35 namespace cronet { 37 namespace cronet {
36 // CronetEnvironment contains all the network stack configuration 38 // CronetEnvironment contains all the network stack configuration
37 // and initialization. 39 // and initialization.
38 class CronetEnvironment { 40 class CronetEnvironment {
39 public: 41 public:
40 // Initialize Cronet environment globals. Must be called only once on the 42 // Initialize Cronet environment globals. Must be called only once on the
41 // main thread. 43 // main thread.
42 static void Initialize(); 44 static void Initialize();
43 45
44 // |user_agent_product_name| will be used to generate the user-agent. 46 // |user_agent| will be used to generate the user-agent if
45 CronetEnvironment(const std::string& user_agent_product_name); 47 // |user_agent_partial|
48 // is true, or will be used as complete user-agent otherwise.
49 CronetEnvironment(const std::string& user_agent, bool user_agent_partial);
46 ~CronetEnvironment(); 50 ~CronetEnvironment();
47 51
48 // Starts this instance of Cronet environment. 52 // Starts this instance of Cronet environment.
49 void Start(); 53 void Start();
50 54
51 // The full user-agent. 55 // The full user-agent.
52 std::string user_agent(); 56 std::string user_agent();
53 57
58 // Get global UMA histogram deltas.
59 std::vector<uint8_t> GetHistogramDeltas();
60
54 // 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
55 // actively logging, this call is ignored. 62 // actively logging, this call is ignored.
56 void StartNetLog(base::FilePath::StringType file_name, bool log_bytes); 63 void StartNetLog(base::FilePath::StringType file_name, bool log_bytes);
57 // 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
58 // ignored. 65 // ignored.
59 void StopNetLog(); 66 void StopNetLog();
60 67
61 void AddQuicHint(const std::string& host, int port, int alternate_port); 68 void AddQuicHint(const std::string& host, int port, int alternate_port);
62 69
63 // Setters and getters for |http2_enabled_|, |quic_enabled_|, and 70 // Setters and getters for |http2_enabled_|, |quic_enabled_|, and
(...skipping 12 matching lines...) Expand all
76 void set_host_resolver_rules(const std::string& host_resolver_rules) { 83 void set_host_resolver_rules(const std::string& host_resolver_rules) {
77 host_resolver_rules_ = host_resolver_rules; 84 host_resolver_rules_ = host_resolver_rules;
78 } 85 }
79 86
80 void set_ssl_key_log_file_name(const std::string& ssl_key_log_file_name) { 87 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; 88 ssl_key_log_file_name_ = ssl_key_log_file_name;
82 } 89 }
83 90
84 net::URLRequestContext* GetURLRequestContext() const; 91 net::URLRequestContext* GetURLRequestContext() const;
85 92
93 net::URLRequestContextGetter* GetURLRequestContextGetter() const;
94
86 bool IsOnNetworkThread(); 95 bool IsOnNetworkThread();
87 96
88 // Runs a closure on the network thread. 97 // Runs a closure on the network thread.
89 void PostToNetworkThread(const tracked_objects::Location& from_here, 98 void PostToNetworkThread(const tracked_objects::Location& from_here,
90 const base::Closure& task); 99 const base::Closure& task);
91 100
92 private: 101 private:
93 // Performs initialization tasks that must happen on the network thread. 102 // Performs initialization tasks that must happen on the network thread.
94 void InitializeOnNetworkThread(); 103 void InitializeOnNetworkThread();
95 104
(...skipping 21 matching lines...) Expand all
117 std::unique_ptr<base::Thread> network_io_thread_; 126 std::unique_ptr<base::Thread> network_io_thread_;
118 std::unique_ptr<base::Thread> network_cache_thread_; 127 std::unique_ptr<base::Thread> network_cache_thread_;
119 std::unique_ptr<base::Thread> file_thread_; 128 std::unique_ptr<base::Thread> file_thread_;
120 std::unique_ptr<base::Thread> file_user_blocking_thread_; 129 std::unique_ptr<base::Thread> file_user_blocking_thread_;
121 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_; 130 scoped_refptr<base::SequencedTaskRunner> pref_store_worker_pool_;
122 scoped_refptr<JsonPrefStore> net_pref_store_; 131 scoped_refptr<JsonPrefStore> net_pref_store_;
123 std::unique_ptr<net::CertVerifier> cert_verifier_; 132 std::unique_ptr<net::CertVerifier> cert_verifier_;
124 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; 133 std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
125 std::unique_ptr<net::HttpServerProperties> http_server_properties_; 134 std::unique_ptr<net::HttpServerProperties> http_server_properties_;
126 std::unique_ptr<net::URLRequestContext> main_context_; 135 std::unique_ptr<net::URLRequestContext> main_context_;
127 std::string user_agent_product_name_; 136 scoped_refptr<net::URLRequestContextGetter> main_context_getter_;
137 std::string user_agent_;
138 bool user_agent_partial_;
128 std::unique_ptr<net::NetLog> net_log_; 139 std::unique_ptr<net::NetLog> net_log_;
129 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_; 140 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_observer_;
130 141
131 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment); 142 DISALLOW_COPY_AND_ASSIGN(CronetEnvironment);
132 }; 143 };
133 144
134 } // namespace cronet 145 } // namespace cronet
135 146
136 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_ 147 #endif // COMPONENTS_CRONET_IOS_CRONET_ENVIRONMENT_H_
OLDNEW
« no previous file with comments | « components/cronet/ios/InfoTest.plist ('k') | components/cronet/ios/cronet_environment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698