summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-26 00:53:48 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-26 00:53:48 +0000
commit8d6ab8f55fd416074c751242e23634476a19b9ca (patch)
tree7b9217567bb114c4cbede21418c669fd67907443 /base
parenta87078352ef50bf6ea9ebc3598a7d23c17e69817 (diff)
downloadchromium_src-8d6ab8f55fd416074c751242e23634476a19b9ca.zip
chromium_src-8d6ab8f55fd416074c751242e23634476a19b9ca.tar.gz
chromium_src-8d6ab8f55fd416074c751242e23634476a19b9ca.tar.bz2
Add MessageLoop::AssertIdle(). Use in ChromeOS audio threads.
BUG=chrome-os:11110 TEST=existing Review URL: http://codereview.chromium.org/6374010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/message_loop.cc6
-rw-r--r--base/message_loop.h7
2 files changed, 11 insertions, 2 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 518a0fd..d83adcc 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -286,6 +286,12 @@ void MessageLoop::RemoveTaskObserver(TaskObserver* task_observer) {
task_observers_.RemoveObserver(task_observer);
}
+void MessageLoop::AssertIdle() const {
+ // We only check |incoming_queue_|, since we don't want to lock |work_queue_|.
+ base::AutoLock lock(incoming_queue_lock_);
+ DCHECK(incoming_queue_.empty());
+}
+
//------------------------------------------------------------------------------
// Runs the loop in two different SEH modes:
diff --git a/base/message_loop.h b/base/message_loop.h
index 7a3af6e..d238997 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -315,6 +315,9 @@ class MessageLoop : public base::MessagePump::Delegate {
// for at least 1s.
static const int kHighResolutionTimerModeLeaseTimeMs = 1000;
+ // Asserts that the MessageLoop is "idle".
+ void AssertIdle() const;
+
//----------------------------------------------------------------------------
protected:
struct RunState {
@@ -461,12 +464,12 @@ class MessageLoop : public base::MessagePump::Delegate {
scoped_refptr<base::Histogram> message_histogram_;
// A null terminated list which creates an incoming_queue of tasks that are
- // aquired under a mutex for processing on this instance's thread. These tasks
+ // acquired under a mutex for processing on this instance's thread. These tasks
// have not yet been sorted out into items for our work_queue_ vs items that
// will be handled by the TimerManager.
TaskQueue incoming_queue_;
// Protect access to incoming_queue_.
- base::Lock incoming_queue_lock_;
+ mutable base::Lock incoming_queue_lock_;
RunState* state_;