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


CrOS-Libchrome-Original-Commit: b2f0ea1a109f6406d6633f51adb4621090b9032d
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 @@
     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());
   }
 }