Bug 897839. Use OMTC for invisible windows and initialise LayerTreeState::mParent. r=mattwoodrow

This commit is contained in:
Nicholas Cameron 2013-08-01 10:20:24 +12:00
parent ad3bd7c048
commit fb76e04605
4 changed files with 22 additions and 11 deletions

View File

@ -32,6 +32,11 @@ using namespace std;
namespace mozilla {
namespace layers {
CompositorParent::LayerTreeState::LayerTreeState()
: mParent(nullptr)
{
}
typedef map<uint64_t, CompositorParent::LayerTreeState> LayerTreeMap;
static LayerTreeMap sIndirectLayerTrees;
@ -912,9 +917,9 @@ CrossProcessCompositorParent::AllocPLayerTransactionParent(const LayersBackend&
MOZ_ASSERT(aId != 0);
if (sIndirectLayerTrees[aId].mParent) {
nsRefPtr<LayerManager> lm = sIndirectLayerTrees[aId].mParent->GetLayerManager();
LayerManagerComposite* lm = sIndirectLayerTrees[aId].mParent->GetLayerManager();
*aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
return new LayerTransactionParent(lm->AsLayerManagerComposite(), this, aId);
return new LayerTransactionParent(lm, this, aId);
}
NS_WARNING("Created child without a matching parent?");

View File

@ -177,9 +177,10 @@ public:
PlatformThreadId aThreadID);
struct LayerTreeState {
LayerTreeState();
nsRefPtr<Layer> mRoot;
nsRefPtr<GeckoContentController> mController;
CompositorParent *mParent;
CompositorParent* mParent;
TargetConfig mTargetConfig;
};

View File

@ -848,12 +848,8 @@ nsBaseWidget::ComputeShouldAccelerate(bool aDefault)
}
#endif
// We don't want to accelerate small popup windows like menu, but we still
// want to accelerate xul panels that may contain arbitrarily complex content.
bool isSmallPopup = ((mWindowType == eWindowType_popup) &&
(mPopupType != ePopupTypePanel));
// we should use AddBoolPrefVarCache
bool disableAcceleration = isSmallPopup || gfxPlatform::GetPrefLayersAccelerationDisabled() || (mWindowType == eWindowType_invisible);
bool disableAcceleration = IsSmallPopup() || gfxPlatform::GetPrefLayersAccelerationDisabled();
mForceLayersAcceleration = gfxPlatform::GetPrefLayersAccelerationForceEnabled();
const char *acceleratedEnv = PR_GetEnv("MOZ_ACCELERATED");
@ -976,11 +972,15 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
// deallocated it when being freed.
}
bool nsBaseWidget::IsSmallPopup()
{
return mWindowType == eWindowType_popup &&
mPopupType != ePopupTypePanel;
}
bool nsBaseWidget::ShouldUseOffMainThreadCompositing()
{
bool isSmallPopup = ((mWindowType == eWindowType_popup) &&
(mPopupType != ePopupTypePanel)) || (mWindowType == eWindowType_invisible);
return CompositorParent::CompositorLoop() && !isSmallPopup;
return CompositorParent::CompositorLoop() && !IsSmallPopup();
}
LayerManager* nsBaseWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,

View File

@ -319,6 +319,11 @@ protected:
// if the new rectangles are different from the old rectangles.
bool StoreWindowClipRegion(const nsTArray<nsIntRect>& aRects);
// We don't want to accelerate small popup windows like menu, but we still
// want to accelerate xul panels that may contain arbitrarily complex content.
bool IsSmallPopup();
virtual already_AddRefed<nsIWidget>
AllocateChildPopupWidget()
{