OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_ |
6 #define THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_ |
7 | 7 |
8 #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" | 8 #include "mojo/public/cpp/system/macros.h" |
9 | 9 |
10 #if !defined(_WIN32) | 10 #if !defined(_WIN32) |
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/lib/thread_checker_posix
.h" | 11 #include "mojo/public/cpp/bindings/lib/thread_checker_posix.h" |
12 #endif | 12 #endif |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 class ThreadCheckerDoNothing { | 17 class ThreadCheckerDoNothing { |
18 public: | 18 public: |
19 bool CalledOnValidThread() const MOJO_WARN_UNUSED_RESULT { | 19 bool CalledOnValidThread() const MOJO_WARN_UNUSED_RESULT { |
20 return true; | 20 return true; |
21 } | 21 } |
22 }; | 22 }; |
23 | 23 |
24 // ThreadChecker is a class used to verify that some methods of a class are | 24 // ThreadChecker is a class used to verify that some methods of a class are |
25 // called from the same thread. It is meant to be a member variable of a class. | 25 // called from the same thread. It is meant to be a member variable of a class. |
26 // The entire lifecycle of a ThreadChecker must occur on a single thread. | 26 // The entire lifecycle of a ThreadChecker must occur on a single thread. |
27 // In Release mode (without dcheck_always_on), ThreadChecker does nothing. | 27 // In Release mode (without dcheck_always_on), ThreadChecker does nothing. |
28 #if !defined(_WIN32) && (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) | 28 #if !defined(_WIN32) && (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) |
29 using ThreadChecker = ThreadCheckerPosix; | 29 using ThreadChecker = ThreadCheckerPosix; |
30 #else | 30 #else |
31 using ThreadChecker = ThreadCheckerDoNothing; | 31 using ThreadChecker = ThreadCheckerDoNothing; |
32 #endif | 32 #endif |
33 | 33 |
34 } // namespace internal | 34 } // namespace internal |
35 } // namespace mojo | 35 } // namespace mojo |
36 | 36 |
37 #endif // THIRD_PARTY_MOJO_SRC_MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_ | 37 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_THREAD_CHECKER_H_ |
OLD | NEW |