Bug 1211704 - Count key and IME events as UI events; r=esawin

GeckoEvent.KEY_EVENT and GeckoEvent.IME_EVENT used to count as UI events
for the hang monitor. We should count the new native calls as native
events too through this patch.
This commit is contained in:
Jim Chen 2015-10-22 17:45:47 -04:00
Родитель a252cfa4a2
Коммит 4bce9b46f1
4 изменённых файлов: 22 добавлений и 6 удалений

Просмотреть файл

@ -356,14 +356,14 @@ public:
ProxyNativeCall(const ProxyNativeCall&) = default;
// Get class ref for static calls or object ref for instance calls.
typename ThisArgClass::Param GetThisArg() { return mThisArg; }
typename ThisArgClass::Param GetThisArg() const { return mThisArg; }
// Return if target is the given function pointer / pointer-to-member.
// Because we can only compare pointers of the same type, we use a
// templated overload that is chosen only if given a different type of
// pointer than our target pointer type.
bool IsTarget(NativeCallType call) { return call == mNativeCall; }
template<typename T> bool IsTarget(T&&) { return false; }
bool IsTarget(NativeCallType call) const { return call == mNativeCall; }
template<typename T> bool IsTarget(T&&) const { return false; }
void operator()()
{

Просмотреть файл

@ -383,7 +383,7 @@ public:
void Run() override;
void PostTo(mozilla::LinkedList<Event>& queue) override;
mozilla::HangMonitor::ActivityType ActivityType() const
Event::Type ActivityType() const override
{
return ae->IsInputEvent() ? mozilla::HangMonitor::kUIActivity
: mozilla::HangMonitor::kGeneralActivity;

Просмотреть файл

@ -33,6 +33,8 @@ class nsAppShell :
public:
struct Event : mozilla::LinkedListElement<Event>
{
typedef mozilla::HangMonitor::ActivityType Type;
bool HasSameTypeAs(const Event* other) const
{
// Compare vtable addresses to determine same type.
@ -48,9 +50,9 @@ public:
queue.insertBack(this);
}
virtual mozilla::HangMonitor::ActivityType ActivityType() const
virtual Type ActivityType() const
{
return mozilla::HangMonitor::kGeneralActivity;
return Type::kGeneralActivity;
}
};

Просмотреть файл

@ -200,6 +200,20 @@ class nsWindow::Natives final
return Base::Run();
}
}
nsAppShell::Event::Type ActivityType() const override
{
// Events that result in user-visible changes count as UI events.
if (Base::lambda.IsTarget(&Natives::OnKeyEvent) ||
Base::lambda.IsTarget(&Natives::OnImeReplaceText) ||
Base::lambda.IsTarget(&Natives::OnImeSetSelection) ||
Base::lambda.IsTarget(&Natives::OnImeRemoveComposition) ||
Base::lambda.IsTarget(&Natives::OnImeUpdateComposition))
{
return nsAppShell::Event::Type::kUIActivity;
}
return Base::ActivityType();
}
};
public: