зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
a252cfa4a2
Коммит
4bce9b46f1
|
@ -356,14 +356,14 @@ public:
|
||||||
ProxyNativeCall(const ProxyNativeCall&) = default;
|
ProxyNativeCall(const ProxyNativeCall&) = default;
|
||||||
|
|
||||||
// Get class ref for static calls or object ref for instance calls.
|
// 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.
|
// Return if target is the given function pointer / pointer-to-member.
|
||||||
// Because we can only compare pointers of the same type, we use a
|
// 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
|
// templated overload that is chosen only if given a different type of
|
||||||
// pointer than our target pointer type.
|
// pointer than our target pointer type.
|
||||||
bool IsTarget(NativeCallType call) { return call == mNativeCall; }
|
bool IsTarget(NativeCallType call) const { return call == mNativeCall; }
|
||||||
template<typename T> bool IsTarget(T&&) { return false; }
|
template<typename T> bool IsTarget(T&&) const { return false; }
|
||||||
|
|
||||||
void operator()()
|
void operator()()
|
||||||
{
|
{
|
||||||
|
|
|
@ -383,7 +383,7 @@ public:
|
||||||
void Run() override;
|
void Run() override;
|
||||||
void PostTo(mozilla::LinkedList<Event>& queue) override;
|
void PostTo(mozilla::LinkedList<Event>& queue) override;
|
||||||
|
|
||||||
mozilla::HangMonitor::ActivityType ActivityType() const
|
Event::Type ActivityType() const override
|
||||||
{
|
{
|
||||||
return ae->IsInputEvent() ? mozilla::HangMonitor::kUIActivity
|
return ae->IsInputEvent() ? mozilla::HangMonitor::kUIActivity
|
||||||
: mozilla::HangMonitor::kGeneralActivity;
|
: mozilla::HangMonitor::kGeneralActivity;
|
||||||
|
|
|
@ -33,6 +33,8 @@ class nsAppShell :
|
||||||
public:
|
public:
|
||||||
struct Event : mozilla::LinkedListElement<Event>
|
struct Event : mozilla::LinkedListElement<Event>
|
||||||
{
|
{
|
||||||
|
typedef mozilla::HangMonitor::ActivityType Type;
|
||||||
|
|
||||||
bool HasSameTypeAs(const Event* other) const
|
bool HasSameTypeAs(const Event* other) const
|
||||||
{
|
{
|
||||||
// Compare vtable addresses to determine same type.
|
// Compare vtable addresses to determine same type.
|
||||||
|
@ -48,9 +50,9 @@ public:
|
||||||
queue.insertBack(this);
|
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();
|
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:
|
public:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче