Chromium Code Reviews| Index: base/message_loop.h |
| diff --git a/base/message_loop.h b/base/message_loop.h |
| index 9d500d7dd898a0e8e344328b310352823f8c6392..540c74dfac56b3c7c7d3d0faa30bfd4fa6183a79 100644 |
| --- a/base/message_loop.h |
| +++ b/base/message_loop.h |
| @@ -115,6 +115,11 @@ class BASE_API MessageLoop : public base::MessagePump::Delegate { |
| static void EnableHistogrammer(bool enable_histogrammer); |
| + typedef base::MessagePump* (MessagePumpFactory)(); |
| + // Using the given base::MessagePumpForUIFactory to override the default |
|
M-A Ruel
2011/11/11 13:09:07
Can you use an action sentence instead?
|
| + // MessagePump implementation for 'TYPE_UI'. |
| + static void InitMessagePumpForUIFactory(MessagePumpFactory* factory); |
| + |
| // A DestructionObserver is notified when the current MessageLoop is being |
| // destroyed. These obsevers are notified prior to MessageLoop::current() |
| // being changed to return NULL. This gives interested parties the chance to |
| @@ -368,11 +373,16 @@ class BASE_API MessageLoop : public base::MessagePump::Delegate { |
| // once it becomes idle. |
| bool quit_received; |
| -#if !defined(OS_MACOSX) |
| +#if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| Dispatcher* dispatcher; |
| #endif |
| }; |
| +#if defined(OS_ANDROID) |
| + // Android Java process manages the UI thread message loop. So its |
| + // MessagePumpForUI needs to keep the RunState. |
| + public: |
| +#endif |
| class BASE_API AutoRunState : RunState { |
| public: |
| explicit AutoRunState(MessageLoop* loop); |
| @@ -381,6 +391,9 @@ class BASE_API MessageLoop : public base::MessagePump::Delegate { |
| MessageLoop* loop_; |
| RunState* previous_state_; |
| }; |
| +#if defined(OS_ANDROID) |
| + protected: |
| +#endif |
| // This structure is copied around by value. |
| struct PendingTask { |
| @@ -583,7 +596,12 @@ class BASE_API MessageLoopForUI : public MessageLoop { |
| void DidProcessMessage(const MSG& message); |
| #endif // defined(OS_WIN) |
| -#if !defined(OS_MACOSX) |
| +#if defined(OS_ANDROID) |
| + // On Android, the UI message loop is handled by Java side. So Run() should |
| + // never be called. Instead use Start(), which will forward all the native UI |
| + // events to the Java message loop. |
| + void Start(); |
| +#elif !defined(OS_MACOSX) |
| // Please see message_pump_win/message_pump_glib for definitions of these |
| // methods. |
| void AddObserver(Observer* observer); |