summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 07:12:22 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 07:12:22 +0000
commit781a7edbdb3288b237acbeff4926b47b243cef17 (patch)
tree04a76bff6c816a5a1095583bd6029485fdc1312b /base
parentaab929a85b3bfe1113902dec3e5c723c552fdfda (diff)
downloadchromium_src-781a7edbdb3288b237acbeff4926b47b243cef17.zip
chromium_src-781a7edbdb3288b237acbeff4926b47b243cef17.tar.gz
chromium_src-781a7edbdb3288b237acbeff4926b47b243cef17.tar.bz2
Add MessageLoop::QuitNow and use it to terminate a sync IPC.
This is a test to observe the performance impact of this change. As such, I'm reverting r39518 as part of this change. R=jam BUG=36310 TEST=none Review URL: http://codereview.chromium.org/652089 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39699 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/message_loop.cc9
-rw-r--r--base/message_loop.h4
2 files changed, 13 insertions, 0 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc
index dbe780a..6a73124 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -233,6 +233,15 @@ void MessageLoop::Quit() {
}
}
+void MessageLoop::QuitNow() {
+ DCHECK(current() == this);
+ if (state_) {
+ pump_->Quit();
+ } else {
+ NOTREACHED() << "Must be inside Run to call Quit";
+ }
+}
+
void MessageLoop::PostTask(
const tracked_objects::Location& from_here, Task* task) {
PostTask_Helper(from_here, task, 0, true);
diff --git a/base/message_loop.h b/base/message_loop.h
index 0338963..1a04323 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -158,6 +158,10 @@ class MessageLoop : public base::MessagePump::Delegate {
//
void Quit();
+ // This method is a variant of Quit, that does not wait for pending messages
+ // to be processed before returning from Run.
+ void QuitNow();
+
// Invokes Quit on the current MessageLoop when run. Useful to schedule an
// arbitrary MessageLoop to Quit.
class QuitTask : public Task {