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

Side by Side Diff: base/threading/thread_checker.h

Issue 57463003: more spell checking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/threading/non_thread_safe.h ('k') | ipc/ipc_message_macros.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_THREADING_THREAD_CHECKER_H_ 5 #ifndef BASE_THREADING_THREAD_CHECKER_H_
6 #define BASE_THREADING_THREAD_CHECKER_H_ 6 #define BASE_THREADING_THREAD_CHECKER_H_
7 7
8 // Apart from debug builds, we also enable the thread checker in 8 // Apart from debug builds, we also enable the thread checker in
9 // builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots 9 // builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots
10 // with this define will get the same level of thread checking as 10 // with this define will get the same level of thread checking as
(...skipping 28 matching lines...) Expand all
39 void DetachFromThread() {} 39 void DetachFromThread() {}
40 }; 40 };
41 41
42 // ThreadChecker is a helper class used to help verify that some methods of a 42 // ThreadChecker is a helper class used to help verify that some methods of a
43 // class are called from the same thread. It provides identical functionality to 43 // class are called from the same thread. It provides identical functionality to
44 // base::NonThreadSafe, but it is meant to be held as a member variable, rather 44 // base::NonThreadSafe, but it is meant to be held as a member variable, rather
45 // than inherited from base::NonThreadSafe. 45 // than inherited from base::NonThreadSafe.
46 // 46 //
47 // While inheriting from base::NonThreadSafe may give a clear indication about 47 // While inheriting from base::NonThreadSafe may give a clear indication about
48 // the thread-safety of a class, it may also lead to violations of the style 48 // the thread-safety of a class, it may also lead to violations of the style
49 // guide with regard to multiple inheritence. The choice between having a 49 // guide with regard to multiple inheritance. The choice between having a
50 // ThreadChecker member and inheriting from base::NonThreadSafe should be based 50 // ThreadChecker member and inheriting from base::NonThreadSafe should be based
51 // on whether: 51 // on whether:
52 // - Derived classes need to know the thread they belong to, as opposed to 52 // - Derived classes need to know the thread they belong to, as opposed to
53 // having that functionality fully encapsulated in the base class. 53 // having that functionality fully encapsulated in the base class.
54 // - Derived classes should be able to reassign the base class to another 54 // - Derived classes should be able to reassign the base class to another
55 // thread, via DetachFromThread. 55 // thread, via DetachFromThread.
56 // 56 //
57 // If neither of these are true, then having a ThreadChecker member and calling 57 // If neither of these are true, then having a ThreadChecker member and calling
58 // CalledOnValidThread is the preferable solution. 58 // CalledOnValidThread is the preferable solution.
59 // 59 //
(...skipping 16 matching lines...) Expand all
76 #else 76 #else
77 class ThreadChecker : public ThreadCheckerDoNothing { 77 class ThreadChecker : public ThreadCheckerDoNothing {
78 }; 78 };
79 #endif // ENABLE_THREAD_CHECKER 79 #endif // ENABLE_THREAD_CHECKER
80 80
81 #undef ENABLE_THREAD_CHECKER 81 #undef ENABLE_THREAD_CHECKER
82 82
83 } // namespace base 83 } // namespace base
84 84
85 #endif // BASE_THREADING_THREAD_CHECKER_H_ 85 #endif // BASE_THREADING_THREAD_CHECKER_H_
OLDNEW
« no previous file with comments | « base/threading/non_thread_safe.h ('k') | ipc/ipc_message_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698