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

Unified Diff: net/dns/dns_session.h

Issue 1778933002: DNS: Per-network-type and Finch-variable timeouts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove change to gdig. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/dns_config_service_posix.cc ('k') | net/dns/dns_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_session.h
diff --git a/net/dns/dns_session.h b/net/dns/dns_session.h
index 106493e94b8c0449f9ab927172c31d56c47ad830..b401a64f138648a49d89b1e0cbccb81820e5088a 100644
--- a/net/dns/dns_session.h
+++ b/net/dns/dns_session.h
@@ -16,6 +16,7 @@
#include "base/metrics/bucket_ranges.h"
#include "base/time/time.h"
#include "net/base/net_export.h"
+#include "net/base/network_change_notifier.h"
#include "net/base/rand_callback.h"
#include "net/dns/dns_config_service.h"
#include "net/dns/dns_socket_pool.h"
@@ -36,7 +37,8 @@ class StreamSocket;
// Ref-counted so that DnsClient::Request can keep working in absence of
// DnsClient. A DnsSession must be recreated when DnsConfig changes.
class NET_EXPORT_PRIVATE DnsSession
- : NON_EXPORTED_BASE(public base::RefCounted<DnsSession>) {
+ : NON_EXPORTED_BASE(public base::RefCounted<DnsSession>),
+ public NetworkChangeNotifier::ConnectionTypeObserver {
public:
typedef base::Callback<int()> RandCallback;
@@ -110,7 +112,10 @@ class NET_EXPORT_PRIVATE DnsSession
private:
friend class base::RefCounted<DnsSession>;
- ~DnsSession();
+ ~DnsSession() override;
+
+ void UpdateTimeouts(NetworkChangeNotifier::ConnectionType type);
+ void InitializeServerStats();
// Release a socket.
void FreeSocket(unsigned server_index,
@@ -122,6 +127,10 @@ class NET_EXPORT_PRIVATE DnsSession
// Compute the timeout using the histogram method.
base::TimeDelta NextTimeoutFromHistogram(unsigned server_index, int attempt);
+ // NetworkChangeNotifier::ConnectionTypeObserver:
+ void OnConnectionTypeChanged(
+ NetworkChangeNotifier::ConnectionType type) override;
+
const DnsConfig config_;
scoped_ptr<DnsSocketPool> socket_pool_;
RandCallback rand_callback_;
@@ -130,6 +139,9 @@ class NET_EXPORT_PRIVATE DnsSession
// Current index into |config_.nameservers| to begin resolution with.
int server_index_;
+ base::TimeDelta initial_timeout_;
+ base::TimeDelta max_timeout_;
+
struct ServerStats;
// Track runtime statistics of each DNS server.
« no previous file with comments | « net/dns/dns_config_service_posix.cc ('k') | net/dns/dns_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698