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

Unified Diff: net/dns/dns_config_service_win.cc

Issue 2910473005: Deprecate NonThreadSafe in net/ in favor of SequenceChecker/ThreadChecker. (Closed)
Patch Set: rebase on r476634 Created 3 years, 7 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_transaction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « net/dns/dns_config_service_posix.cc ('k') | net/dns/dns_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698