diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-15 01:04:29 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-15 01:04:29 +0000 |
commit | e6e55fb4b70fb47c6959b68e0cccd328bed9c358 (patch) | |
tree | b64c70cf9103bd759169c65752adc546fe89d4f4 /base/message_loop.cc | |
parent | ea04a4e187e030cbc340710285e574f66cc563ac (diff) | |
download | chromium_src-e6e55fb4b70fb47c6959b68e0cccd328bed9c358.zip chromium_src-e6e55fb4b70fb47c6959b68e0cccd328bed9c358.tar.gz chromium_src-e6e55fb4b70fb47c6959b68e0cccd328bed9c358.tar.bz2 |
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
Diffstat (limited to 'base/message_loop.cc')
-rw-r--r-- | base/message_loop.cc | 33 |
1 files changed, 16 insertions, 17 deletions
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 @@ MessageLoop::MessageLoop(Type type) 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() { |