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

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.h

Issue 2751113004: Revert of [Cronet] Write effective experimental options to NetLog (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 6 #define COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 18 matching lines...) Expand all
29 class TimeTicks; 29 class TimeTicks;
30 } // namespace base 30 } // namespace base
31 31
32 namespace net { 32 namespace net {
33 class HttpServerPropertiesManager; 33 class HttpServerPropertiesManager;
34 class NetLog; 34 class NetLog;
35 class NetworkQualitiesPrefsManager; 35 class NetworkQualitiesPrefsManager;
36 class ProxyConfigService; 36 class ProxyConfigService;
37 class SdchOwner; 37 class SdchOwner;
38 class URLRequestContext; 38 class URLRequestContext;
39 class WriteToFileNetLogObserver;
39 class FileNetLogObserver; 40 class FileNetLogObserver;
40 } // namespace net 41 } // namespace net
41 42
42 namespace cronet { 43 namespace cronet {
43 class TestUtil; 44 class TestUtil;
44 45
45 #if defined(DATA_REDUCTION_PROXY_SUPPORT) 46 #if defined(DATA_REDUCTION_PROXY_SUPPORT)
46 class CronetDataReductionProxy; 47 class CronetDataReductionProxy;
47 #endif 48 #endif
48 49
(...skipping 25 matching lines...) Expand all
74 75
75 // Posts a task that might depend on the context being initialized 76 // Posts a task that might depend on the context being initialized
76 // to the network thread. 77 // to the network thread.
77 void PostTaskToNetworkThread(const tracked_objects::Location& posted_from, 78 void PostTaskToNetworkThread(const tracked_objects::Location& posted_from,
78 const base::Closure& callback); 79 const base::Closure& callback);
79 80
80 bool IsOnNetworkThread() const; 81 bool IsOnNetworkThread() const;
81 82
82 net::URLRequestContext* GetURLRequestContext(); 83 net::URLRequestContext* GetURLRequestContext();
83 84
84 // TODO(xunjieli): Keep only one version of StartNetLog(). 85 // Starts NetLog logging to file. This can be called on any thread. Returns
85 86 // false if it fails to open log file.
86 // Starts NetLog logging to file. This can be called on any thread.
87 // Return false if |jfile_name| cannot be opened.
88 bool StartNetLogToFile(JNIEnv* env, 87 bool StartNetLogToFile(JNIEnv* env,
89 const base::android::JavaParamRef<jobject>& jcaller, 88 const base::android::JavaParamRef<jobject>& jcaller,
90 const base::android::JavaParamRef<jstring>& jfile_name, 89 const base::android::JavaParamRef<jstring>& jfile_name,
91 jboolean jlog_all); 90 jboolean jlog_all);
92 91
93 // Starts NetLog logging to disk with a bounded amount of disk space. This 92 // Starts NetLog logging to disk with a bounded amount of disk space. This
94 // can be called on any thread. 93 // can be called on any thread.
95 void StartNetLogToDisk(JNIEnv* env, 94 void StartNetLogToDisk(JNIEnv* env,
96 const base::android::JavaParamRef<jobject>& jcaller, 95 const base::android::JavaParamRef<jobject>& jcaller,
97 const base::android::JavaParamRef<jstring>& jdir_name, 96 const base::android::JavaParamRef<jstring>& jdir_name,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 void OnThroughputObservation( 192 void OnThroughputObservation(
194 int32_t throughput_kbps, 193 int32_t throughput_kbps,
195 const base::TimeTicks& timestamp, 194 const base::TimeTicks& timestamp,
196 net::NetworkQualityObservationSource source) override; 195 net::NetworkQualityObservationSource source) override;
197 196
198 // Same as StartNetLogToDisk, but called only on the network thread. 197 // Same as StartNetLogToDisk, but called only on the network thread.
199 void StartNetLogToBoundedFileOnNetworkThread(const std::string& dir_path, 198 void StartNetLogToBoundedFileOnNetworkThread(const std::string& dir_path,
200 bool include_socket_bytes, 199 bool include_socket_bytes,
201 int size); 200 int size);
202 201
203 // Same as StartNetLogToFile, but called only on the network thread. 202 // Stops NetLog logging to file by calling StopObserving() and destroying
204 void StartNetLogOnNetworkThread(const base::FilePath& file_path, 203 // the |bounded_file_observer_|.
205 bool include_socket_bytes); 204 void StopBoundedFileNetLogOnNetworkThread();
206
207 // Stops NetLog logging on the network thread.
208 void StopNetLogOnNetworkThread();
209 205
210 // Callback for StopObserving() that unblocks the Java ConditionVariable and 206 // Callback for StopObserving() that unblocks the Java ConditionVariable and
211 // signals that it is safe to access the NetLog files. 207 // signals that it is safe to access the NetLog files.
212 void StopNetLogCompleted(); 208 void StopNetLogCompleted();
213 209
214 std::unique_ptr<base::DictionaryValue> GetNetLogInfo() const; 210 // Helper method to stop NetLog logging to file. This can be called on any
211 // thread. This will flush any remaining writes to disk.
212 void StopNetLogHelper();
215 213
216 // Network thread is owned by |this|, but is destroyed from java thread. 214 // Network thread is owned by |this|, but is destroyed from java thread.
217 base::Thread* network_thread_; 215 base::Thread* network_thread_;
218 216
219 // File thread should be destroyed last. 217 // File thread should be destroyed last.
220 std::unique_ptr<base::Thread> file_thread_; 218 std::unique_ptr<base::Thread> file_thread_;
221 219
222 std::unique_ptr<net::FileNetLogObserver> net_log_file_observer_; 220 // |write_to_file_observer_| should only be accessed with
221 // |write_to_file_observer_lock_|.
222 std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_;
223 base::Lock write_to_file_observer_lock_;
224
225 std::unique_ptr<net::FileNetLogObserver> bounded_file_observer_;
223 226
224 // |pref_service_| should outlive the HttpServerPropertiesManager owned by 227 // |pref_service_| should outlive the HttpServerPropertiesManager owned by
225 // |context_|. 228 // |context_|.
226 std::unique_ptr<PrefService> pref_service_; 229 std::unique_ptr<PrefService> pref_service_;
227 std::unique_ptr<net::URLRequestContext> context_; 230 std::unique_ptr<net::URLRequestContext> context_;
228 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; 231 std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
229 scoped_refptr<JsonPrefStore> json_pref_store_; 232 scoped_refptr<JsonPrefStore> json_pref_store_;
230 net::HttpServerPropertiesManager* http_server_properties_manager_; 233 net::HttpServerPropertiesManager* http_server_properties_manager_;
231 234
232 // |sdch_owner_| should be destroyed before |json_pref_store_|, because 235 // |sdch_owner_| should be destroyed before |json_pref_store_|, because
233 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending 236 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending
234 // writes to the disk. 237 // writes to the disk.
235 std::unique_ptr<net::SdchOwner> sdch_owner_; 238 std::unique_ptr<net::SdchOwner> sdch_owner_;
236 239
237 // Context config is only valid until context is initialized. 240 // Context config is only valid until context is initialized.
238 std::unique_ptr<URLRequestContextConfig> context_config_; 241 std::unique_ptr<URLRequestContextConfig> context_config_;
239 242
240 // Effective experimental options. Kept for NetLog.
241 std::unique_ptr<base::DictionaryValue> effective_experimental_options_;
242
243 // A queue of tasks that need to be run after context has been initialized. 243 // A queue of tasks that need to be run after context has been initialized.
244 std::queue<base::Closure> tasks_waiting_for_context_; 244 std::queue<base::Closure> tasks_waiting_for_context_;
245 bool is_context_initialized_; 245 bool is_context_initialized_;
246 int default_load_flags_; 246 int default_load_flags_;
247 247
248 // A network quality estimator. 248 // A network quality estimator.
249 std::unique_ptr<net::NetworkQualityEstimator> network_quality_estimator_; 249 std::unique_ptr<net::NetworkQualityEstimator> network_quality_estimator_;
250 250
251 // Manages the writing and reading of the network quality prefs. 251 // Manages the writing and reading of the network quality prefs.
252 std::unique_ptr<net::NetworkQualitiesPrefsManager> 252 std::unique_ptr<net::NetworkQualitiesPrefsManager>
253 network_qualities_prefs_manager_; 253 network_qualities_prefs_manager_;
254 254
255 // Java object that owns this CronetURLRequestContextAdapter. 255 // Java object that owns this CronetURLRequestContextAdapter.
256 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_; 256 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_;
257 257
258 #if defined(DATA_REDUCTION_PROXY_SUPPORT) 258 #if defined(DATA_REDUCTION_PROXY_SUPPORT)
259 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; 259 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_;
260 #endif 260 #endif
261 261
262 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); 262 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter);
263 }; 263 };
264 264
265 } // namespace cronet 265 } // namespace cronet
266 266
267 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 267 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
OLDNEW
« no previous file with comments | « components/cronet/android/BUILD.gn ('k') | components/cronet/android/cronet_url_request_context_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698