зеркало из 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:
Родитель
d6813ac163
Коммит
821a5af7e1
|
@ -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;
|
||||
|
@ -3220,6 +3221,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,
|
||||
|
@ -3295,6 +3302,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;
|
||||
|
@ -6692,13 +6701,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);
|
||||
}
|
||||
|
|
|
@ -2190,6 +2190,7 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
if (mFrame && aFrame == mFrame) {
|
||||
MOZ_ASSERT(!mFrame->HasDisplayItem(this));
|
||||
mFrame = nullptr;
|
||||
SetDeletedFrame();
|
||||
SetDisplayItemData(nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -2301,7 +2302,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; }
|
||||
|
||||
|
@ -2989,11 +2990,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,
|
||||
|
@ -4543,13 +4547,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);
|
||||
}
|
||||
|
@ -4674,13 +4675,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);
|
||||
}
|
||||
|
@ -4854,13 +4852,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);
|
||||
}
|
||||
|
@ -5676,13 +5671,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);
|
||||
}
|
||||
|
@ -5783,13 +5775,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);
|
||||
}
|
||||
|
@ -6016,7 +6005,6 @@ class nsDisplaySubDocument : public nsDisplayOwnLayer {
|
|||
const ContainerLayerParameters& aContainerParameters);
|
||||
|
||||
nsIFrame* FrameForInvalidation() const override;
|
||||
bool HasDeletedFrame() const override;
|
||||
void RemoveFrame(nsIFrame* aFrame) override;
|
||||
|
||||
void Disown();
|
||||
|
@ -6198,13 +6186,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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче