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

Side by Side Diff: net/dns/dns_config_service.h

Issue 10543168: [net/dns] Instrument DnsConfigService to measure performance and failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test expectations on win' Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
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_CONFIG_SERVICE_H_ 5 #ifndef NET_DNS_DNS_CONFIG_SERVICE_H_
6 #define NET_DNS_DNS_CONFIG_SERVICE_H_ 6 #define NET_DNS_DNS_CONFIG_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Can be called at most once. 96 // Can be called at most once.
97 void Read(const CallbackType& callback); 97 void Read(const CallbackType& callback);
98 98
99 // Registers for notifications at NetworkChangeNotifier. Will attempt to read 99 // Registers for notifications at NetworkChangeNotifier. Will attempt to read
100 // config after watch is started by NetworkChangeNotifier. Will run |callback| 100 // config after watch is started by NetworkChangeNotifier. Will run |callback|
101 // iff config changes from last call or should be withdrawn. 101 // iff config changes from last call or should be withdrawn.
102 // Can be called at most once. 102 // Can be called at most once.
103 virtual void Watch(const CallbackType& callback); 103 virtual void Watch(const CallbackType& callback);
104 104
105 protected: 105 protected:
106 friend class DnsHostsReader; 106 friend class DnsHostsReader;
mmenke 2012/06/19 14:49:15 While you're here, might as well remove this as we
107 107
108 // Called when the current config (except hosts) has changed. 108 // Called when the current config (except hosts) has changed.
109 void InvalidateConfig(); 109 void InvalidateConfig();
110 // Called when the current hosts have changed. 110 // Called when the current hosts have changed.
111 void InvalidateHosts(); 111 void InvalidateHosts();
112 112
113 // Called with new config. |config|.hosts is ignored. 113 // Called with new config. |config|.hosts is ignored.
114 void OnConfigRead(const DnsConfig& config); 114 void OnConfigRead(const DnsConfig& config);
115 // Called with new hosts. Rest of the config is assumed unchanged. 115 // Called with new hosts. Rest of the config is assumed unchanged.
116 void OnHostsRead(const DnsHosts& hosts); 116 void OnHostsRead(const DnsHosts& hosts);
(...skipping 12 matching lines...) Expand all
129 CallbackType callback_; 129 CallbackType callback_;
130 130
131 DnsConfig dns_config_; 131 DnsConfig dns_config_;
132 132
133 // True after On*Read, before Invalidate*. Tells if the config is complete. 133 // True after On*Read, before Invalidate*. Tells if the config is complete.
134 bool have_config_; 134 bool have_config_;
135 bool have_hosts_; 135 bool have_hosts_;
136 // True if receiver needs to be updated when the config becomes complete. 136 // True if receiver needs to be updated when the config becomes complete.
137 bool need_update_; 137 bool need_update_;
138 // True if the last config sent was empty (instead of |dns_config_|). 138 // True if the last config sent was empty (instead of |dns_config_|).
139 // Set when |timer_| expires.
139 bool last_sent_empty_; 140 bool last_sent_empty_;
140 141
142 // Initialized and updated on Invalidate* call.
143 base::TimeTicks last_invalidate_config_time_;
144 base::TimeTicks last_invalidate_hosts_time_;
145 // Initialized and updated when |timer_| expires.
146 base::TimeTicks last_sent_empty_time_;
147
141 // Started in Invalidate*, cleared in On*Read. 148 // Started in Invalidate*, cleared in On*Read.
142 base::OneShotTimer<DnsConfigService> timer_; 149 base::OneShotTimer<DnsConfigService> timer_;
143 150
144 DISALLOW_COPY_AND_ASSIGN(DnsConfigService); 151 DISALLOW_COPY_AND_ASSIGN(DnsConfigService);
145 }; 152 };
146 153
147 } // namespace net 154 } // namespace net
148 155
149 #endif // NET_DNS_DNS_CONFIG_SERVICE_H_ 156 #endif // NET_DNS_DNS_CONFIG_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698