Bug 855923 - Set the multithreaded image decoding thread pool's idle thread limit in addition to the regular thread limit. r=seth

This commit is contained in:
Joe Drew 2013-04-23 10:06:56 -04:00
Родитель 3cbe6fe633
Коммит becc8be326
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -3522,12 +3522,16 @@ RasterImage::DecodePool::DecodePool()
mThreadPool = do_CreateInstance(NS_THREADPOOL_CONTRACTID);
if (mThreadPool) {
mThreadPool->SetName(NS_LITERAL_CSTRING("ImageDecoder"));
uint32_t limit;
if (gDecodingThreadLimit <= 0) {
mThreadPool->SetThreadLimit(std::max(PR_GetNumberOfProcessors() - 1, 1));
limit = std::max(PR_GetNumberOfProcessors(), 2) - 1;
} else {
mThreadPool->SetThreadLimit(static_cast<uint32_t>(gDecodingThreadLimit));
limit = static_cast<uint32_t>(gDecodingThreadLimit);
}
mThreadPool->SetThreadLimit(limit);
mThreadPool->SetIdleThreadLimit(limit);
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
if (obsSvc) {
obsSvc->AddObserver(this, "xpcom-shutdown-threads", false);