Bug 1219501 - In imagelib, initialize the number of cores to at least 1 in case of error. r=seth, a=ritu
authorTimothy Nikkel <tnikkel@gmail.com>
Sun, 01 Nov 2015 11:45:40 -0600
changeset 296654 412a3f1e075f
parent 296653 09bdeec1b65c
child 296655 c26f56bea5e9
push id5276
push usercbook@mozilla.com
push date2015-11-09 10:31 +0000
treeherdermozilla-beta@be9dcc3b97b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth, ritu
bugs1219501
milestone43.0
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.
image/DecodePool.cpp
--- 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());