Bug 1458462 - Create paint workers if it's possible we could switch to tiling in the future. r=nical

On windows it's possible for us to fallback from D2D to Skia rendering at any time due to a device reset.
If this happens with `enable-tiles-if-skia-pomtp` enabled we could begin to use tiling. This can cause a
crash if we never created the worker threads because at initialization time we weren't using tiling.

Another way to fix this would be to dynamically create the worker threads in UpdateRenderMode if we
have switched to skia. That's a larger change and more might be required, so I'd rather just fix the
crash for now.

This commit also fixes a pref that should be `Once` instead of `Live`.

MozReview-Commit-ID: JQidXPjI7ER

--HG--
extra : amend_source : ba9a3746faea3a7355251b7e97e3f7c5dc1ba06b
This commit is contained in:
Ryan Hunt 2018-05-02 09:21:13 -05:00
Родитель 8bee753352
Коммит c2b8279a9f
2 изменённых файлов: 5 добавлений и 2 удалений

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

@ -165,7 +165,10 @@ PaintThread::Init()
}
sThread = thread;
if (gfxPlatform::GetPlatform()->UsesTiling()) {
// Only create paint workers for tiling if we are using tiling or could
// expect to dynamically switch to tiling in the future
if (gfxPlatform::GetPlatform()->UsesTiling() ||
gfxPrefs::LayersTilesEnabledIfSkiaPOMTP()) {
int32_t paintWorkerCount = PaintThread::CalculatePaintWorkerCount();
mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"), paintWorkerCount);
}

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

@ -620,7 +620,7 @@ private:
DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-disabled", LayersOffMainThreadCompositionForceDisabled, bool, false);
DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
DECL_GFX_PREF(Live, "layers.omtp.dump-capture", LayersOMTPDumpCapture, bool, false);
DECL_GFX_PREF(Live, "layers.omtp.paint-workers", LayersOMTPPaintWorkers, int32_t, 1);
DECL_GFX_PREF(Once, "layers.omtp.paint-workers", LayersOMTPPaintWorkers, int32_t, 1);
DECL_GFX_PREF(Live, "layers.omtp.release-capture-on-main-thread", LayersOMTPReleaseCaptureOnMainThread, bool, false);
DECL_GFX_PREF(Live, "layers.orientation.sync.timeout", OrientationSyncMillis, uint32_t, (uint32_t)0);
DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);