summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/message_loop.cc5
-rw-r--r--base/message_loop.h3
-rw-r--r--chrome/browser/browser_process_impl.cc1
3 files changed, 9 insertions, 0 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc
index c1d4abb..f72ded1 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -408,6 +408,11 @@ void MessageLoop::AssertIdle() const {
DCHECK(incoming_queue_.empty());
}
+bool MessageLoop::is_running() const {
+ DCHECK_EQ(this, current());
+ return state_ != NULL;
+}
+
//------------------------------------------------------------------------------
// Runs the loop in two different SEH modes:
diff --git a/base/message_loop.h b/base/message_loop.h
index d94dc2f..16e9dd5 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -376,6 +376,9 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate {
}
#endif // OS_WIN
+ // Can only be called from the thread that owns the MessageLoop.
+ bool is_running() const;
+
//----------------------------------------------------------------------------
protected:
struct RunState {
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 0623619..81c463a 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -324,6 +324,7 @@ unsigned int BrowserProcessImpl::ReleaseModule() {
DCHECK_NE(0u, module_ref_count_);
module_ref_count_--;
if (0 == module_ref_count_) {
+ CHECK(MessageLoop::current()->is_running());
// Allow UI and IO threads to do blocking IO on shutdown, since we do a lot
// of it on shutdown for valid reasons.
base::ThreadRestrictions::SetIOAllowed(true);