зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1315570, vsync handling in parent process' main thread should use high priority runnables, r=ehsan
--HG-- extra : rebase_source : db5995cace3ed5e8d8dd2d095c725c3ce9f5c4e2
This commit is contained in:
Родитель
0b5d08769a
Коммит
6a96b12f98
|
@ -7,6 +7,8 @@
|
|||
|
||||
// Tests the various highlight command parameters and options
|
||||
|
||||
requestLongerTimeout(3);
|
||||
|
||||
// Creating a test page with many elements to test the --showall option
|
||||
var TEST_PAGE = "data:text/html;charset=utf-8,<body><ul>";
|
||||
for (let i = 0; i < 101; i++) {
|
||||
|
|
|
@ -493,6 +493,34 @@ private:
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
}
|
||||
|
||||
class ParentProcessVsyncNotifier final: public Runnable,
|
||||
public nsIRunnablePriority
|
||||
{
|
||||
public:
|
||||
ParentProcessVsyncNotifier(RefreshDriverVsyncObserver* aObserver,
|
||||
TimeStamp aVsyncTimestamp)
|
||||
: mObserver(aObserver), mVsyncTimestamp(aVsyncTimestamp) {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
mObserver->TickRefreshDriver(mVsyncTimestamp);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetPriority(uint32_t* aPriority) override
|
||||
{
|
||||
*aPriority = nsIRunnablePriority::PRIORITY_HIGH;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
~ParentProcessVsyncNotifier() {}
|
||||
RefPtr<RefreshDriverVsyncObserver> mObserver;
|
||||
TimeStamp mVsyncTimestamp;
|
||||
};
|
||||
|
||||
bool NotifyVsync(TimeStamp aVsyncTimestamp) override
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
|
@ -510,9 +538,7 @@ private:
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> vsyncEvent =
|
||||
NewRunnableMethod<TimeStamp>(this,
|
||||
&RefreshDriverVsyncObserver::TickRefreshDriver,
|
||||
aVsyncTimestamp);
|
||||
new ParentProcessVsyncNotifier(this, aVsyncTimestamp);
|
||||
NS_DispatchToMainThread(vsyncEvent);
|
||||
} else {
|
||||
TickRefreshDriver(aVsyncTimestamp);
|
||||
|
@ -706,6 +732,11 @@ private:
|
|||
TimeDuration mVsyncRate;
|
||||
}; // VsyncRefreshDriverTimer
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(VsyncRefreshDriverTimer::
|
||||
RefreshDriverVsyncObserver::
|
||||
ParentProcessVsyncNotifier,
|
||||
Runnable, nsIRunnablePriority)
|
||||
|
||||
/**
|
||||
* Since the content process takes some time to setup
|
||||
* the vsync IPC connection, this timer is used
|
||||
|
|
Загрузка…
Ссылка в новой задаче