Bug 1351148 Part2: Add a priority queue for input events. r=smaug.
MozReview-Commit-ID: 5ud1Ex9UNVo
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/AbstractThread.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/SystemGroup.h"
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
#ifdef MOZ_CANARY
|
||||
@@ -19,6 +20,7 @@
|
||||
#endif
|
||||
|
||||
#include "MainThreadIdlePeriod.h"
|
||||
#include "InputEventStatistics.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@@ -406,6 +408,25 @@ nsThreadManager::DispatchToMainThread(nsIRunnable *aEvent)
|
||||
return mMainThread->DispatchFromScript(aEvent, 0);
|
||||
}
|
||||
|
||||
void
|
||||
nsThreadManager::EnableMainThreadEventPrioritization()
|
||||
{
|
||||
static bool sIsInitialized = false;
|
||||
if (sIsInitialized) {
|
||||
return;
|
||||
}
|
||||
sIsInitialized = true;
|
||||
MOZ_ASSERT(Preferences::IsServiceAvailable());
|
||||
bool enable =
|
||||
Preferences::GetBool("prioritized_input_events.enabled", false);
|
||||
|
||||
if (!enable) {
|
||||
return;
|
||||
}
|
||||
InputEventStatistics::Get().SetEnable(true);
|
||||
mMainThread->EnableEventPrioritization();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsThreadManager::IdleDispatchToMainThread(nsIRunnable *aEvent, uint32_t aTimeout)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user