OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CC_BASE_COMPLETION_EVENT_H_ | 5 #ifndef CC_BASE_COMPLETION_EVENT_H_ |
6 #define CC_BASE_COMPLETION_EVENT_H_ | 6 #define CC_BASE_COMPLETION_EVENT_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "cc/base/base_export.h" |
12 | 13 |
13 namespace cc { | 14 namespace cc { |
14 | 15 |
15 // Used for making blocking calls from one thread to another. Use only when | 16 // Used for making blocking calls from one thread to another. Use only when |
16 // absolutely certain that doing-so will not lead to a deadlock. | 17 // absolutely certain that doing-so will not lead to a deadlock. |
17 // | 18 // |
18 // It is safe to destroy this object as soon as Wait() returns. | 19 // It is safe to destroy this object as soon as Wait() returns. |
19 class CompletionEvent { | 20 class CC_BASE_EXPORT CompletionEvent { |
20 public: | 21 public: |
21 CompletionEvent() | 22 CompletionEvent() |
22 : event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 23 : event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
23 base::WaitableEvent::InitialState::NOT_SIGNALED) { | 24 base::WaitableEvent::InitialState::NOT_SIGNALED) { |
24 #if DCHECK_IS_ON() | 25 #if DCHECK_IS_ON() |
25 waited_ = false; | 26 waited_ = false; |
26 signaled_ = false; | 27 signaled_ = false; |
27 #endif | 28 #endif |
28 } | 29 } |
29 | 30 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #if DCHECK_IS_ON() | 67 #if DCHECK_IS_ON() |
67 // Used to assert that Wait() and Signal() are each called exactly once. | 68 // Used to assert that Wait() and Signal() are each called exactly once. |
68 bool waited_; | 69 bool waited_; |
69 bool signaled_; | 70 bool signaled_; |
70 #endif | 71 #endif |
71 }; | 72 }; |
72 | 73 |
73 } // namespace cc | 74 } // namespace cc |
74 | 75 |
75 #endif // CC_BASE_COMPLETION_EVENT_H_ | 76 #endif // CC_BASE_COMPLETION_EVENT_H_ |
OLD | NEW |