Bug 1286341 - Initialize sBrandName before layout startup when initializing the cubeb. r=jesup

We call `cubeb_init` quite early these days because the sandbox is enabled
a short time after, so we'd call GetCubebContext before InitBrandName, thus
showing the warning.

MozReview-Commit-ID: 4gmN8GKq4qd

--HG--
extra : rebase_source : 0028f51daf166792f05ab1aad26a807540d18fe8
This commit is contained in:
Paul Adenot 2016-07-19 16:28:56 +02:00
Родитель a02e63bc63
Коммит e556746dbc
1 изменённых файлов: 6 добавлений и 1 удалений

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

@ -167,7 +167,12 @@ cubeb* GetCubebContextUnlocked()
return sCubebContext; return sCubebContext;
} }
NS_WARN_IF_FALSE(sBrandName, "Could not get brandName?"); if (!sBrandName && NS_IsMainThread()) {
InitBrandName();
} else {
NS_WARN_IF_FALSE(sBrandName,
"Did not initialize sbrandName, and not on the main thread?");
}
DebugOnly<int> rv = cubeb_init(&sCubebContext, sBrandName); DebugOnly<int> rv = cubeb_init(&sCubebContext, sBrandName);
NS_WARN_IF_FALSE(rv == CUBEB_OK, "Could not get a cubeb context."); NS_WARN_IF_FALSE(rv == CUBEB_OK, "Could not get a cubeb context.");