| 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 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 42 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 43 class CronetDataReductionProxy; | 43 class CronetDataReductionProxy; |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 struct URLRequestContextConfig; | 46 struct URLRequestContextConfig; |
| 47 | 47 |
| 48 bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env); | 48 bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env); |
| 49 | 49 |
| 50 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext. | 50 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext. |
| 51 class CronetURLRequestContextAdapter | 51 class CronetURLRequestContextAdapter |
| 52 : public net::NetworkQualityEstimator::RTTObserver, | 52 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver, |
| 53 public net::NetworkQualityEstimator::RTTObserver, |
| 53 public net::NetworkQualityEstimator::ThroughputObserver { | 54 public net::NetworkQualityEstimator::ThroughputObserver { |
| 54 public: | 55 public: |
| 55 explicit CronetURLRequestContextAdapter( | 56 explicit CronetURLRequestContextAdapter( |
| 56 std::unique_ptr<URLRequestContextConfig> context_config); | 57 std::unique_ptr<URLRequestContextConfig> context_config); |
| 57 | 58 |
| 58 ~CronetURLRequestContextAdapter() override; | 59 ~CronetURLRequestContextAdapter() override; |
| 59 | 60 |
| 60 // Called on main Java thread to initialize URLRequestContext. | 61 // Called on main Java thread to initialize URLRequestContext. |
| 61 void InitRequestContextOnMainThread( | 62 void InitRequestContextOnMainThread( |
| 62 JNIEnv* env, | 63 JNIEnv* env, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Configures the network quality estimator to observe requests to localhost, | 153 // Configures the network quality estimator to observe requests to localhost, |
| 153 // as well as to use smaller responses when estimating throughput. This | 154 // as well as to use smaller responses when estimating throughput. This |
| 154 // should only be used for testing. | 155 // should only be used for testing. |
| 155 void ConfigureNetworkQualityEstimatorOnNetworkThreadForTesting( | 156 void ConfigureNetworkQualityEstimatorOnNetworkThreadForTesting( |
| 156 bool use_local_host_requests, | 157 bool use_local_host_requests, |
| 157 bool use_smaller_responses); | 158 bool use_smaller_responses); |
| 158 | 159 |
| 159 void ProvideRTTObservationsOnNetworkThread(bool should); | 160 void ProvideRTTObservationsOnNetworkThread(bool should); |
| 160 void ProvideThroughputObservationsOnNetworkThread(bool should); | 161 void ProvideThroughputObservationsOnNetworkThread(bool should); |
| 161 | 162 |
| 163 // net::NetworkQualityEstimator::EffectiveConnectionTypeObserver |
| 164 // implementation. |
| 165 void OnEffectiveConnectionTypeChanged( |
| 166 net::NetworkQualityEstimator::EffectiveConnectionType |
| 167 effective_connection_type) override; |
| 168 |
| 162 // net::NetworkQualityEstimator::RTTObserver implementation. | 169 // net::NetworkQualityEstimator::RTTObserver implementation. |
| 163 void OnRTTObservation(int32_t rtt_ms, | 170 void OnRTTObservation(int32_t rtt_ms, |
| 164 const base::TimeTicks& timestamp, | 171 const base::TimeTicks& timestamp, |
| 165 net::NetworkQualityObservationSource source) override; | 172 net::NetworkQualityObservationSource source) override; |
| 166 | 173 |
| 167 // net::NetworkQualityEstimator::ThroughputObserver implementation. | 174 // net::NetworkQualityEstimator::ThroughputObserver implementation. |
| 168 void OnThroughputObservation( | 175 void OnThroughputObservation( |
| 169 int32_t throughput_kbps, | 176 int32_t throughput_kbps, |
| 170 const base::TimeTicks& timestamp, | 177 const base::TimeTicks& timestamp, |
| 171 net::NetworkQualityObservationSource source) override; | 178 net::NetworkQualityObservationSource source) override; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 222 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 216 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; | 223 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; |
| 217 #endif | 224 #endif |
| 218 | 225 |
| 219 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 226 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
| 220 }; | 227 }; |
| 221 | 228 |
| 222 } // namespace cronet | 229 } // namespace cronet |
| 223 | 230 |
| 224 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 231 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
| OLD | NEW |