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

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

Issue 9721002: [net/dns] Removes locking from DnsConfigServiceWin and adds local computer name. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move lowercasing to ServeFromHosts, add test. Reorganize OnHostsRead. Created 8 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 unified diff | Download patch
« no previous file with comments | « net/dns/dns_config_service_win.cc ('k') | net/dns/dns_hosts.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_HOSTS_H_ 5 #ifndef NET_DNS_DNS_HOSTS_H_
6 #define NET_DNS_DNS_HOSTS_H_ 6 #define NET_DNS_DNS_HOSTS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 30 matching lines...) Expand all
41 // A SerialWorker that reads a HOSTS file and runs Callback. 41 // A SerialWorker that reads a HOSTS file and runs Callback.
42 // Call WorkNow() to indicate file needs to be re-read. 42 // Call WorkNow() to indicate file needs to be re-read.
43 // Call Cancel() to disable the callback. 43 // Call Cancel() to disable the callback.
44 class NET_EXPORT_PRIVATE DnsHostsReader 44 class NET_EXPORT_PRIVATE DnsHostsReader
45 : NON_EXPORTED_BASE(public SerialWorker) { 45 : NON_EXPORTED_BASE(public SerialWorker) {
46 public: 46 public:
47 typedef base::Callback<void(const DnsHosts& hosts)> CallbackType; 47 typedef base::Callback<void(const DnsHosts& hosts)> CallbackType;
48 48
49 DnsHostsReader(const FilePath& path, const CallbackType& callback); 49 DnsHostsReader(const FilePath& path, const CallbackType& callback);
50 50
51 private: 51 const FilePath& path() const { return path_; }
52
53 protected:
54 explicit DnsHostsReader(const FilePath& path);
52 virtual ~DnsHostsReader(); 55 virtual ~DnsHostsReader();
53 56
54 virtual void DoWork() OVERRIDE; 57 virtual void DoWork() OVERRIDE;
55 virtual void OnWorkFinished() OVERRIDE; 58 virtual void OnWorkFinished() OVERRIDE;
56 59
57 FilePath path_; 60 FilePath path_;
58 CallbackType callback_; 61 CallbackType callback_;
59 // Written in DoWork, read in OnWorkFinished, no locking necessary. 62 // Written in DoWork, read in OnWorkFinished, no locking necessary.
60 DnsHosts dns_hosts_; 63 DnsHosts dns_hosts_;
61 bool success_; 64 bool success_;
62 65
63 DISALLOW_COPY_AND_ASSIGN(DnsHostsReader); 66 DISALLOW_COPY_AND_ASSIGN(DnsHostsReader);
64 }; 67 };
65 68
66 69
67 } // namespace net 70 } // namespace net
68 71
69 #endif // NET_DNS_DNS_HOSTS_H_ 72 #endif // NET_DNS_DNS_HOSTS_H_
70 73
OLDNEW
« no previous file with comments | « net/dns/dns_config_service_win.cc ('k') | net/dns/dns_hosts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698