Bug 1219501 - Limit total number of image decoding threads to 32 regardless of number asked for. r=seth, a=ritu
authorTimothy Nikkel <tnikkel@gmail.com>
Sun, 01 Nov 2015 11:45:40 -0600
changeset 307699 c26f56bea5e99e3cb335394ff0493a98b97561e0
parent 307698 412a3f1e075f30cbbdd4af0b6bcfafae58210e0b
child 307700 ee8a828b497498c8a4325e3007197c75af931c3b
push id7348
push userjbruaroey@mozilla.com
push dateMon, 09 Nov 2015 21:46:36 +0000
reviewersseth, ritu
bugs1219501
milestone43.0
Bug 1219501 - Limit total number of image decoding threads to 32 regardless of number asked for. r=seth, a=ritu
image/DecodePool.cpp
--- a/image/DecodePool.cpp
+++ b/image/DecodePool.cpp
@@ -342,16 +342,19 @@ DecodePool::DecodePool()
       // even if under load we can't actually get that level of parallelism.
       limit = 2;
     } else {
       limit = numCores - 1;
     }
   } else {
     limit = static_cast<uint32_t>(prefLimit);
   }
+  if (limit > 32) {
+    limit = 32;
+  }
 
   // Initialize the thread pool.
   for (uint32_t i = 0 ; i < limit ; ++i) {
     nsCOMPtr<nsIRunnable> worker = new DecodePoolWorker(mImpl);
     nsCOMPtr<nsIThread> thread;
     nsresult rv = NS_NewThread(getter_AddRefs(thread), worker);
     MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv) && thread,
                        "Should successfully create image decoding threads");