| 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <queue> | 12 #include <queue> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/android/scoped_java_ref.h" | 15 #include "base/android/scoped_java_ref.h" |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 20 #include "components/prefs/json_pref_store.h" | 20 #include "components/prefs/json_pref_store.h" |
| 21 #include "net/nqe/network_quality_estimator.h" | 21 #include "net/nqe/network_quality_estimator.h" |
| 22 #include "net/nqe/network_quality_observation_source.h" |
| 22 | 23 |
| 23 class PrefService; | 24 class PrefService; |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
| 27 class TimeTicks; | 28 class TimeTicks; |
| 28 } // namespace base | 29 } // namespace base |
| 29 | 30 |
| 30 namespace net { | 31 namespace net { |
| 31 class HttpServerPropertiesManager; | 32 class HttpServerPropertiesManager; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // can be configured to observe requests to localhost, as well as to use | 137 // can be configured to observe requests to localhost, as well as to use |
| 137 // observe smaller responses when estimating throughput. | 138 // observe smaller responses when estimating throughput. |
| 138 void EnableNetworkQualityEstimatorOnNetworkThread( | 139 void EnableNetworkQualityEstimatorOnNetworkThread( |
| 139 bool use_local_host_requests, | 140 bool use_local_host_requests, |
| 140 bool use_smaller_responses); | 141 bool use_smaller_responses); |
| 141 | 142 |
| 142 void ProvideRTTObservationsOnNetworkThread(bool should); | 143 void ProvideRTTObservationsOnNetworkThread(bool should); |
| 143 void ProvideThroughputObservationsOnNetworkThread(bool should); | 144 void ProvideThroughputObservationsOnNetworkThread(bool should); |
| 144 | 145 |
| 145 // net::NetworkQualityEstimator::RTTObserver implementation. | 146 // net::NetworkQualityEstimator::RTTObserver implementation. |
| 146 void OnRTTObservation( | 147 void OnRTTObservation(int32_t rtt_ms, |
| 147 int32_t rtt_ms, | 148 const base::TimeTicks& timestamp, |
| 148 const base::TimeTicks& timestamp, | 149 net::NetworkQualityObservationSource source) override; |
| 149 net::NetworkQualityEstimator::ObservationSource source) override; | |
| 150 | 150 |
| 151 // net::NetworkQualityEstimator::ThroughputObserver implementation. | 151 // net::NetworkQualityEstimator::ThroughputObserver implementation. |
| 152 void OnThroughputObservation( | 152 void OnThroughputObservation( |
| 153 int32_t throughput_kbps, | 153 int32_t throughput_kbps, |
| 154 const base::TimeTicks& timestamp, | 154 const base::TimeTicks& timestamp, |
| 155 net::NetworkQualityEstimator::ObservationSource source) override; | 155 net::NetworkQualityObservationSource source) override; |
| 156 | 156 |
| 157 // Network thread is owned by |this|, but is destroyed from java thread. | 157 // Network thread is owned by |this|, but is destroyed from java thread. |
| 158 base::Thread* network_thread_; | 158 base::Thread* network_thread_; |
| 159 | 159 |
| 160 // File thread should be destroyed last. | 160 // File thread should be destroyed last. |
| 161 std::unique_ptr<base::Thread> file_thread_; | 161 std::unique_ptr<base::Thread> file_thread_; |
| 162 | 162 |
| 163 // |write_to_file_observer_| and |context_| should only be accessed on | 163 // |write_to_file_observer_| and |context_| should only be accessed on |
| 164 // network thread. | 164 // network thread. |
| 165 std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; | 165 std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 194 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 194 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
| 195 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; | 195 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; |
| 196 #endif | 196 #endif |
| 197 | 197 |
| 198 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 198 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 } // namespace cronet | 201 } // namespace cronet |
| 202 | 202 |
| 203 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 203 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
| OLD | NEW |