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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 class CronetDataReductionProxy; | 45 class CronetDataReductionProxy; |
46 #endif | 46 #endif |
47 | 47 |
48 struct URLRequestContextConfig; | 48 struct URLRequestContextConfig; |
49 | 49 |
50 bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env); | 50 bool CronetUrlRequestContextAdapterRegisterJni(JNIEnv* env); |
51 | 51 |
52 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext. | 52 // Adapter between Java CronetUrlRequestContext and net::URLRequestContext. |
53 class CronetURLRequestContextAdapter | 53 class CronetURLRequestContextAdapter |
54 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver, | 54 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver, |
| 55 public net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver, |
55 public net::NetworkQualityEstimator::RTTObserver, | 56 public net::NetworkQualityEstimator::RTTObserver, |
56 public net::NetworkQualityEstimator::ThroughputObserver { | 57 public net::NetworkQualityEstimator::ThroughputObserver { |
57 public: | 58 public: |
58 explicit CronetURLRequestContextAdapter( | 59 explicit CronetURLRequestContextAdapter( |
59 std::unique_ptr<URLRequestContextConfig> context_config); | 60 std::unique_ptr<URLRequestContextConfig> context_config); |
60 | 61 |
61 ~CronetURLRequestContextAdapter() override; | 62 ~CronetURLRequestContextAdapter() override; |
62 | 63 |
63 // Called on main Java thread to initialize URLRequestContext. | 64 // Called on main Java thread to initialize URLRequestContext. |
64 void InitRequestContextOnMainThread( | 65 void InitRequestContextOnMainThread( |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 bool use_smaller_responses); | 160 bool use_smaller_responses); |
160 | 161 |
161 void ProvideRTTObservationsOnNetworkThread(bool should); | 162 void ProvideRTTObservationsOnNetworkThread(bool should); |
162 void ProvideThroughputObservationsOnNetworkThread(bool should); | 163 void ProvideThroughputObservationsOnNetworkThread(bool should); |
163 | 164 |
164 // net::NetworkQualityEstimator::EffectiveConnectionTypeObserver | 165 // net::NetworkQualityEstimator::EffectiveConnectionTypeObserver |
165 // implementation. | 166 // implementation. |
166 void OnEffectiveConnectionTypeChanged( | 167 void OnEffectiveConnectionTypeChanged( |
167 net::EffectiveConnectionType effective_connection_type) override; | 168 net::EffectiveConnectionType effective_connection_type) override; |
168 | 169 |
| 170 // net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver |
| 171 // implementation. |
| 172 void OnRTTOrThroughputEstimatesComputed( |
| 173 base::TimeDelta http_rtt, |
| 174 base::TimeDelta transport_rtt, |
| 175 int32_t downstream_throughput_kbps) override; |
| 176 |
169 // net::NetworkQualityEstimator::RTTObserver implementation. | 177 // net::NetworkQualityEstimator::RTTObserver implementation. |
170 void OnRTTObservation(int32_t rtt_ms, | 178 void OnRTTObservation(int32_t rtt_ms, |
171 const base::TimeTicks& timestamp, | 179 const base::TimeTicks& timestamp, |
172 net::NetworkQualityObservationSource source) override; | 180 net::NetworkQualityObservationSource source) override; |
173 | 181 |
174 // net::NetworkQualityEstimator::ThroughputObserver implementation. | 182 // net::NetworkQualityEstimator::ThroughputObserver implementation. |
175 void OnThroughputObservation( | 183 void OnThroughputObservation( |
176 int32_t throughput_kbps, | 184 int32_t throughput_kbps, |
177 const base::TimeTicks& timestamp, | 185 const base::TimeTicks& timestamp, |
178 net::NetworkQualityObservationSource source) override; | 186 net::NetworkQualityObservationSource source) override; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 245 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
238 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; | 246 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; |
239 #endif | 247 #endif |
240 | 248 |
241 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 249 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
242 }; | 250 }; |
243 | 251 |
244 } // namespace cronet | 252 } // namespace cronet |
245 | 253 |
246 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 254 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
OLD | NEW |