Bug 642257. If there are no plugins in the display list skip a potentially expensive compute visibility pass with accurate visible regions to determine plugin geometry because it is not needed. r=roc, a=bajaj

If there is a plugin in a background tab and a complex scene in a foreground tab the accurate visible regions can cause us to bog down, for no good reason.
This commit is contained in:
Timothy Nikkel 2012-10-18 00:34:58 -05:00
Родитель 6b03e1bc33
Коммит ea56aaf4e7
4 изменённых файлов: 19 добавлений и 14 удалений

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

@ -448,7 +448,8 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mHasDisplayPort(false), mHasDisplayPort(false),
mHasFixedItems(false), mHasFixedItems(false),
mIsInFixedPosition(false), mIsInFixedPosition(false),
mIsCompositingCheap(false) mIsCompositingCheap(false),
mContainsPluginItem(false)
{ {
MOZ_COUNT_CTOR(nsDisplayListBuilder); MOZ_COUNT_CTOR(nsDisplayListBuilder);
PL_InitArenaPool(&mPool, "displayListArena", 1024, PL_InitArenaPool(&mPool, "displayListArena", 1024,

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

@ -582,6 +582,9 @@ public:
return aItem == mGlassDisplayItem; return aItem == mGlassDisplayItem;
} }
void SetContainsPluginItem() { mContainsPluginItem = true; }
bool ContainsPluginItem() { return mContainsPluginItem; }
private: private:
void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame, void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame,
const nsRect& aDirtyRect); const nsRect& aDirtyRect);
@ -635,6 +638,7 @@ private:
bool mHasFixedItems; bool mHasFixedItems;
bool mIsInFixedPosition; bool mIsInFixedPosition;
bool mIsCompositingCheap; bool mIsCompositingCheap;
bool mContainsPluginItem;
}; };
class nsDisplayItem; class nsDisplayItem;

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

@ -2497,10 +2497,8 @@ nsRootPresContext::ComputePluginGeometryUpdates(nsIFrame* aFrame,
mRegisteredPlugins.EnumerateEntries(SetPluginHidden, aFrame); mRegisteredPlugins.EnumerateEntries(SetPluginHidden, aFrame);
nsIFrame* rootFrame = FrameManager()->GetRootFrame(); nsIFrame* rootFrame = FrameManager()->GetRootFrame();
if (!rootFrame) {
return;
}
if (rootFrame && aBuilder->ContainsPluginItem()) {
aBuilder->SetForPluginGeometry(); aBuilder->SetForPluginGeometry();
aBuilder->SetAccurateVisibleRegions(); aBuilder->SetAccurateVisibleRegions();
// Merging and flattening has already been done and we should not do it // Merging and flattening has already been done and we should not do it
@ -2511,6 +2509,7 @@ nsRootPresContext::ComputePluginGeometryUpdates(nsIFrame* aFrame,
// nsDisplayPlugin::ComputeVisibility will automatically set a non-hidden // nsDisplayPlugin::ComputeVisibility will automatically set a non-hidden
// widget configuration for the plugin, if it's visible. // widget configuration for the plugin, if it's visible.
aList->ComputeVisibilityForRoot(aBuilder, &region); aList->ComputeVisibilityForRoot(aBuilder, &region);
}
InitApplyPluginGeometryTimer(); InitApplyPluginGeometryTimer();
} }

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

@ -310,6 +310,7 @@ public:
: nsDisplayItem(aBuilder, aFrame) : nsDisplayItem(aBuilder, aFrame)
{ {
MOZ_COUNT_CTOR(nsDisplayPlugin); MOZ_COUNT_CTOR(nsDisplayPlugin);
aBuilder->SetContainsPluginItem();
} }
#ifdef NS_BUILD_REFCNT_LOGGING #ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayPlugin() { virtual ~nsDisplayPlugin() {