Bug 1342887 - Detect and log failures to dispatch SetupMacCommandLine to the main thread. r=rstrong

MozReview-Commit-ID: LMoxF5yfXq2

--HG--
extra : rebase_source : c206e32bf8abf1aa225901ff5cde390a8a2ecec7
This commit is contained in:
Matt Howell 2017-02-27 13:57:11 -08:00
Родитель 9b5a05cf1d
Коммит ba8c46feca
1 изменённых файлов: 12 добавлений и 2 удалений

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

@ -108,14 +108,24 @@ UpdateDriverSetupMacCommandLine(int& argc, char**& argv, bool restart)
// monitor to signal us when that happens, and block until then.
Monitor monitor("nsUpdateDriver SetupMacCommandLine");
NS_DispatchToMainThread(
nsresult rv = NS_DispatchToMainThread(
NS_NewRunnableFunction([&argc, &argv, restart, &monitor]() -> void
{
CommandLineServiceMac::SetupMacCommandLine(argc, argv, restart);
MonitorAutoLock(monitor).Notify();
}));
MonitorAutoLock(monitor).Wait();
if (NS_FAILED(rv)) {
LOG(("Update driver error dispatching SetupMacCommandLine to main thread: %d\n", rv));
return;
}
// The length of this wait is arbitrary, but should be long enough that having
// it expire means something is seriously wrong.
rv = MonitorAutoLock(monitor).Wait(PR_SecondsToInterval(60));
if (NS_FAILED(rv)) {
LOG(("Update driver timed out waiting for SetupMacCommandLine: %d\n", rv));
}
}
#endif