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

Unified Diff: net/url_request/url_request_throttler_manager.h

Issue 6599004: Modify ThreadChecker and NonThreadSafe so that their functionality is (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to current lkgr Created 9 years, 10 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
Index: net/url_request/url_request_throttler_manager.h
diff --git a/net/url_request/url_request_throttler_manager.h b/net/url_request/url_request_throttler_manager.h
index 1862cd0622b8bc2de2acbfa0cb94d338ab744678..376e9f7df235e7f6e868fdfdcf45f68954caed72 100644
--- a/net/url_request/url_request_throttler_manager.h
+++ b/net/url_request/url_request_throttler_manager.h
@@ -11,37 +11,12 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "base/singleton.h"
-#include "base/synchronization/lock.h" // ThreadCheckerForRelease
-#include "base/threading/platform_thread.h" // ThreadCheckerForRelease
+#include "base/threading/thread_checker.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_throttler_entry.h"
namespace net {
-// TODO(joi): Delete this temporary copy of base::ThreadChecker (needed to
-// enable it in release builds) and go back to simply inheriting from
-// NonThreadSafe once crbug.com/71721 has been tracked down.
-class ThreadCheckerForRelease {
- public:
- ThreadCheckerForRelease();
- ~ThreadCheckerForRelease();
-
- bool CalledOnValidThread() const;
-
- // Changes the thread that is checked for in CalledOnValidThread. This may
- // be useful when an object may be created on one thread and then used
- // exclusively on another thread.
- void DetachFromThread();
-
- private:
- void EnsureThreadIdAssigned() const;
-
- mutable base::Lock lock_;
- // This is mutable so that CalledOnValidThread can set it.
- // It's guarded by |lock_|.
- mutable base::PlatformThreadId valid_thread_id_;
-};
-
// Class that registers URL request throttler entries for URLs being accessed
// in order to supervise traffic. URL requests for HTTP contents should
// register their URLs in this manager on each request.
@@ -53,10 +28,7 @@ class ThreadCheckerForRelease {
// and path. All URLs converted to the same ID will share the same entry.
//
// NOTE: All usage of the singleton object of this class should be on the same
-// thread.
-//
-// TODO(joi): Switch back to NonThreadSafe (and remove checks in release builds)
-// once crbug.com/71721 has been tracked down.
+// thread (construction and destruction excluded).
class URLRequestThrottlerManager {
public:
static URLRequestThrottlerManager* GetInstance();
@@ -141,7 +113,11 @@ class URLRequestThrottlerManager {
// workaround.
bool being_tested_;
- ThreadCheckerForRelease thread_checker_;
+ // Check threads even in release builds.
+ //
+ // TODO(joi): Switch back to just inheriting NonThreadSafe once
+ // crbug.com/71721 has been tracked down.
+ base::ThreadCheckerImpl thread_checker_;
DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager);
};

Powered by Google App Engine
This is Rietveld 408576698