Bug 1219501 - Limit total number of image decoding threads to 32 regardless of number asked for. r=seth, a=ritu
--- 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");