security/sandbox/chromium/base/threading/thread_checker_impl.h

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #ifndef BASE_THREADING_THREAD_CHECKER_IMPL_H_
michael@0 6 #define BASE_THREADING_THREAD_CHECKER_IMPL_H_
michael@0 7
michael@0 8 #include "base/base_export.h"
michael@0 9 #include "base/synchronization/lock.h"
michael@0 10 #include "base/threading/platform_thread.h"
michael@0 11
michael@0 12 namespace base {
michael@0 13
michael@0 14 // Real implementation of ThreadChecker, for use in debug mode, or
michael@0 15 // for temporary use in release mode (e.g. to CHECK on a threading issue
michael@0 16 // seen only in the wild).
michael@0 17 //
michael@0 18 // Note: You should almost always use the ThreadChecker class to get the
michael@0 19 // right version for your build configuration.
michael@0 20 class BASE_EXPORT ThreadCheckerImpl {
michael@0 21 public:
michael@0 22 ThreadCheckerImpl();
michael@0 23 ~ThreadCheckerImpl();
michael@0 24
michael@0 25 bool CalledOnValidThread() const;
michael@0 26
michael@0 27 // Changes the thread that is checked for in CalledOnValidThread. This may
michael@0 28 // be useful when an object may be created on one thread and then used
michael@0 29 // exclusively on another thread.
michael@0 30 void DetachFromThread();
michael@0 31
michael@0 32 private:
michael@0 33 void EnsureThreadIdAssigned() const;
michael@0 34
michael@0 35 mutable base::Lock lock_;
michael@0 36 // This is mutable so that CalledOnValidThread can set it.
michael@0 37 // It's guarded by |lock_|.
michael@0 38 mutable PlatformThreadId valid_thread_id_;
michael@0 39 };
michael@0 40
michael@0 41 } // namespace base
michael@0 42
michael@0 43 #endif // BASE_THREADING_THREAD_CHECKER_IMPL_H_

mercurial