Deprecate NonThreadSafe in net/ in favor of ThreadChecker.
This change was scripted by the ThreadChecker equivalent of https://crbug.com/676387#c8.
Noteworthy:
* ~NonThreadSafe() used to implicitly check, ~ThreadChecker() doesn't so explicit
checks were added in relevant destructors to maintain status quo
* NonThreadSafe provided a public interface for CalledOnValidThread() and protected
for DetachFromThread(). The ThreadChecker was exposed as protected where required
and public AssertCalledOnValidThread() methods added as appropriate.
BUG=676387
TBR=alokp,benwells
Review-Url: https://codereview.chromium.org/2910473005
Cr-Commit-Position: refs/heads/master@{#476681}
diff --git a/net/url_request/url_request_throttler_manager.cc b/net/url_request/url_request_throttler_manager.cc
index 1238267..23ffab916 100644
--- a/net/url_request/url_request_throttler_manager.cc
+++ b/net/url_request/url_request_throttler_manager.cc
@@ -31,6 +31,7 @@
}
URLRequestThrottlerManager::~URLRequestThrottlerManager() {
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
NetworkChangeNotifier::RemoveIPAddressObserver(this);
NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
@@ -50,7 +51,9 @@
scoped_refptr<URLRequestThrottlerEntryInterface>
URLRequestThrottlerManager::RegisterRequestUrl(const GURL &url) {
- DCHECK(!enable_thread_checks_ || CalledOnValidThread());
+#if DCHECK_IS_ON()
+ DCHECK(!enable_thread_checks_ || thread_checker_.CalledOnValidThread());
+#endif
// Normalize the url.
std::string url_id = GetIdFromUrl(url);