summaryrefslogtreecommitdiffstats
path: root/base/message_loop.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-02 20:05:21 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-02 20:05:21 +0000
commitb2f0ea1a109f6406d6633f51adb4621090b9032d (patch)
tree8e55db87473c159a3b33ab71091938298e9d1d52 /base/message_loop.cc
parented157a21f003e2dd212d84fa81663c8fc95c8965 (diff)
downloadchromium_src-b2f0ea1a109f6406d6633f51adb4621090b9032d.zip
chromium_src-b2f0ea1a109f6406d6633f51adb4621090b9032d.tar.gz
chromium_src-b2f0ea1a109f6406d6633f51adb4621090b9032d.tar.bz2
Make swapping the incoming queue with the work queue constant time.
This is an alternative to the fix proposed here: http://codereview.chromium.org/172101 Credit goes to Dean McNamee for discovering this performance issue! R=deanm BUG=20204 TEST=none Review URL: http://codereview.chromium.org/190006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25223 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop.cc')
-rw-r--r--base/message_loop.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 5464670..bf5256a 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -354,7 +354,7 @@ void MessageLoop::ReloadWorkQueue() {
AutoLock lock(incoming_queue_lock_);
if (incoming_queue_.empty())
return;
- std::swap(incoming_queue_, work_queue_);
+ incoming_queue_.Swap(&work_queue_); // Constant time
DCHECK(incoming_queue_.empty());
}
}