зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1526972 - P3: De-virtualize HasDeletedFrame(). r=miko
To avoid expensive virtual dispatch in PreProcessDisplayList(). Depends on D24460 Differential Revision: https://phabricator.services.mozilla.com/D26136 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b8327e00aa
Коммит
a3fd49025b
|
@ -195,11 +195,6 @@ mozilla::LayerState nsDisplayRemote::GetLayerState(
|
|||
return mozilla::LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
|
||||
bool nsDisplayRemote::HasDeletedFrame() const {
|
||||
// RenderFrame might change without invalidating nsSubDocumentFrame.
|
||||
return !GetFrameLoader() || nsDisplayItem::HasDeletedFrame();
|
||||
}
|
||||
|
||||
already_AddRefed<Layer> nsDisplayRemote::BuildLayer(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters) {
|
||||
|
|
|
@ -90,6 +90,8 @@ class RenderFrame final {
|
|||
* nsFrameLoader) into its parent frame's layer tree.
|
||||
*/
|
||||
class nsDisplayRemote final : public nsDisplayItem {
|
||||
friend class nsDisplayItem;
|
||||
|
||||
typedef mozilla::dom::TabId TabId;
|
||||
typedef mozilla::gfx::Matrix4x4 Matrix4x4;
|
||||
typedef mozilla::layers::EventRegionsOverride EventRegionsOverride;
|
||||
|
@ -103,8 +105,6 @@ class nsDisplayRemote final : public nsDisplayItem {
|
|||
public:
|
||||
nsDisplayRemote(nsDisplayListBuilder* aBuilder, nsSubDocumentFrame* aFrame);
|
||||
|
||||
bool HasDeletedFrame() const override;
|
||||
|
||||
LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override;
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
#include "mozilla/layers/WebRenderLayerManager.h"
|
||||
#include "mozilla/layers/WebRenderMessages.h"
|
||||
#include "mozilla/layers/WebRenderScrollData.h"
|
||||
#include "mozilla/layout/RenderFrame.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layers;
|
||||
|
@ -3219,6 +3220,12 @@ bool nsDisplayItem::ForceActiveLayers() {
|
|||
return sForce;
|
||||
}
|
||||
|
||||
bool nsDisplayItem::HasDeletedFrame() const {
|
||||
return mItemFlags.contains(ItemFlag::DeletedFrame) ||
|
||||
(GetType() == DisplayItemType::TYPE_REMOTE &&
|
||||
!static_cast<const nsDisplayRemote*>(this)->GetFrameLoader());
|
||||
}
|
||||
|
||||
int32_t nsDisplayItem::ZIndex() const { return mFrame->ZIndex(); }
|
||||
|
||||
bool nsDisplayItem::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -3294,6 +3301,8 @@ void nsDisplayItem::FuseClipChainUpTo(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
}
|
||||
|
||||
void nsDisplayItem::SetDeletedFrame() { mItemFlags += ItemFlag::DeletedFrame; }
|
||||
|
||||
bool nsDisplayItem::ShouldUseAdvancedLayer(LayerManager* aManager,
|
||||
PrefFunc aFunc) const {
|
||||
return CanUseAdvancedLayer(aManager) ? aFunc() : false;
|
||||
|
@ -6691,13 +6700,10 @@ nsIFrame* nsDisplaySubDocument::FrameForInvalidation() const {
|
|||
return mSubDocFrame ? mSubDocFrame : mFrame;
|
||||
}
|
||||
|
||||
bool nsDisplaySubDocument::HasDeletedFrame() const {
|
||||
return !mSubDocFrame || nsDisplayItem::HasDeletedFrame();
|
||||
}
|
||||
|
||||
void nsDisplaySubDocument::RemoveFrame(nsIFrame* aFrame) {
|
||||
if (aFrame == mSubDocFrame) {
|
||||
mSubDocFrame = nullptr;
|
||||
SetDeletedFrame();
|
||||
}
|
||||
nsDisplayItem::RemoveFrame(aFrame);
|
||||
}
|
||||
|
|
|
@ -2191,6 +2191,7 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
if (mFrame && aFrame == mFrame) {
|
||||
MOZ_ASSERT(!mFrame->HasDisplayItem(this));
|
||||
mFrame = nullptr;
|
||||
SetDeletedFrame();
|
||||
SetDisplayItemData(nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -2302,7 +2303,7 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
*/
|
||||
virtual nsIFrame* FrameForInvalidation() const { return mFrame; }
|
||||
|
||||
virtual bool HasDeletedFrame() const { return !mFrame; }
|
||||
bool HasDeletedFrame() const;
|
||||
|
||||
virtual nsIFrame* StyleFrame() const { return mFrame; }
|
||||
|
||||
|
@ -2990,11 +2991,14 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
#endif
|
||||
|
||||
protected:
|
||||
void SetDeletedFrame();
|
||||
|
||||
typedef bool (*PrefFunc)(void);
|
||||
bool ShouldUseAdvancedLayer(LayerManager* aManager, PrefFunc aFunc) const;
|
||||
bool CanUseAdvancedLayer(LayerManager* aManager) const;
|
||||
|
||||
enum class ItemFlag {
|
||||
DeletedFrame,
|
||||
ForceNotVisible,
|
||||
DisableSubpixelAA,
|
||||
CantBeReused,
|
||||
|
@ -4544,13 +4548,10 @@ class nsDisplayTableBackgroundImage : public nsDisplayBackgroundImage {
|
|||
|
||||
nsIFrame* FrameForInvalidation() const override { return mStyleFrame; }
|
||||
|
||||
bool HasDeletedFrame() const override {
|
||||
return !mStyleFrame || nsDisplayBackgroundImage::HasDeletedFrame();
|
||||
}
|
||||
|
||||
void RemoveFrame(nsIFrame* aFrame) override {
|
||||
if (aFrame == mStyleFrame) {
|
||||
mStyleFrame = nullptr;
|
||||
SetDeletedFrame();
|
||||
}
|
||||
nsDisplayBackgroundImage::RemoveFrame(aFrame);
|
||||
}
|
||||
|
@ -4675,13 +4676,10 @@ class nsDisplayTableThemedBackground : public nsDisplayThemedBackground {
|
|||
|
||||
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
|
||||
|
||||
bool HasDeletedFrame() const override {
|
||||
return !mAncestorFrame || nsDisplayThemedBackground::HasDeletedFrame();
|
||||
}
|
||||
|
||||
void RemoveFrame(nsIFrame* aFrame) override {
|
||||
if (aFrame == mAncestorFrame) {
|
||||
mAncestorFrame = nullptr;
|
||||
SetDeletedFrame();
|
||||
}
|
||||
nsDisplayThemedBackground::RemoveFrame(aFrame);
|
||||
}
|
||||
|
@ -4855,13 +4853,10 @@ class nsDisplayTableBackgroundColor : public nsDisplayBackgroundColor {
|
|||
|
||||
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
|
||||
|
||||
bool HasDeletedFrame() const override {
|
||||
return !mAncestorFrame || nsDisplayBackgroundColor::HasDeletedFrame();
|
||||
}
|
||||
|
||||
void RemoveFrame(nsIFrame* aFrame) override {
|
||||
if (aFrame == mAncestorFrame) {
|
||||
mAncestorFrame = nullptr;
|
||||
SetDeletedFrame();
|
||||
}
|
||||
nsDisplayBackgroundColor::RemoveFrame(aFrame);
|
||||
}
|
||||
|
@ -5677,13 +5672,10 @@ class nsDisplayTableBlendMode : public nsDisplayBlendMode {
|
|||
|
||||
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
|
||||
|
||||
bool HasDeletedFrame() const override {
|
||||
return !mAncestorFrame || nsDisplayBlendMode::HasDeletedFrame();
|
||||
}
|
||||
|
||||
void RemoveFrame(nsIFrame* aFrame) override {
|
||||
if (aFrame == mAncestorFrame) {
|
||||
mAncestorFrame = nullptr;
|
||||
SetDeletedFrame();
|
||||
}
|
||||
nsDisplayBlendMode::RemoveFrame(aFrame);
|
||||
}
|
||||
|
@ -5784,13 +5776,10 @@ class nsDisplayTableBlendContainer : public nsDisplayBlendContainer {
|
|||
|
||||
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
|
||||
|
||||
bool HasDeletedFrame() const override {
|
||||
return !mAncestorFrame || nsDisplayBlendContainer::HasDeletedFrame();
|
||||
}
|
||||
|
||||
void RemoveFrame(nsIFrame* aFrame) override {
|
||||
if (aFrame == mAncestorFrame) {
|
||||
mAncestorFrame = nullptr;
|
||||
SetDeletedFrame();
|
||||
}
|
||||
nsDisplayBlendContainer::RemoveFrame(aFrame);
|
||||
}
|
||||
|
@ -6017,7 +6006,6 @@ class nsDisplaySubDocument : public nsDisplayOwnLayer {
|
|||
const ContainerLayerParameters& aContainerParameters);
|
||||
|
||||
nsIFrame* FrameForInvalidation() const override;
|
||||
bool HasDeletedFrame() const override;
|
||||
void RemoveFrame(nsIFrame* aFrame) override;
|
||||
|
||||
void Disown();
|
||||
|
@ -6199,13 +6187,10 @@ class nsDisplayTableFixedPosition : public nsDisplayFixedPosition {
|
|||
|
||||
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
|
||||
|
||||
bool HasDeletedFrame() const override {
|
||||
return !mAncestorFrame || nsDisplayFixedPosition::HasDeletedFrame();
|
||||
}
|
||||
|
||||
void RemoveFrame(nsIFrame* aFrame) override {
|
||||
if (aFrame == mAncestorFrame) {
|
||||
mAncestorFrame = nullptr;
|
||||
SetDeletedFrame();
|
||||
}
|
||||
nsDisplayFixedPosition::RemoveFrame(aFrame);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче