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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 void StopNetLog(JNIEnv* env, | 84 void StopNetLog(JNIEnv* env, |
85 const base::android::JavaParamRef<jobject>& jcaller); | 85 const base::android::JavaParamRef<jobject>& jcaller); |
86 | 86 |
87 // Default net::LOAD flags used to create requests. | 87 // Default net::LOAD flags used to create requests. |
88 int default_load_flags() const { return default_load_flags_; } | 88 int default_load_flags() const { return default_load_flags_; } |
89 | 89 |
90 // Called on main Java thread to initialize URLRequestContext. | 90 // Called on main Java thread to initialize URLRequestContext. |
91 void InitRequestContextOnMainThread(); | 91 void InitRequestContextOnMainThread(); |
92 | 92 |
93 // Enables the network quality estimator and optionally configures it to | 93 // Configures the network quality estimator to observe localhost requests, and |
94 // observe localhost requests, and to consider smaller responses when | 94 // to consider smaller responses when observing throughput for testing. This |
95 // observing throughput. It is recommended that both options be set to false. | 95 // should be called after the network quality estimator has been enabled. |
96 void EnableNetworkQualityEstimator( | 96 void ConfigureNetworkQualityEstimatorForTesting( |
97 JNIEnv* env, | 97 JNIEnv* env, |
98 const base::android::JavaParamRef<jobject>& jcaller, | 98 const base::android::JavaParamRef<jobject>& jcaller, |
99 jboolean use_local_host_requests, | 99 jboolean use_local_host_requests, |
100 jboolean use_smaller_responses); | 100 jboolean use_smaller_responses); |
101 | 101 |
| 102 // Enables the network quality estimator. |
| 103 // TODO(tbansal): http://crbug.com/618034 Remove this API. |
| 104 void EnableNetworkQualityEstimator( |
| 105 JNIEnv* env, |
| 106 const base::android::JavaParamRef<jobject>& jcaller); |
| 107 |
102 // Request that RTT and/or throughput observations should or should not be | 108 // Request that RTT and/or throughput observations should or should not be |
103 // provided by the network quality estimator. | 109 // provided by the network quality estimator. |
104 void ProvideRTTObservations( | 110 void ProvideRTTObservations( |
105 JNIEnv* env, | 111 JNIEnv* env, |
106 const base::android::JavaParamRef<jobject>& jcaller, | 112 const base::android::JavaParamRef<jobject>& jcaller, |
107 bool should); | 113 bool should); |
108 void ProvideThroughputObservations( | 114 void ProvideThroughputObservations( |
109 JNIEnv* env, | 115 JNIEnv* env, |
110 const base::android::JavaParamRef<jobject>& jcaller, | 116 const base::android::JavaParamRef<jobject>& jcaller, |
111 bool should); | 117 bool should); |
(...skipping 13 matching lines...) Expand all Loading... |
125 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const; | 131 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const; |
126 | 132 |
127 void StartNetLogToFileOnNetworkThread(const std::string& file_name, | 133 void StartNetLogToFileOnNetworkThread(const std::string& file_name, |
128 bool log_all); | 134 bool log_all); |
129 | 135 |
130 void StopNetLogOnNetworkThread(); | 136 void StopNetLogOnNetworkThread(); |
131 | 137 |
132 // Gets the file thread. Create one if there is none. | 138 // Gets the file thread. Create one if there is none. |
133 base::Thread* GetFileThread(); | 139 base::Thread* GetFileThread(); |
134 | 140 |
135 // Instantiate and configure the network quality estimator. For default | 141 // Configure the network quality estimator to observe requests to localhost, |
136 // behavior, parameters should be set to false; otherwise the estimator | 142 // as well as to use smaller responses when estimating throughput. |
137 // can be configured to observe requests to localhost, as well as to use | 143 void ConfigureNetworkQualityEstimatorOnNetworkThreadForTesting( |
138 // observe smaller responses when estimating throughput. | |
139 void EnableNetworkQualityEstimatorOnNetworkThread( | |
140 bool use_local_host_requests, | 144 bool use_local_host_requests, |
141 bool use_smaller_responses); | 145 bool use_smaller_responses); |
142 | 146 |
| 147 // Instantiate and configure the network quality estimator. |
| 148 // TODO(tbansal): http://crbug.com/618034 Remove this API. |
| 149 void EnableNetworkQualityEstimatorOnNetworkThread(); |
| 150 |
143 void ProvideRTTObservationsOnNetworkThread(bool should); | 151 void ProvideRTTObservationsOnNetworkThread(bool should); |
144 void ProvideThroughputObservationsOnNetworkThread(bool should); | 152 void ProvideThroughputObservationsOnNetworkThread(bool should); |
145 | 153 |
146 // net::NetworkQualityEstimator::RTTObserver implementation. | 154 // net::NetworkQualityEstimator::RTTObserver implementation. |
147 void OnRTTObservation(int32_t rtt_ms, | 155 void OnRTTObservation(int32_t rtt_ms, |
148 const base::TimeTicks& timestamp, | 156 const base::TimeTicks& timestamp, |
149 net::NetworkQualityObservationSource source) override; | 157 net::NetworkQualityObservationSource source) override; |
150 | 158 |
151 // net::NetworkQualityEstimator::ThroughputObserver implementation. | 159 // net::NetworkQualityEstimator::ThroughputObserver implementation. |
152 void OnThroughputObservation( | 160 void OnThroughputObservation( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 #if defined(DATA_REDUCTION_PROXY_SUPPORT) | 202 #if defined(DATA_REDUCTION_PROXY_SUPPORT) |
195 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; | 203 std::unique_ptr<CronetDataReductionProxy> data_reduction_proxy_; |
196 #endif | 204 #endif |
197 | 205 |
198 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); | 206 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); |
199 }; | 207 }; |
200 | 208 |
201 } // namespace cronet | 209 } // namespace cronet |
202 | 210 |
203 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ | 211 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ |
OLD | NEW |