Bug 1219501. In imagelib, initialize the number of cores to at least 1 in case of error. r=seth
authorTimothy Nikkel <tnikkel@gmail.com>
Sun, 01 Nov 2015 11:45:40 -0600
changeset 270657 accf0dbda8bb6f8a4509078479ef50e0099060cb
parent 270656 10bbda706f2588d3e672da9d476936b37a1d6d66
child 270658 e5f60475c16b0518fd226da2b5823a91bb7cd2a0
push id29620
push usercbook@mozilla.com
push dateMon, 02 Nov 2015 10:56:37 +0000
treeherdermozilla-central@451a18579143 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth
bugs1219501
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1219501. In imagelib, initialize the number of cores to at least 1 in case of error. r=seth 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
@@ -297,17 +297,17 @@ public:
 private:
   RefPtr<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());