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

Unified Diff: base/thread_checker.cc

Issue 6001010: Move platform_thread to base/threading and put in the base namespace. I left ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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 | « base/thread_checker.h ('k') | base/thread_checker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/thread_checker.cc
===================================================================
--- base/thread_checker.cc (revision 70328)
+++ base/thread_checker.cc (working copy)
@@ -1,34 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/thread_checker.h"
-
-// This code is only done in debug builds.
-#ifndef NDEBUG
-
-ThreadChecker::ThreadChecker() : valid_thread_id_(kInvalidThreadId) {
- EnsureThreadIdAssigned();
-}
-
-ThreadChecker::~ThreadChecker() {}
-
-bool ThreadChecker::CalledOnValidThread() const {
- EnsureThreadIdAssigned();
- AutoLock auto_lock(lock_);
- return valid_thread_id_ == PlatformThread::CurrentId();
-}
-
-void ThreadChecker::DetachFromThread() {
- AutoLock auto_lock(lock_);
- valid_thread_id_ = kInvalidThreadId;
-}
-
-void ThreadChecker::EnsureThreadIdAssigned() const {
- AutoLock auto_lock(lock_);
- if (valid_thread_id_ != kInvalidThreadId)
- return;
- valid_thread_id_ = PlatformThread::CurrentId();
-}
-
-#endif // NDEBUG
« no previous file with comments | « base/thread_checker.h ('k') | base/thread_checker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698