зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1319850 - part 1, Add MessagePumpForAndroidUI r=nfroyd
This commit is contained in:
Родитель
533f46114f
Коммит
dd0237f451
|
@ -463,3 +463,29 @@ MessagePumpForNonMainUIThreads::AfterProcessNextEvent(nsIThreadInternal *thread,
|
|||
}
|
||||
|
||||
#endif // XP_WIN
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
void
|
||||
MessagePumpForAndroidUI::Run(Delegate* delegate)
|
||||
{
|
||||
MOZ_CRASH("MessagePumpForAndroidUI should never be Run.");
|
||||
}
|
||||
|
||||
void
|
||||
MessagePumpForAndroidUI::Quit()
|
||||
{
|
||||
MOZ_CRASH("MessagePumpForAndroidUI should never be Quit.");
|
||||
}
|
||||
|
||||
void
|
||||
MessagePumpForAndroidUI::ScheduleWork()
|
||||
{
|
||||
MOZ_CRASH("MessagePumpForAndroidUI should never ScheduleWork");
|
||||
}
|
||||
|
||||
void
|
||||
MessagePumpForAndroidUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time)
|
||||
{
|
||||
MOZ_CRASH("MessagePumpForAndroidUI should never ScheduleDelayedWork");
|
||||
}
|
||||
#endif // defined(MOZ_WIDGET_ANDROID)
|
||||
|
|
|
@ -164,6 +164,43 @@ private:
|
|||
};
|
||||
#endif // defined(XP_WIN)
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
/*`
|
||||
* The MessagePumpForAndroidUI exists to enable IPDL in the Android UI thread. The Android
|
||||
* UI thread event loop is controlled by Android. This prevents running an existing
|
||||
* MessagePump implementation in the Android UI thread. In order to enable IPDL on the
|
||||
* Android UI thread it is necessary to have a non-looping MessagePump. This class enables
|
||||
* forwarding of nsIRunnables from MessageLoop::PostTask_Helper to the registered
|
||||
* nsIEventTarget with out the need to control the event loop. The only member function
|
||||
* that should be invoked is GetXPCOMThread. All other member functions will invoke MOZ_CRASH
|
||||
*/
|
||||
class MessagePumpForAndroidUI : public base::MessagePump {
|
||||
|
||||
public:
|
||||
MessagePumpForAndroidUI(nsIEventTarget* aEventTarget)
|
||||
: mEventTarget(aEventTarget)
|
||||
{ }
|
||||
|
||||
virtual void Run(Delegate* delegate);
|
||||
virtual void Quit();
|
||||
virtual void ScheduleWork();
|
||||
virtual void ScheduleDelayedWork(const base::TimeTicks& delayed_work_time);
|
||||
virtual nsIEventTarget* GetXPCOMThread()
|
||||
{
|
||||
return mEventTarget;
|
||||
}
|
||||
|
||||
private:
|
||||
~MessagePumpForAndroidUI()
|
||||
{ }
|
||||
MessagePumpForAndroidUI()
|
||||
{ }
|
||||
|
||||
nsIEventTarget* mEventTarget;
|
||||
};
|
||||
#endif // defined(MOZ_WIDGET_ANDROID)
|
||||
|
||||
|
||||
} /* namespace ipc */
|
||||
} /* namespace mozilla */
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче