summaryrefslogtreecommitdiffstats
path: root/base/message_pump_libevent.cc
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-13 16:19:23 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-13 16:19:23 +0000
commitb4339c3a96db2efe2bcbf61efbcfcdc2d80e2b84 (patch)
treeea47239cb6ce133a46de57077ef4abb0d6ef2024 /base/message_pump_libevent.cc
parent4672de6247fe7a865b2abeaac1b4a76c9369b7a3 (diff)
downloadchromium_src-b4339c3a96db2efe2bcbf61efbcfcdc2d80e2b84.zip
chromium_src-b4339c3a96db2efe2bcbf61efbcfcdc2d80e2b84.tar.gz
chromium_src-b4339c3a96db2efe2bcbf61efbcfcdc2d80e2b84.tar.bz2
Add thread check to WatchFileDescriptor.
I had a case where I was accidentally calling WatchFileDescriptor from another thread, and it took me a while to debug why I was having problems. This check would've immediately caught my error for me. BUG=none TEST=build Review URL: http://codereview.chromium.org/6410035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85271 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_libevent.cc')
-rw-r--r--base/message_pump_libevent.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index 5154233..24eba1e 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -139,6 +139,9 @@ bool MessagePumpLibevent::WatchFileDescriptor(int fd,
DCHECK(controller);
DCHECK(delegate);
DCHECK(mode == WATCH_READ || mode == WATCH_WRITE || mode == WATCH_READ_WRITE);
+ // WatchFileDescriptor should be called on the pump thread. It is not
+ // threadsafe, and your watcher may never be registered.
+ DCHECK(watch_file_descriptor_caller_checker_.CalledOnValidThread());
int event_mask = persistent ? EV_PERSIST : 0;
if ((mode & WATCH_READ) != 0) {