зеркало из https://github.com/mozilla/pjs.git
Bug 418960, Download scanner threads should be lower priority r=sdwilsh
This commit is contained in:
Родитель
72d212dcb7
Коммит
f936fe606d
|
@ -259,12 +259,24 @@ nsDownloadScanner::ListCLSID()
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef THREAD_MODE_BACKGROUND_BEGIN
|
||||
#define THREAD_MODE_BACKGROUND_BEGIN 0x00010000
|
||||
#endif
|
||||
|
||||
#ifndef THREAD_MODE_BACKGROUND_END
|
||||
#define THREAD_MODE_BACKGROUND_END 0x00020000
|
||||
#endif
|
||||
|
||||
unsigned int __stdcall
|
||||
nsDownloadScanner::ScannerThreadFunction(void *p)
|
||||
{
|
||||
HANDLE currentThread = GetCurrentThread();
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Antivirus scan should not be run on the main thread");
|
||||
nsDownloadScanner::Scan *scan = static_cast<nsDownloadScanner::Scan*>(p);
|
||||
if (!SetThreadPriority(currentThread, THREAD_MODE_BACKGROUND_BEGIN))
|
||||
(void)SetThreadPriority(currentThread, THREAD_PRIORITY_IDLE);
|
||||
scan->DoScan();
|
||||
(void)SetThreadPriority(currentThread, THREAD_MODE_BACKGROUND_END);
|
||||
_endthreadex(0);
|
||||
return 0;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче