Bug 1120611 - Avoid a data race for the rendering intent. r=jrmuizelaar

--HG--
extra : rebase_source : 54549a96e59772af1223d69e854d34d28e6d369c
This commit is contained in:
Milan Sreckovic 2015-01-13 17:02:34 -05:00
Родитель 3bed1dc615
Коммит 0cf06341a4
1 изменённых файлов: 14 добавлений и 26 удалений

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

@ -135,10 +135,6 @@ static qcms_transform *gCMSRGBATransform = nullptr;
static bool gCMSInitialized = false;
static eCMSMode gCMSMode = eCMSMode_Off;
static bool gCMSIntentInitialized = false;
static int gCMSIntent = QCMS_INTENT_DEFAULT;
static void ShutdownCMS();
#include "mozilla/gfx/2D.h"
@ -1752,9 +1748,7 @@ gfxPlatform::OffMainThreadCompositingEnabled()
eCMSMode
gfxPlatform::GetCMSMode()
{
if (gCMSInitialized == false) {
gCMSInitialized = true;
if (!gCMSInitialized) {
int32_t mode = gfxPrefs::CMSMode();
if (mode >= 0 && mode < eCMSMode_AllCount) {
gCMSMode = static_cast<eCMSMode>(mode);
@ -1764,6 +1758,7 @@ gfxPlatform::GetCMSMode()
if (enableV4) {
qcms_enable_iccv4();
}
gCMSInitialized = true;
}
return gCMSMode;
}
@ -1771,25 +1766,19 @@ gfxPlatform::GetCMSMode()
int
gfxPlatform::GetRenderingIntent()
{
if (!gCMSIntentInitialized) {
gCMSIntentInitialized = true;
// gfxPrefs.h is using 0 as the default for the rendering
// intent preference, based on that being the value for
// QCMS_INTENT_DEFAULT. Assert here to catch if that ever
// changes and we can then figure out what to do about it.
MOZ_ASSERT(QCMS_INTENT_DEFAULT == 0);
// gfxPrefs.h is using 0 as the default for the rendering
// intent preference, based on that being the value for
// QCMS_INTENT_DEFAULT. Assert here to catch if that ever
// changes and we can then figure out what to do about it.
MOZ_ASSERT(QCMS_INTENT_DEFAULT == 0);
/* Try to query the pref system for a rendering intent. */
int32_t pIntent = gfxPrefs::CMSRenderingIntent();
if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
gCMSIntent = pIntent;
} else {
/* If the pref is out of range, use embedded profile. */
gCMSIntent = -1;
}
}
return gCMSIntent;
/* Try to query the pref system for a rendering intent. */
int32_t pIntent = gfxPrefs::CMSRenderingIntent();
if ((pIntent < QCMS_INTENT_MIN) || (pIntent > QCMS_INTENT_MAX)) {
/* If the pref is out of range, use embedded profile. */
pIntent = -1;
}
return pIntent;
}
void
@ -1987,7 +1976,6 @@ static void ShutdownCMS()
}
// Reset the state variables
gCMSIntent = -2;
gCMSMode = eCMSMode_Off;
gCMSInitialized = false;
}