Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.h

Issue 2909663002: [Cronet] Add API to set DNS cache entry
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/base/address_list.h"
21 #include "net/nqe/effective_connection_type.h" 22 #include "net/nqe/effective_connection_type.h"
22 #include "net/nqe/network_quality_estimator.h" 23 #include "net/nqe/network_quality_estimator.h"
23 #include "net/nqe/network_quality_observation_source.h" 24 #include "net/nqe/network_quality_observation_source.h"
24 25
25 class PrefService; 26 class PrefService;
26 27
27 namespace base { 28 namespace base {
28 class SingleThreadTaskRunner; 29 class SingleThreadTaskRunner;
29 class TimeTicks; 30 class TimeTicks;
30 } // namespace base 31 } // namespace base
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // provided by the network quality estimator. 127 // provided by the network quality estimator.
127 void ProvideRTTObservations( 128 void ProvideRTTObservations(
128 JNIEnv* env, 129 JNIEnv* env,
129 const base::android::JavaParamRef<jobject>& jcaller, 130 const base::android::JavaParamRef<jobject>& jcaller,
130 bool should); 131 bool should);
131 void ProvideThroughputObservations( 132 void ProvideThroughputObservations(
132 JNIEnv* env, 133 JNIEnv* env,
133 const base::android::JavaParamRef<jobject>& jcaller, 134 const base::android::JavaParamRef<jobject>& jcaller,
134 bool should); 135 bool should);
135 136
137 // Put an entry in the HostCache for a particular host.
138 void PutHostCache(JNIEnv* env,
139 const base::android::JavaParamRef<jobject>& jcaller,
140 const base::android::JavaParamRef<jstring>& jhostname,
141 const base::android::JavaParamRef<jobjectArray>& jaddresses,
142 jint jseconds_to_live);
143
136 private: 144 private:
137 friend class TestUtil; 145 friend class TestUtil;
138 146
139 // Initializes |context_| on the Network thread. 147 // Initializes |context_| on the Network thread.
140 void InitializeOnNetworkThread( 148 void InitializeOnNetworkThread(
141 std::unique_ptr<URLRequestContextConfig> config, 149 std::unique_ptr<URLRequestContextConfig> config,
142 const base::android::ScopedJavaGlobalRef<jobject>& 150 const base::android::ScopedJavaGlobalRef<jobject>&
143 jcronet_url_request_context); 151 jcronet_url_request_context);
144 152
145 // Runs a task that might depend on the context being initialized. 153 // Runs a task that might depend on the context being initialized.
(...skipping 14 matching lines...) Expand all
160 // to use smaller responses when estimating throughput, and to disable the 168 // to use smaller responses when estimating throughput, and to disable the
161 // device offline checks when computing the effective connection type or when 169 // device offline checks when computing the effective connection type or when
162 // writing the prefs. This should only be used for testing. 170 // writing the prefs. This should only be used for testing.
163 void ConfigureNetworkQualityEstimatorOnNetworkThreadForTesting( 171 void ConfigureNetworkQualityEstimatorOnNetworkThreadForTesting(
164 bool use_local_host_requests, 172 bool use_local_host_requests,
165 bool use_smaller_responses, 173 bool use_smaller_responses,
166 bool disable_offline_check); 174 bool disable_offline_check);
167 175
168 void ProvideRTTObservationsOnNetworkThread(bool should); 176 void ProvideRTTObservationsOnNetworkThread(bool should);
169 void ProvideThroughputObservationsOnNetworkThread(bool should); 177 void ProvideThroughputObservationsOnNetworkThread(bool should);
178 void PutHostCacheOnNetworkThread(std::string hostname,
179 net::AddressList address_list,
180 base::TimeDelta ttl);
170 181
171 // net::NetworkQualityEstimator::EffectiveConnectionTypeObserver 182 // net::NetworkQualityEstimator::EffectiveConnectionTypeObserver
172 // implementation. 183 // implementation.
173 void OnEffectiveConnectionTypeChanged( 184 void OnEffectiveConnectionTypeChanged(
174 net::EffectiveConnectionType effective_connection_type) override; 185 net::EffectiveConnectionType effective_connection_type) override;
175 186
176 // net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver 187 // net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver
177 // implementation. 188 // implementation.
178 void OnRTTOrThroughputEstimatesComputed( 189 void OnRTTOrThroughputEstimatesComputed(
179 base::TimeDelta http_rtt, 190 base::TimeDelta http_rtt,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 261
251 // Java object that owns this CronetURLRequestContextAdapter. 262 // Java object that owns this CronetURLRequestContextAdapter.
252 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_; 263 base::android::ScopedJavaGlobalRef<jobject> jcronet_url_request_context_;
253 264
254 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter); 265 DISALLOW_COPY_AND_ASSIGN(CronetURLRequestContextAdapter);
255 }; 266 };
256 267
257 } // namespace cronet 268 } // namespace cronet
258 269
259 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_ 270 #endif // COMPONENTS_CRONET_ANDROID_CRONET_URL_REQUEST_CONTEXT_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698