Bug 1219501 - In imagelib, initialize the number of cores to at least 1 in case of error. r=seth, a=ritu
PR_GetNumberOfProcessors returns -1 in case of error, which is MAXUINT32 when turned into an unsigned int like sNumCores.
--- a/image/DecodePool.cpp
+++ b/image/DecodePool.cpp
@@ -298,17 +298,17 @@ public:
private:
nsRefPtr<DecodePoolImpl> mImpl;
};
/* static */ void
DecodePool::Initialize()
{
MOZ_ASSERT(NS_IsMainThread());
- sNumCores = PR_GetNumberOfProcessors();
+ sNumCores = max<int32_t>(PR_GetNumberOfProcessors(), 1);
DecodePool::Singleton();
}
/* static */ DecodePool*
DecodePool::Singleton()
{
if (!sSingleton) {
MOZ_ASSERT(NS_IsMainThread());