Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
| 26 class TimeTicks; | 26 class TimeTicks; |
| 27 } // namespace base | 27 } // namespace base |
| 28 | 28 |
| 29 namespace net { | 29 namespace net { |
| 30 class HttpServerPropertiesManager; | 30 class HttpServerPropertiesManager; |
| 31 class NetLog; | 31 class NetLog; |
| 32 class ProxyConfigService; | 32 class ProxyConfigService; |
| 33 class SdchOwner; | 33 class SdchOwner; |
| 34 class URLRequestContext; | 34 class URLRequestContext; |
| 35 class URLRequestContextBuilder; | |
| 35 class WriteToFileNetLogObserver; | 36 class WriteToFileNetLogObserver; |
| 36 } // namespace net | 37 } // namespace net |
| 37 | 38 |
| 38 namespace cronet { | 39 namespace cronet { |
| 39 | 40 |
| 40 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 41 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 41 class CronetDataReductionProxy; | 42 class CronetDataReductionProxy; |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 struct URLRequestContextConfig; | 45 struct URLRequestContextConfig; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 void EnableNetworkQualityEstimator(JNIEnv* env, | 89 void EnableNetworkQualityEstimator(JNIEnv* env, |
| 89 jobject jcaller, | 90 jobject jcaller, |
| 90 jboolean use_local_host_requests, | 91 jboolean use_local_host_requests, |
| 91 jboolean use_smaller_responses); | 92 jboolean use_smaller_responses); |
| 92 | 93 |
| 93 // Request that RTT and/or throughput observations should or should not be | 94 // Request that RTT and/or throughput observations should or should not be |
| 94 // provided by the network quality estimator. | 95 // provided by the network quality estimator. |
| 95 void ProvideRTTObservations(JNIEnv* env, jobject jcaller, bool should); | 96 void ProvideRTTObservations(JNIEnv* env, jobject jcaller, bool should); |
| 96 void ProvideThroughputObservations(JNIEnv* env, jobject jcaller, bool should); | 97 void ProvideThroughputObservations(JNIEnv* env, jobject jcaller, bool should); |
| 97 | 98 |
| 99 // Sets a net::CertVerifier for Testing. |jmock_verifier| should be owned | |
| 100 // and destroyed by the caller. | |
| 101 void SetMockCertVerifierForTesting(JNIEnv* env, | |
| 102 jobject jcaller, | |
| 103 jlong jmock_verifier); | |
| 104 | |
| 98 private: | 105 private: |
| 99 // Initializes |context_| on the Network thread. | 106 // Initializes |context_| on the Network thread. |
| 100 void InitializeOnNetworkThread(scoped_ptr<URLRequestContextConfig> config, | 107 void InitializeOnNetworkThread(scoped_ptr<URLRequestContextConfig> config, |
| 101 const base::android::ScopedJavaGlobalRef< | 108 const base::android::ScopedJavaGlobalRef< |
| 102 jobject>& jcronet_url_request_context); | 109 jobject>& jcronet_url_request_context); |
| 103 | 110 |
| 104 // Runs a task that might depend on the context being initialized. | 111 // Runs a task that might depend on the context being initialized. |
| 105 // This method should only be run on the network thread. | 112 // This method should only be run on the network thread. |
| 106 void RunTaskAfterContextInitOnNetworkThread( | 113 void RunTaskAfterContextInitOnNetworkThread( |
| 107 const base::Closure& task_to_run_after_context_init); | 114 const base::Closure& task_to_run_after_context_init); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 132 int32_t rtt_ms, | 139 int32_t rtt_ms, |
| 133 const base::TimeTicks& timestamp, | 140 const base::TimeTicks& timestamp, |
| 134 net::NetworkQualityEstimator::ObservationSource source) override; | 141 net::NetworkQualityEstimator::ObservationSource source) override; |
| 135 | 142 |
| 136 // net::NetworkQualityEstimator::ThroughputObserver implementation. | 143 // net::NetworkQualityEstimator::ThroughputObserver implementation. |
| 137 void OnThroughputObservation( | 144 void OnThroughputObservation( |
| 138 int32_t throughput_kbps, | 145 int32_t throughput_kbps, |
| 139 const base::TimeTicks& timestamp, | 146 const base::TimeTicks& timestamp, |
| 140 net::NetworkQualityEstimator::ObservationSource source) override; | 147 net::NetworkQualityEstimator::ObservationSource source) override; |
| 141 | 148 |
| 149 void SetMockCertVerifierForTestingOnNetworkThread(jlong jmock_verifier); | |
| 142 // Network thread is owned by |this|, but is destroyed from java thread. | 150 // Network thread is owned by |this|, but is destroyed from java thread. |
| 143 base::Thread* network_thread_; | 151 base::Thread* network_thread_; |
| 144 | 152 |
| 145 // File thread should be destroyed last. | 153 // File thread should be destroyed last. |
| 146 scoped_ptr<base::Thread> file_thread_; | 154 scoped_ptr<base::Thread> file_thread_; |
| 147 | 155 |
| 148 // |write_to_file_observer_| and |context_| should only be accessed on | 156 // |write_to_file_observer_| and |context_| should only be accessed on |
| 149 // network thread. | 157 // network thread. |
| 150 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; | 158 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; |
| 151 | 159 |
| 160 scoped_ptr<net::URLRequestContextBuilder> context_builder_; | |
|
mef
2015/10/12 18:35:03
The need to add context_builder_ as a member of Ur
xunjieli
2015/10/13 01:58:02
Done.
| |
| 152 // |pref_service_| should outlive the HttpServerPropertiesManager owned by | 161 // |pref_service_| should outlive the HttpServerPropertiesManager owned by |
| 153 // |context_|. | 162 // |context_|. |
| 154 scoped_ptr<PrefService> pref_service_; | 163 scoped_ptr<PrefService> pref_service_; |
| 155 scoped_ptr<net::NetLog> net_log_; | 164 scoped_ptr<net::NetLog> net_log_; |
| 156 scoped_ptr<net::URLRequestContext> context_; | 165 scoped_ptr<net::URLRequestContext> context_; |
| 157 scoped_ptr<net::ProxyConfigService> proxy_config_service_; | 166 scoped_ptr<net::ProxyConfigService> proxy_config_service_; |
| 158 scoped_refptr<JsonPrefStore> json_pref_store_; | 167 scoped_refptr<JsonPrefStore> json_pref_store_; |
| 159 net::HttpServerPropertiesManager* http_server_properties_manager_; | 168 net::HttpServerPropertiesManager* http_server_properties_manager_; |
| 160 | 169 |
| 161 // |sdch_owner_| should be destroyed before |json_pref_store_|, because | 170 // |sdch_owner_| should be destroyed before |json_pref_store_|, because |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 180 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 189 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 181 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; | 190 scoped_ptr<CronetDataReductionProxy> data_reduction_proxy_; |
| 182 #endif | 191 #endif |
| 183 | 192 |
| 184 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 193 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
| 185 }; | 194 }; |
| 186 | 195 |
| 187 } // namespace cronet | 196 } // namespace cronet |
| 188 | 197 |
| 189 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 198 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
| OLD | NEW |