Index: net/dns/dns_config_service_win.cc |
diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc |
index 14a157bc6216b8c3a81c9834bf6e273ba52048f3..a29348110d9dbbefb83be132b1034f53b8fea56a 100644 |
--- a/net/dns/dns_config_service_win.cc |
+++ b/net/dns/dns_config_service_win.cc |
@@ -23,7 +23,7 @@ |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/synchronization/lock.h" |
-#include "base/threading/non_thread_safe.h" |
+#include "base/threading/thread_checker.h" |
#include "base/threading/thread_restrictions.h" |
#include "base/threading/thread_task_runner_handle.h" |
#include "base/time/time.h" |
@@ -69,16 +69,18 @@ enum HostsParseWinResult { |
}; |
// Convenience for reading values using RegKey. |
-class RegistryReader : public base::NonThreadSafe { |
+class RegistryReader { |
public: |
explicit RegistryReader(const wchar_t* key) { |
// Ignoring the result. |key_.Valid()| will catch failures. |
key_.Open(HKEY_LOCAL_MACHINE, key, KEY_QUERY_VALUE); |
} |
+ ~RegistryReader() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } |
+ |
bool ReadString(const wchar_t* name, |
DnsSystemSettings::RegString* out) const { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
out->set = false; |
if (!key_.Valid()) { |
// Assume that if the |key_| is invalid then the key is missing. |
@@ -94,7 +96,7 @@ class RegistryReader : public base::NonThreadSafe { |
bool ReadDword(const wchar_t* name, |
DnsSystemSettings::RegDword* out) const { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
out->set = false; |
if (!key_.Valid()) { |
// Assume that if the |key_| is invalid then the key is missing. |
@@ -111,6 +113,8 @@ class RegistryReader : public base::NonThreadSafe { |
private: |
base::win::RegKey key_; |
+ THREAD_CHECKER(thread_checker_); |
+ |
DISALLOW_COPY_AND_ASSIGN(RegistryReader); |
}; |
@@ -287,13 +291,15 @@ HostsParseWinResult AddLocalhostEntries(DnsHosts* hosts) { |
} |
// Watches a single registry key for changes. |
-class RegistryWatcher : public base::NonThreadSafe { |
+class RegistryWatcher { |
public: |
typedef base::Callback<void(bool succeeded)> CallbackType; |
RegistryWatcher() {} |
+ ~RegistryWatcher() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } |
+ |
bool Watch(const wchar_t* key, const CallbackType& callback) { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
DCHECK(!callback.is_null()); |
DCHECK(callback_.is_null()); |
callback_ = callback; |
@@ -305,7 +311,7 @@ class RegistryWatcher : public base::NonThreadSafe { |
} |
void OnObjectSignaled() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
DCHECK(!callback_.is_null()); |
if (key_.StartWatching(base::Bind(&RegistryWatcher::OnObjectSignaled, |
base::Unretained(this)))) { |
@@ -320,6 +326,8 @@ class RegistryWatcher : public base::NonThreadSafe { |
CallbackType callback_; |
base::win::RegKey key_; |
+ THREAD_CHECKER(thread_checker_); |
+ |
DISALLOW_COPY_AND_ASSIGN(RegistryWatcher); |
}; |