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