Bug 1506376, make DidComposite to use mediumhigh priority message r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D61083

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Olli Pettay 2020-02-14 16:27:50 +00:00
Родитель 7e6ec0f8b0
Коммит 67bc11ab14
3 изменённых файлов: 20 добавлений и 6 удалений

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

@ -45,6 +45,7 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/Unused.h"
#include "mozilla/DebugOnly.h"
#include "nsThreadUtils.h"
#if defined(XP_WIN)
# include "WinUtils.h"
#endif
@ -109,6 +110,17 @@ bool CompositorBridgeChild::IsSameProcess() const {
return OtherPid() == base::GetCurrentProcId();
}
void CompositorBridgeChild::PrepareFinalDestroy() {
// Because of medium high priority DidComposite, we need to repost to
// medium high priority queue to ensure the actor is destroyed after possible
// pending DidComposite message.
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod("CompositorBridgeChild::AfterDestroy", this,
&CompositorBridgeChild::AfterDestroy);
NS_DispatchToCurrentThreadQueue(runnable.forget(),
EventQueuePriority::MediumHigh);
}
void CompositorBridgeChild::AfterDestroy() {
// Note that we cannot rely upon mCanSend here because we already set that to
// false to prevent normal IPDL calls from being made after SendWillClose.
@ -159,8 +171,8 @@ void CompositorBridgeChild::Destroy() {
// or CompositorBridgeChild::ActorDestroy was called. Ensure that we do our
// post destroy clean up no matter what. It is safe to call multiple times.
MessageLoop::current()->PostTask(
NewRunnableMethod("CompositorBridgeChild::AfterDestroy", selfRef,
&CompositorBridgeChild::AfterDestroy));
NewRunnableMethod("CompositorBridgeChild::PrepareFinalDestroy", selfRef,
&CompositorBridgeChild::PrepareFinalDestroy));
return;
}
@ -221,8 +233,8 @@ void CompositorBridgeChild::Destroy() {
// From now on we can't send any message message.
MessageLoop::current()->PostTask(
NewRunnableMethod("CompositorBridgeChild::AfterDestroy", selfRef,
&CompositorBridgeChild::AfterDestroy));
NewRunnableMethod("CompositorBridgeChild::PrepareFinalDestroy", selfRef,
&CompositorBridgeChild::PrepareFinalDestroy));
}
// static

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

@ -275,6 +275,7 @@ class CompositorBridgeChild final : public PCompositorBridgeChild,
// and resumes IPC.
void ResumeIPCAfterAsyncPaint();
void PrepareFinalDestroy();
void AfterDestroy();
PLayerTransactionChild* AllocPLayerTransactionChild(

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

@ -120,8 +120,9 @@ child:
// the root layer tree).
// transactionId is the id of the transaction before this composite, or 0
// if there was no transaction since the last composite.
async DidComposite(LayersId id, TransactionId transactionId,
TimeStamp compositeStart, TimeStamp compositeEnd);
prio(mediumhigh) async DidComposite(LayersId id, TransactionId transactionId,
TimeStamp compositeStart,
TimeStamp compositeEnd);
async NotifyFrameStats(FrameStats[] aFrameStats);