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

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

Issue 2954753002: Add Cronet experimental option for host cache persistence (Closed)
Patch Set: address comments Created 3 years, 5 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 24 matching lines...) Expand all
35 class HttpServerPropertiesManager; 35 class HttpServerPropertiesManager;
36 class NetLog; 36 class NetLog;
37 class NetworkQualitiesPrefsManager; 37 class NetworkQualitiesPrefsManager;
38 class ProxyConfigService; 38 class ProxyConfigService;
39 class SdchOwner; 39 class SdchOwner;
40 class URLRequestContext; 40 class URLRequestContext;
41 class FileNetLogObserver; 41 class FileNetLogObserver;
42 } // namespace net 42 } // namespace net
43 43
44 namespace cronet { 44 namespace cronet {
45 class HostCachePersistenceManager;
45 class TestUtil; 46 class TestUtil;
46 47
47 struct URLRequestContextConfig; 48 struct URLRequestContextConfig;
48 49
49 bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env); 50 bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env);
50 51
51 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext. 52 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext.
52 class CronetURLRequestContextAdapter 53 class CronetURLRequestContextAdapter
53 : public net::EffectiveConnectionTypeObserver, 54 : public net::EffectiveConnectionTypeObserver,
54 public net::RTTAndThroughputEstimatesObserver, 55 public net::RTTAndThroughputEstimatesObserver,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 214
214 // Network thread is owned by |this|, but is destroyed from java thread. 215 // Network thread is owned by |this|, but is destroyed from java thread.
215 base::Thread* network_thread_; 216 base::Thread* network_thread_;
216 217
217 // File thread should be destroyed last. 218 // File thread should be destroyed last.
218 std::unique_ptr<base::Thread> file_thread_; 219 std::unique_ptr<base::Thread> file_thread_;
219 220
220 std::unique_ptr<net::FileNetLogObserver> net_log_file_observer_; 221 std::unique_ptr<net::FileNetLogObserver> net_log_file_observer_;
221 222
222 // |pref_service_| should outlive the HttpServerPropertiesManager owned by 223 // |pref_service_| should outlive the HttpServerPropertiesManager owned by
223 // |context_|. 224 // |context_| and the HostCachePersistenceManager.
224 std::unique_ptr<PrefService> pref_service_; 225 std::unique_ptr<PrefService> pref_service_;
225 std::unique_ptr<net::URLRequestContext> context_; 226 std::unique_ptr<net::URLRequestContext> context_;
226 std::unique_ptr<net::ProxyConfigService> proxy_config_service_; 227 std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
227 scoped_refptr<JsonPrefStore> json_pref_store_; 228 scoped_refptr<JsonPrefStore> json_pref_store_;
228 net::HttpServerPropertiesManager* http_server_properties_manager_; 229 net::HttpServerPropertiesManager* http_server_properties_manager_;
229 230
230 // |sdch_owner_| should be destroyed before |json_pref_store_|, because 231 // |sdch_owner_| should be destroyed before |json_pref_store_|, because
231 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending 232 // tearing down |sdch_owner_| forces |json_pref_store_| to flush pending
232 // writes to the disk. 233 // writes to the disk.
233 std::unique_ptr<net::SdchOwner> sdch_owner_; 234 std::unique_ptr<net::SdchOwner> sdch_owner_;
234 235
235 // Context config is only valid until context is initialized. 236 // Context config is only valid until context is initialized.
236 std::unique_ptr<URLRequestContextConfig> context_config_; 237 std::unique_ptr<URLRequestContextConfig> context_config_;
237 238
238 // Effective experimental options. Kept for NetLog. 239 // Effective experimental options. Kept for NetLog.
239 std::unique_ptr<base::DictionaryValue> effective_experimental_options_; 240 std::unique_ptr<base::DictionaryValue> effective_experimental_options_;
240 241
241 // A queue of tasks that need to be run after context has been initialized. 242 // A queue of tasks that need to be run after context has been initialized.
242 std::queue<base::Closure> tasks_waiting_for_context_; 243 std::queue<base::Closure> tasks_waiting_for_context_;
243 bool is_context_initialized_; 244 bool is_context_initialized_;
244 int default_load_flags_; 245 int default_load_flags_;
245 246
246 // A network quality estimator. 247 // A network quality estimator.
247 std::unique_ptr<net::NetworkQualityEstimator> network_quality_estimator_; 248 std::unique_ptr<net::NetworkQualityEstimator> network_quality_estimator_;
248 249
249 // Manages the writing and reading of the network quality prefs. 250 // Manages the writing and reading of the network quality prefs.
250 std::unique_ptr<net::NetworkQualitiesPrefsManager> 251 std::unique_ptr<net::NetworkQualitiesPrefsManager>
251 network_qualities_prefs_manager_; 252 network_qualities_prefs_manager_;
252 253
254 // Manages reading and writing the HostCache pref when persistence is enabled.
255 // Must be destroyed before |context_| (because it owns the HostResolverImpl,
256 // which owns the HostCache) and |pref_service_|.
257 std::unique_ptr<HostCachePersistenceManager> host_cache_persistence_manager_;
258
253 // Java object that owns this CronetURLRequestContextAdapter. 259 // Java object that owns this CronetURLRequestContextAdapter.
254 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_; 260 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_;
255 261
256 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); 262 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter);
257 }; 263 };
258 264
259 } // namespace cronet 265 } // namespace cronet
260 266
261 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 267 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698