Bug 1453501 - Allow the compositor to be created in a paused state r=kats

MozReview-Commit-ID: B0wc8MYaBJg
This commit is contained in:
James Willcox 2018-04-25 16:35:31 -05:00
Родитель 9299e02cdf
Коммит 2448df528a
4 изменённых файлов: 20 добавлений и 1 удалений

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

@ -33,6 +33,7 @@ public:
: mUseAPZ(false)
, mUseWebRender(false)
, mUseAdvancedLayers(false)
, mInitiallyPaused(false)
{
}
@ -41,17 +42,23 @@ public:
: mUseAPZ(aUseAPZ)
, mUseWebRender(aUseWebRender)
, mUseAdvancedLayers(false)
, mInitiallyPaused(false)
{
}
bool UseAPZ() const { return mUseAPZ; }
bool UseWebRender() const { return mUseWebRender; }
bool UseAdvancedLayers() const { return mUseAdvancedLayers; }
bool InitiallyPaused() const { return mInitiallyPaused; }
void SetUseAdvancedLayers(bool aUseAdvancedLayers) {
mUseAdvancedLayers = aUseAdvancedLayers;
}
void SetInitiallyPaused(bool aPauseAtStartup) {
mInitiallyPaused = aPauseAtStartup;
}
bool operator==(const CompositorOptions& aOther) const {
return mUseAPZ == aOther.mUseAPZ &&
mUseWebRender == aOther.mUseWebRender &&
@ -64,8 +71,10 @@ private:
bool mUseAPZ;
bool mUseWebRender;
bool mUseAdvancedLayers;
bool mInitiallyPaused;
// Make sure to add new fields to the ParamTraits implementation
// in LayersMessageUtils.h
};
} // namespace layers

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

@ -411,6 +411,8 @@ CompositorBridgeParent::Initialize()
mApzUpdater = new APZUpdater(mApzcTreeManager, mOptions.UseWebRender());
}
mPaused = mOptions.InitiallyPaused();
mCompositorBridgeID = 0;
// FIXME: This holds on the the fact that right now the only thing that
// can destroy this instance is initialized on the compositor thread after

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

@ -635,12 +635,14 @@ struct ParamTraits<mozilla::layers::CompositorOptions>
WriteParam(aMsg, aParam.mUseAPZ);
WriteParam(aMsg, aParam.mUseWebRender);
WriteParam(aMsg, aParam.mUseAdvancedLayers);
WriteParam(aMsg, aParam.mInitiallyPaused);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
return ReadParam(aMsg, aIter, &aResult->mUseAPZ)
&& ReadParam(aMsg, aIter, &aResult->mUseWebRender)
&& ReadParam(aMsg, aIter, &aResult->mUseAdvancedLayers);
&& ReadParam(aMsg, aIter, &aResult->mUseAdvancedLayers)
&& ReadParam(aMsg, aIter, &aResult->mInitiallyPaused);
}
};

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

@ -1323,6 +1323,12 @@ nsBaseWidget::CreateCompositorSession(int aWidth,
bool enableAL = gfx::gfxConfig::IsEnabled(gfx::Feature::ADVANCED_LAYERS);
options.SetUseAdvancedLayers(enableAL);
#ifdef MOZ_WIDGET_ANDROID
if (!GetNativeData(NS_JAVA_SURFACE)) {
options.SetInitiallyPaused(true);
}
#endif
RefPtr<LayerManager> lm;
if (options.UseWebRender()) {
lm = new WebRenderLayerManager(this);