Bug 1301184: Notify the profiler and hang monitor when we're executing APCs; r=jimm

MozReview-Commit-ID: B4nTiAf9GNk
This commit is contained in:
Aaron Klotz 2016-09-06 14:39:37 -06:00
Родитель b087b05311
Коммит 23956d09e2
2 изменённых файлов: 10 добавлений и 0 удалений

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

@ -6,10 +6,12 @@
#include "mozilla/mscom/MainThreadInvoker.h"
#include "GeckoProfiler.h"
#include "MainThreadUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/HangMonitor.h"
#include "mozilla/RefPtr.h"
#include "private/prpriv.h" // For PR_GetThreadID
@ -138,6 +140,8 @@ MainThreadInvoker::Invoke(already_AddRefed<nsIRunnable>&& aRunnable,
/* static */ VOID CALLBACK
MainThreadInvoker::MainThreadAPC(ULONG_PTR aParam)
{
GeckoProfilerWakeRAII wakeProfiler;
mozilla::HangMonitor::NotifyActivity(mozilla::HangMonitor::kGeneralActivity);
MOZ_ASSERT(NS_IsMainThread());
RefPtr<SyncRunnable> runnable(already_AddRefed<SyncRunnable>(
reinterpret_cast<SyncRunnable*>(aParam)));

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

@ -18,6 +18,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/DataSurfaceHelpers.h"
#include "mozilla/HangMonitor.h"
#include "mozilla/Preferences.h"
#include "mozilla/RefPtr.h"
#include "mozilla/WindowsVersion.h"
@ -764,6 +765,11 @@ WinUtils::WaitForMessage(DWORD aTimeoutMs)
break;
}
if (result == WAIT_IO_COMPLETION) {
if (NS_IsMainThread()) {
// We executed an APC that would have woken up the hang monitor. Since
// we're now going to sleep again, we should notify the hang monitor.
mozilla::HangMonitor::Suspend();
}
continue;
}