зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1339891 part 2. Make FlushPendingNotifications on a presshell quickly no-op if there is nothing to flush. r=heycam
This commit is contained in:
Родитель
92d6e995f7
Коммит
25937fe5a8
|
@ -7967,13 +7967,8 @@ nsDocument::FlushPendingNotifications(FlushType aType)
|
|||
mParentDocument->FlushPendingNotifications(parentType);
|
||||
}
|
||||
|
||||
// Call nsIPresShell::NeedFlush (inline, non-virtual) to check whether we
|
||||
// really need to flush the shell (virtual, and needs a strong reference).
|
||||
if (nsIPresShell* shell = GetShell()) {
|
||||
if (shell->NeedFlush(aType)) {
|
||||
nsCOMPtr<nsIPresShell> presShell = shell;
|
||||
presShell->FlushPendingNotifications(aType);
|
||||
}
|
||||
shell->FlushPendingNotifications(aType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4065,7 +4065,7 @@ PresShell::IsSafeToFlush() const
|
|||
|
||||
|
||||
void
|
||||
PresShell::FlushPendingNotifications(FlushType aType)
|
||||
PresShell::DoFlushPendingNotifications(FlushType aType)
|
||||
{
|
||||
// by default, flush animations if aType >= FlushType::Style
|
||||
mozilla::ChangesToFlush flush(aType, aType >= FlushType::Style);
|
||||
|
@ -4073,7 +4073,7 @@ PresShell::FlushPendingNotifications(FlushType aType)
|
|||
}
|
||||
|
||||
void
|
||||
PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
|
||||
PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush)
|
||||
{
|
||||
// Per our API contract, hold a strong ref to ourselves until we return.
|
||||
nsCOMPtr<nsIPresShell> kungFuDeathGrip = this;
|
||||
|
@ -4085,6 +4085,8 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
|
|||
*/
|
||||
FlushType flushType = aFlush.mFlushType;
|
||||
|
||||
MOZ_ASSERT(NeedFlush(flushType), "Why did we get called?");
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
static const EnumeratedArray<FlushType,
|
||||
FlushType::Count,
|
||||
|
|
|
@ -126,8 +126,8 @@ public:
|
|||
virtual void FrameNeedsToContinueReflow(nsIFrame *aFrame) override;
|
||||
virtual void CancelAllPendingReflows() override;
|
||||
virtual bool IsSafeToFlush() const override;
|
||||
virtual void FlushPendingNotifications(mozilla::FlushType aType) override;
|
||||
virtual void FlushPendingNotifications(mozilla::ChangesToFlush aType) override;
|
||||
virtual void DoFlushPendingNotifications(mozilla::FlushType aType) override;
|
||||
virtual void DoFlushPendingNotifications(mozilla::ChangesToFlush aType) override;
|
||||
virtual void DestroyFramesFor(nsIContent* aContent,
|
||||
nsIContent** aDestroyedFramesFor) override;
|
||||
virtual void CreateFramesFor(nsIContent* aContent) override;
|
||||
|
|
|
@ -588,9 +588,33 @@ public:
|
|||
*
|
||||
* @param aType the type of notifications to flush
|
||||
*/
|
||||
virtual void FlushPendingNotifications(mozilla::FlushType aType) = 0;
|
||||
virtual void FlushPendingNotifications(mozilla::ChangesToFlush aType) = 0;
|
||||
public:
|
||||
void FlushPendingNotifications(mozilla::FlushType aType)
|
||||
{
|
||||
if (!NeedFlush(aType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DoFlushPendingNotifications(aType);
|
||||
}
|
||||
|
||||
void FlushPendingNotifications(mozilla::ChangesToFlush aType)
|
||||
{
|
||||
if (!NeedFlush(aType.mFlushType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DoFlushPendingNotifications(aType);
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Implementation methods for FlushPendingNotifications.
|
||||
*/
|
||||
virtual void DoFlushPendingNotifications(mozilla::FlushType aType) = 0;
|
||||
virtual void DoFlushPendingNotifications(mozilla::ChangesToFlush aType) = 0;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Whether we might need a flush for the given flush type. If this
|
||||
* function returns false, we definitely don't need to flush.
|
||||
|
|
Загрузка…
Ссылка в новой задаче