diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 21:12:34 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 21:12:34 +0000 |
commit | faabcf4802395d91b82dd671422b78bfb46b1bef (patch) | |
tree | fa4e91ece94e10ef536ceb78b2a87572716bae81 | |
parent | 41062d78a4152732437192f7131c58d5fa66516d (diff) | |
download | chromium_src-faabcf4802395d91b82dd671422b78bfb46b1bef.zip chromium_src-faabcf4802395d91b82dd671422b78bfb46b1bef.tar.gz chromium_src-faabcf4802395d91b82dd671422b78bfb46b1bef.tar.bz2 |
Promotes Add/RemoveObserver to MessageLoop for linux. Because
message_loop.h now includes message_pump_glib.h I needed to update the
dependencies of a couple of projects.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/112032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16317 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/base.gyp | 3 | ||||
-rw-r--r-- | base/message_loop.cc | 20 | ||||
-rw-r--r-- | base/message_loop.h | 15 |
3 files changed, 29 insertions, 9 deletions
diff --git a/base/base.gyp b/base/base.gyp index 003e14c..e6f941e 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -431,6 +431,9 @@ '-lrt', ], }, + 'export_dependent_settings': [ + '../build/linux/system.gyp:gtk', + ], }, { # else: OS != "linux" 'sources/': [ diff --git a/base/message_loop.cc b/base/message_loop.cc index 4f9dc0b..e010c73 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -565,6 +565,18 @@ const LinearHistogram::DescriptionPair MessageLoop::event_descriptions_[] = { //------------------------------------------------------------------------------ // MessageLoopForUI +#if defined(OS_LINUX) || defined(OS_WIN) + +void MessageLoopForUI::AddObserver(Observer* observer) { + pump_ui()->AddObserver(observer); +} + +void MessageLoopForUI::RemoveObserver(Observer* observer) { + pump_ui()->RemoveObserver(observer); +} + +#endif + #if defined(OS_WIN) void MessageLoopForUI::Run(Dispatcher* dispatcher) { @@ -573,14 +585,6 @@ void MessageLoopForUI::Run(Dispatcher* dispatcher) { RunHandler(); } -void MessageLoopForUI::AddObserver(Observer* observer) { - pump_win()->AddObserver(observer); -} - -void MessageLoopForUI::RemoveObserver(Observer* observer) { - pump_win()->RemoveObserver(observer); -} - void MessageLoopForUI::WillProcessMessage(const MSG& message) { pump_win()->WillProcessMessage(message); } diff --git a/base/message_loop.h b/base/message_loop.h index d5ef281..0b89e28 100644 --- a/base/message_loop.h +++ b/base/message_loop.h @@ -25,6 +25,9 @@ #elif defined(OS_POSIX) #include "base/message_pump_libevent.h" #endif +#if defined(OS_LINUX) +#include "base/message_pump_glib.h" +#endif // A MessageLoop is used to process events for a particular thread. There is // at most one MessageLoop instance per thread. @@ -413,18 +416,28 @@ class MessageLoopForUI : public MessageLoop { return static_cast<MessageLoopForUI*>(loop); } +#if defined(OS_LINUX) + typedef base::MessagePumpForUI::Observer Observer; + + // See message_pump_glib for definitions of these methods. + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); +#endif + #if defined(OS_WIN) typedef base::MessagePumpWin::Dispatcher Dispatcher; typedef base::MessagePumpWin::Observer Observer; // Please see MessagePumpWin for definitions of these methods. - void Run(Dispatcher* dispatcher); void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); + void Run(Dispatcher* dispatcher); void WillProcessMessage(const MSG& message); void DidProcessMessage(const MSG& message); void PumpOutPendingPaintMessages(); +#endif +#if defined(OS_WIN) || defined(OS_LINUX) protected: // TODO(rvargas): Make this platform independent. base::MessagePumpForUI* pump_ui() { |