Chromium Code Reviews| Index: base/synchronization/waitable_event_win.cc |
| diff --git a/base/synchronization/waitable_event_win.cc b/base/synchronization/waitable_event_win.cc |
| index 597716337be9c92fa264fecd524da9c643d9f301..42bb7b969d18a92e8eb48c4c108004533ba37983 100644 |
| --- a/base/synchronization/waitable_event_win.cc |
| +++ b/base/synchronization/waitable_event_win.cc |
| @@ -9,6 +9,7 @@ |
| #include <utility> |
| +#include "base/debug/activity_tracker.h" |
| #include "base/logging.h" |
| #include "base/numerics/safe_conversions.h" |
| #include "base/threading/thread_restrictions.h" |
| @@ -47,6 +48,9 @@ bool WaitableEvent::IsSignaled() { |
| } |
| void WaitableEvent::Wait() { |
| + // Record the event that this thread is blocking upon (for hang diagonsis). |
|
manzagop (departed)
2016/06/16 15:19:41
typo: diagonsis, here an below.
|
| + base::debug::ScopedEventWaitActivity event_activity(this); |
| + |
| base::ThreadRestrictions::AssertWaitAllowed(); |
| DWORD result = WaitForSingleObject(handle_.Get(), INFINITE); |
| // It is most unexpected that this should ever fail. Help consumers learn |
| @@ -55,6 +59,9 @@ void WaitableEvent::Wait() { |
| } |
| bool WaitableEvent::TimedWait(const TimeDelta& max_time) { |
| + // Record the event that this thread is blocking upon (for hang diagonsis). |
| + base::debug::ScopedEventWaitActivity event_activity(this); |
| + |
| base::ThreadRestrictions::AssertWaitAllowed(); |
| DCHECK_GE(max_time, TimeDelta()); |
| // Truncate the timeout to milliseconds. The API specifies that this method |
| @@ -77,6 +84,9 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) { |
| // static |
| size_t WaitableEvent::WaitMany(WaitableEvent** events, size_t count) { |
| + // Record the event that this thread is blocking upon (for hang diagonsis). |
|
manzagop (departed)
2016/06/16 15:19:41
Put a note that this is looking at the first event
bcwhite
2016/06/16 17:04:43
Done.
|
| + base::debug::ScopedEventWaitActivity event_activity(events[0]); |
|
manzagop (departed)
2016/06/16 15:19:41
Can count be 0?
bcwhite
2016/06/16 17:04:43
Done.
|
| + |
| base::ThreadRestrictions::AssertWaitAllowed(); |
| HANDLE handles[MAXIMUM_WAIT_OBJECTS]; |
| CHECK_LE(count, static_cast<size_t>(MAXIMUM_WAIT_OBJECTS)) |