| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_DNS_DNS_SESSION_H_ | 5 #ifndef NET_DNS_DNS_SESSION_H_ |
| 6 #define NET_DNS_DNS_SESSION_H_ | 6 #define NET_DNS_DNS_SESSION_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace base { | 24 namespace base { |
| 25 class BucketRanges; | 25 class BucketRanges; |
| 26 class SampleVector; | 26 class SampleVector; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace net { | 29 namespace net { |
| 30 | 30 |
| 31 class ClientSocketFactory; | 31 class ClientSocketFactory; |
| 32 class DatagramClientSocket; | 32 class DatagramClientSocket; |
| 33 class NetLog; | 33 class NetLog; |
| 34 struct NetLogSource; |
| 34 class StreamSocket; | 35 class StreamSocket; |
| 35 | 36 |
| 36 // Session parameters and state shared between DNS transactions. | 37 // Session parameters and state shared between DNS transactions. |
| 37 // Ref-counted so that DnsClient::Request can keep working in absence of | 38 // Ref-counted so that DnsClient::Request can keep working in absence of |
| 38 // DnsClient. A DnsSession must be recreated when DnsConfig changes. | 39 // DnsClient. A DnsSession must be recreated when DnsConfig changes. |
| 39 class NET_EXPORT_PRIVATE DnsSession | 40 class NET_EXPORT_PRIVATE DnsSession |
| 40 : NON_EXPORTED_BASE(public base::RefCounted<DnsSession>), | 41 : NON_EXPORTED_BASE(public base::RefCounted<DnsSession>), |
| 41 public NetworkChangeNotifier::ConnectionTypeObserver { | 42 public NetworkChangeNotifier::ConnectionTypeObserver { |
| 42 public: | 43 public: |
| 43 typedef base::Callback<int()> RandCallback; | 44 typedef base::Callback<int()> RandCallback; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Record server stats before it is destroyed. | 97 // Record server stats before it is destroyed. |
| 97 void RecordServerStats(); | 98 void RecordServerStats(); |
| 98 | 99 |
| 99 // Return the timeout for the next query. |attempt| counts from 0 and is used | 100 // Return the timeout for the next query. |attempt| counts from 0 and is used |
| 100 // for exponential backoff. | 101 // for exponential backoff. |
| 101 base::TimeDelta NextTimeout(unsigned server_index, int attempt); | 102 base::TimeDelta NextTimeout(unsigned server_index, int attempt); |
| 102 | 103 |
| 103 // Allocate a socket, already connected to the server address. | 104 // Allocate a socket, already connected to the server address. |
| 104 // When the SocketLease is destroyed, the socket will be freed. | 105 // When the SocketLease is destroyed, the socket will be freed. |
| 105 std::unique_ptr<SocketLease> AllocateSocket(unsigned server_index, | 106 std::unique_ptr<SocketLease> AllocateSocket(unsigned server_index, |
| 106 const NetLog::Source& source); | 107 const NetLogSource& source); |
| 107 | 108 |
| 108 // Creates a StreamSocket from the factory for a transaction over TCP. These | 109 // Creates a StreamSocket from the factory for a transaction over TCP. These |
| 109 // sockets are not pooled. | 110 // sockets are not pooled. |
| 110 std::unique_ptr<StreamSocket> CreateTCPSocket(unsigned server_index, | 111 std::unique_ptr<StreamSocket> CreateTCPSocket(unsigned server_index, |
| 111 const NetLog::Source& source); | 112 const NetLogSource& source); |
| 112 | 113 |
| 113 void ApplyPersistentData(const base::Value& data); | 114 void ApplyPersistentData(const base::Value& data); |
| 114 std::unique_ptr<const base::Value> GetPersistentData() const; | 115 std::unique_ptr<const base::Value> GetPersistentData() const; |
| 115 | 116 |
| 116 private: | 117 private: |
| 117 friend class base::RefCounted<DnsSession>; | 118 friend class base::RefCounted<DnsSession>; |
| 118 ~DnsSession() override; | 119 ~DnsSession() override; |
| 119 | 120 |
| 120 void UpdateTimeouts(NetworkChangeNotifier::ConnectionType type); | 121 void UpdateTimeouts(NetworkChangeNotifier::ConnectionType type); |
| 121 void InitializeServerStats(); | 122 void InitializeServerStats(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 RttBuckets(); | 156 RttBuckets(); |
| 156 }; | 157 }; |
| 157 static base::LazyInstance<RttBuckets>::Leaky rtt_buckets_; | 158 static base::LazyInstance<RttBuckets>::Leaky rtt_buckets_; |
| 158 | 159 |
| 159 DISALLOW_COPY_AND_ASSIGN(DnsSession); | 160 DISALLOW_COPY_AND_ASSIGN(DnsSession); |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 } // namespace net | 163 } // namespace net |
| 163 | 164 |
| 164 #endif // NET_DNS_DNS_SESSION_H_ | 165 #endif // NET_DNS_DNS_SESSION_H_ |
| OLD | NEW |