Make MessageLoop::MessageLoop easier to read.

BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1655007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44595 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: e6e55fb4b70fb47c6959b68e0cccd328bed9c358
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 6a73124..7a09f38 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -85,29 +85,28 @@
   DCHECK(!current()) << "should only have one message loop per thread";
   lazy_tls_ptr.Pointer()->Set(this);
 
+// TODO(rvargas): Get rid of the OS guards.
 #if defined(OS_WIN)
-  // TODO(rvargas): Get rid of the OS guards.
-  if (type_ == TYPE_DEFAULT) {
-    pump_ = new base::MessagePumpDefault();
-  } else if (type_ == TYPE_IO) {
-    pump_ = new base::MessagePumpForIO();
-  } else {
-    DCHECK(type_ == TYPE_UI);
-    pump_ = new base::MessagePumpForUI();
-  }
-#elif defined(OS_POSIX)
-  if (type_ == TYPE_UI) {
-#if defined(OS_MACOSX)
-    pump_ = base::MessagePumpMac::Create();
+#define MESSAGE_PUMP_UI new base::MessagePumpForUI()
+#define MESSAGE_PUMP_IO new base::MessagePumpForIO()
+#elif defined(OS_MACOSX)
+#define MESSAGE_PUMP_UI base::MessagePumpMac::Create()
+#define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
+#elif defined(OS_POSIX)  // POSIX but not MACOSX.
+#define MESSAGE_PUMP_UI new base::MessagePumpForUI()
+#define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
 #else
-    pump_ = new base::MessagePumpForUI();
+#error Not implemented
 #endif
+
+  if (type_ == TYPE_UI) {
+    pump_ = MESSAGE_PUMP_UI;
   } else if (type_ == TYPE_IO) {
-    pump_ = new base::MessagePumpLibevent();
+    pump_ = MESSAGE_PUMP_IO;
   } else {
+    DCHECK_EQ(TYPE_DEFAULT, type_);
     pump_ = new base::MessagePumpDefault();
   }
-#endif  // OS_POSIX
 }
 
 MessageLoop::~MessageLoop() {