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

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: update tests to account for mRegistered change Created 3 years, 7 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver, 51 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver,
52 public net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver, 52 public net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver,
53 public net::NetworkQualityEstimator::RTTObserver, 53 public net::NetworkQualityEstimator::RTTObserver,
54 public net::NetworkQualityEstimator::ThroughputObserver { 54 public net::NetworkQualityEstimator::ThroughputObserver {
55 public: 55 public:
56 explicit CronetURLRequestContextAdapter( 56 explicit CronetURLRequestContextAdapter(
57 std::unique_ptr<URLRequestContextConfig> context_config); 57 std::unique_ptr<URLRequestContextConfig> context_config);
58 58
59 ~CronetURLRequestContextAdapter() override; 59 ~CronetURLRequestContextAdapter() override;
60 60
61 // Called on main Java thread to initialize URLRequestContext. 61 // Called on init Java thread to initialize URLRequestContext.
62 void InitRequestContextOnMainThread( 62 void InitRequestContextOnInitThread(
63 JNIEnv* env, 63 JNIEnv* env,
64 const base::android::JavaParamRef<jobject>& jcaller); 64 const base::android::JavaParamRef<jobject>& jcaller);
65 65
66 // Releases all resources for the request context and deletes the object. 66 // Releases all resources for the request context and deletes the object.
67 // Blocks until network thread is destroyed after running all pending tasks. 67 // Blocks until network thread is destroyed after running all pending tasks.
68 void Destroy(JNIEnv* env, 68 void Destroy(JNIEnv* env,
69 const base::android::JavaParamRef<jobject>& jcaller); 69 const base::android::JavaParamRef<jobject>& jcaller);
70 70
71 // Posts a task that might depend on the context being initialized 71 // Posts a task that might depend on the context being initialized
72 // to the network thread. 72 // to the network thread.
(...skipping 27 matching lines...) Expand all
100 const base::android::JavaParamRef<jobject>& jcaller); 100 const base::android::JavaParamRef<jobject>& jcaller);
101 101
102 // Posts a task to Network thread to get serialized results of certificate 102 // Posts a task to Network thread to get serialized results of certificate
103 // verifications of |context_|'s |cert_verifier|. 103 // verifications of |context_|'s |cert_verifier|.
104 void GetCertVerifierData(JNIEnv* env, 104 void GetCertVerifierData(JNIEnv* env,
105 const base::android::JavaParamRef<jobject>& jcaller); 105 const base::android::JavaParamRef<jobject>& jcaller);
106 106
107 // Default net::LOAD flags used to create requests. 107 // Default net::LOAD flags used to create requests.
108 int default_load_flags() const { return default_load_flags_; } 108 int default_load_flags() const { return default_load_flags_; }
109 109
110 // Called on main Java thread to initialize URLRequestContext. 110 // Called on init Java thread to initialize URLRequestContext.
111 void InitRequestContextOnMainThread(); 111 void InitRequestContextOnInitThread();
112 112
113 // Configures the network quality estimator to observe requests to localhost, 113 // Configures the network quality estimator to observe requests to localhost,
114 // to use smaller responses when estimating throughput, and to disable the 114 // to use smaller responses when estimating throughput, and to disable the
115 // device offline checks when computing the effective connection type or when 115 // device offline checks when computing the effective connection type or when
116 // writing the prefs. This should only be used for testing. This can be 116 // writing the prefs. This should only be used for testing. This can be
117 // called only after the network quality estimator has been enabled. 117 // called only after the network quality estimator has been enabled.
118 void ConfigureNetworkQualityEstimatorForTesting( 118 void ConfigureNetworkQualityEstimatorForTesting(
119 JNIEnv* env, 119 JNIEnv* env,
120 const base::android::JavaParamRef<jobject>& jcaller, 120 const base::android::JavaParamRef<jobject>& jcaller,
121 jboolean use_local_host_requests, 121 jboolean use_local_host_requests,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 // Java object that owns this CronetURLRequestContextAdapter. 251 // Java object that owns this CronetURLRequestContextAdapter.
252 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_; 252 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_;
253 253
254 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); 254 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter);
255 }; 255 };
256 256
257 } // namespace cronet 257 } // namespace cronet
258 258
259 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 259 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
OLDNEW
« no previous file with comments | « components/cronet/android/cronet_library_loader.cc ('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