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

Unified Diff: base/synchronization/waitable_event_win.cc

Issue 1980743002: Track thread activities in order to diagnose hangs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@readwrite-mmf
Patch Set: track locks and waitable events Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: base/synchronization/waitable_event_win.cc
diff --git a/base/synchronization/waitable_event_win.cc b/base/synchronization/waitable_event_win.cc
index 89ace19961a7e7e42bca88e2f0a3663a2e30e763..50d38c4c741a1d7acb017b640b4fd1f84ffaba01 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"
@@ -45,6 +46,7 @@ bool WaitableEvent::IsSignaled() {
void WaitableEvent::Wait() {
base::ThreadRestrictions::AssertWaitAllowed();
+ base::debug::ScopedEventActivity event_activity(this);
DWORD result = WaitForSingleObject(handle_.Get(), INFINITE);
// It is most unexpected that this should ever fail. Help consumers learn
// about it if it should ever fail.
@@ -53,6 +55,7 @@ void WaitableEvent::Wait() {
bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
base::ThreadRestrictions::AssertWaitAllowed();
+ base::debug::ScopedEventActivity event_activity(this);
DCHECK_GE(max_time, TimeDelta());
// Truncate the timeout to milliseconds. The API specifies that this method
// can return in less than |max_time| (when returning false), as the argument
@@ -75,6 +78,7 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
// static
size_t WaitableEvent::WaitMany(WaitableEvent** events, size_t count) {
base::ThreadRestrictions::AssertWaitAllowed();
+ base::debug::ScopedEventActivity event_activity(events[0]);
manzagop (departed) 2016/06/01 21:59:41 A comment for this?
bcwhite 2016/06/02 16:18:16 Done.
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
CHECK_LE(count, static_cast<size_t>(MAXIMUM_WAIT_OBJECTS))
<< "Can only wait on " << MAXIMUM_WAIT_OBJECTS << " with WaitMany";

Powered by Google App Engine
This is Rietveld 408576698