Bug 799970 - 'Activate HangMonitor for non-queued messages on Windows'. r=bsmedberg.

This commit is contained in:
Ben Turner 2012-10-16 12:56:57 -07:00
parent c8add646fe
commit 03f0a71b4d

View File

@ -164,6 +164,9 @@
#include "nsIContent.h"
#include "mozilla/HangMonitor.h"
#include "nsIMM32Handler.h"
using namespace mozilla::widget;
using namespace mozilla::layers;
using namespace mozilla;
@ -4276,11 +4279,27 @@ DisplaySystemMenu(HWND hWnd, nsSizeMode sizeMode, bool isRtl, int32_t x, int32_t
return false;
}
inline static mozilla::HangMonitor::ActivityType ActivityTypeForMessage(UINT msg)
{
if ((msg >= WM_KEYFIRST && msg <= WM_IME_KEYLAST) ||
(msg >= WM_MOUSEFIRST && msg <= WM_MOUSELAST) ||
(msg >= MOZ_WM_MOUSEWHEEL_FIRST && msg <= MOZ_WM_MOUSEWHEEL_LAST) ||
(msg >= NS_WM_IMEFIRST && msg <= NS_WM_IMELAST)) {
return mozilla::HangMonitor::kUIActivity;
}
// This may not actually be right, but we don't want to reset the timer if
// we're not actually processing a UI message.
return mozilla::HangMonitor::kActivityUIAVail;
}
// The WndProc procedure for all nsWindows in this toolkit. This merely catches
// exceptions and passes the real work to WindowProcInternal. See bug 587406
// and http://msdn.microsoft.com/en-us/library/ms633573%28VS.85%29.aspx
LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HangMonitor::NotifyActivity(ActivityTypeForMessage(msg));
return mozilla::CallWindowProcCrashProtected(WindowProcInternal, hWnd, msg, wParam, lParam);
}