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

Side by Side Diff: cc/base/completion_event.h

Issue 2790173005: cc: Dump scheduler and tile manager state when commit is blocked. (Closed)
Patch Set: vmpstr review Created 3 years, 8 months 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
« no previous file with comments | « no previous file | cc/trees/proxy_impl.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 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"
(...skipping 25 matching lines...) Expand all
36 36
37 void Wait() { 37 void Wait() {
38 #if DCHECK_IS_ON() 38 #if DCHECK_IS_ON()
39 DCHECK(!waited_); 39 DCHECK(!waited_);
40 waited_ = true; 40 waited_ = true;
41 #endif 41 #endif
42 base::ThreadRestrictions::ScopedAllowWait allow_wait; 42 base::ThreadRestrictions::ScopedAllowWait allow_wait;
43 event_.Wait(); 43 event_.Wait();
44 } 44 }
45 45
46 void TimedWait(const base::TimeDelta& max_time) { 46 bool TimedWait(const base::TimeDelta& max_time) {
47 #if DCHECK_IS_ON() 47 #if DCHECK_IS_ON()
48 DCHECK(!waited_); 48 DCHECK(!waited_);
49 waited_ = true; 49 waited_ = true;
50 #endif 50 #endif
51 event_.TimedWait(max_time); 51 base::ThreadRestrictions::ScopedAllowWait allow_wait;
52 if (event_.TimedWait(max_time))
53 return true;
54 #if DCHECK_IS_ON()
55 waited_ = false;
56 #endif
57 return false;
52 } 58 }
53 59
54 bool IsSignaled() { return event_.IsSignaled(); } 60 bool IsSignaled() { return event_.IsSignaled(); }
55 61
56 void Signal() { 62 void Signal() {
57 #if DCHECK_IS_ON() 63 #if DCHECK_IS_ON()
58 DCHECK(!signaled_); 64 DCHECK(!signaled_);
59 signaled_ = true; 65 signaled_ = true;
60 #endif 66 #endif
61 event_.Signal(); 67 event_.Signal();
62 } 68 }
63 69
64 private: 70 private:
65 base::WaitableEvent event_; 71 base::WaitableEvent event_;
66 #if DCHECK_IS_ON() 72 #if DCHECK_IS_ON()
67 // Used to assert that Wait() and Signal() are each called exactly once. 73 // Used to assert that Wait() and Signal() are each called exactly once.
68 bool waited_; 74 bool waited_;
69 bool signaled_; 75 bool signaled_;
70 #endif 76 #endif
71 }; 77 };
72 78
73 } // namespace cc 79 } // namespace cc
74 80
75 #endif // CC_BASE_COMPLETION_EVENT_H_ 81 #endif // CC_BASE_COMPLETION_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | cc/trees/proxy_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698