summaryrefslogtreecommitdiffstats
path: root/base/message_pump_libevent.h
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.h
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.h')
-rw-r--r--base/message_pump_libevent.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/base/message_pump_libevent.h b/base/message_pump_libevent.h
index d58d902..16c58a2 100644
--- a/base/message_pump_libevent.h
+++ b/base/message_pump_libevent.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/message_pump.h"
#include "base/observer_list.h"
+#include "base/threading/thread_checker.h"
#include "base/time.h"
// Declare structs we need from libevent.h rather than including it
@@ -105,6 +106,7 @@ class BASE_API MessagePumpLibevent : public MessagePump {
// If an error occurs while calling this method in a cumulative fashion, the
// event previously attached to |controller| is aborted.
// Returns true on success.
+ // Must be called on the same thread the message_pump is running on.
// TODO(dkegel): switch to edge-triggered readiness notification
bool WatchFileDescriptor(int fd,
bool persistent,
@@ -157,7 +159,7 @@ class BASE_API MessagePumpLibevent : public MessagePump {
event* wakeup_event_;
ObserverList<IOObserver> io_observers_;
-
+ ThreadChecker watch_file_descriptor_caller_checker_;
DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent);
};