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

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

Issue 2812963002: [Cronet] Move initialization to a new thread rather than the UI thread. (Closed)
Patch Set: mostly renaming Created 3 years, 8 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver, 55 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver,
56 public net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver, 56 public net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver,
57 public net::NetworkQualityEstimator::RTTObserver, 57 public net::NetworkQualityEstimator::RTTObserver,
58 public net::NetworkQualityEstimator::ThroughputObserver { 58 public net::NetworkQualityEstimator::ThroughputObserver {
59 public: 59 public:
60 explicit CronetURLRequestContextAdapter( 60 explicit CronetURLRequestContextAdapter(
61 std::unique_ptr<URLRequestContextConfig> context_config); 61 std::unique_ptr<URLRequestContextConfig> context_config);
62 62
63 ~CronetURLRequestContextAdapter() override; 63 ~CronetURLRequestContextAdapter() override;
64 64
65 // Called on main Java thread to initialize URLRequestContext. 65 // Called on init Java thread to initialize URLRequestContext.
66 void InitRequestContextOnMainThread( 66 void InitRequestContextOnInitThread(
67 JNIEnv* env, 67 JNIEnv* env,
68 const base::android::JavaParamRef<jobject>& jcaller); 68 const base::android::JavaParamRef<jobject>& jcaller);
69 69
70 // Releases all resources for the request context and deletes the object. 70 // Releases all resources for the request context and deletes the object.
71 // Blocks until network thread is destroyed after running all pending tasks. 71 // Blocks until network thread is destroyed after running all pending tasks.
72 void Destroy(JNIEnv* env, 72 void Destroy(JNIEnv* env,
73 const base::android::JavaParamRef<jobject>& jcaller); 73 const base::android::JavaParamRef<jobject>& jcaller);
74 74
75 // Posts a task that might depend on the context being initialized 75 // Posts a task that might depend on the context being initialized
76 // to the network thread. 76 // to the network thread.
(...skipping 27 matching lines...) Expand all
104 const base::android::JavaParamRef<jobject>& jcaller); 104 const base::android::JavaParamRef<jobject>& jcaller);
105 105
106 // Posts a task to Network thread to get serialized results of certificate 106 // Posts a task to Network thread to get serialized results of certificate
107 // verifications of |context_|'s |cert_verifier|. 107 // verifications of |context_|'s |cert_verifier|.
108 void GetCertVerifierData(JNIEnv* env, 108 void GetCertVerifierData(JNIEnv* env,
109 const base::android::JavaParamRef<jobject>& jcaller); 109 const base::android::JavaParamRef<jobject>& jcaller);
110 110
111 // Default net::LOAD flags used to create requests. 111 // Default net::LOAD flags used to create requests.
112 int default_load_flags() const { return default_load_flags_; } 112 int default_load_flags() const { return default_load_flags_; }
113 113
114 // Called on main Java thread to initialize URLRequestContext. 114 // Called on init Java thread to initialize URLRequestContext.
115 void InitRequestContextOnMainThread(); 115 void InitRequestContextOnInitThread();
116 116
117 // Configures the network quality estimator to observe requests to localhost, 117 // Configures the network quality estimator to observe requests to localhost,
118 // to use smaller responses when estimating throughput, and to disable the 118 // to use smaller responses when estimating throughput, and to disable the
119 // device offline checks when computing the effective connection type or when 119 // device offline checks when computing the effective connection type or when
120 // writing the prefs. This should only be used for testing. This can be 120 // writing the prefs. This should only be used for testing. This can be
121 // called only after the network quality estimator has been enabled. 121 // called only after the network quality estimator has been enabled.
122 void ConfigureNetworkQualityEstimatorForTesting( 122 void ConfigureNetworkQualityEstimatorForTesting(
123 JNIEnv* env, 123 JNIEnv* env,
124 const base::android::JavaParamRef<jobject>& jcaller, 124 const base::android::JavaParamRef<jobject>& jcaller,
125 jboolean use_local_host_requests, 125 jboolean use_local_host_requests,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
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

Powered by Google App Engine
This is Rietveld 408576698