Bug 1571516 - [1/2] preparatory reorganization r=gsvelto

Pull the failing section of code out into its own function, for the sake
of clarity of later diffs.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D186987
This commit is contained in:
Ray Kraesig 2023-08-30 17:26:32 +00:00
Родитель 6fd7a45c30
Коммит 023631c97e
2 изменённых файлов: 38 добавлений и 29 удалений

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

@ -361,22 +361,7 @@ nsAppShell::Observe(nsISupports* aSubject, const char* aTopic,
return nsBaseAppShell::Observe(aSubject, aTopic, aData);
}
nsresult nsAppShell::Init() {
LSPAnnotate();
hal::Init();
if (XRE_IsParentProcess()) {
sTaskbarButtonCreatedMsg = ::RegisterWindowMessageW(kTaskbarButtonEventId);
NS_ASSERTION(sTaskbarButtonCreatedMsg,
"Could not register taskbar button creation message");
}
// The hidden message window is used for interrupting the processing of native
// events, so that we can process gecko events. Therefore, we only need it if
// we are processing native events. Disabling this is required for win32k
// syscall lockdown.
if (XRE_UseNativeEventProcessing()) {
nsresult nsAppShell::InitHiddenWindow() {
sAppShellGeckoMsgId = ::RegisterWindowMessageW(kAppShellGeckoEventId);
NS_ASSERTION(sAppShellGeckoMsgId,
"Could not register hidden window event message!");
@ -406,6 +391,29 @@ nsresult nsAppShell::Init() {
10, 10, HWND_MESSAGE, nullptr, module, nullptr);
MOZ_DIAGNOSTIC_ASSERT(mEventWnd, "CreateWindowW for EventWindow failed");
NS_ENSURE_STATE(mEventWnd);
return NS_OK;
}
nsresult nsAppShell::Init() {
LSPAnnotate();
hal::Init();
if (XRE_IsParentProcess()) {
sTaskbarButtonCreatedMsg = ::RegisterWindowMessageW(kTaskbarButtonEventId);
NS_ASSERTION(sTaskbarButtonCreatedMsg,
"Could not register taskbar button creation message");
}
// The hidden message window is used for interrupting the processing of native
// events, so that we can process gecko events. Therefore, we only need it if
// we are processing native events. Disabling this is required for win32k
// syscall lockdown.
if (XRE_UseNativeEventProcessing()) {
if (nsresult rv = this->InitHiddenWindow(); NS_FAILED(rv)) {
return rv;
}
} else if (XRE_IsContentProcess() && !IsWin32kLockedDown()) {
// We're not generally processing native events, but still using GDI and we
// still have some internal windows, e.g. from calling CoInitializeEx.

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

@ -19,7 +19,7 @@
/**
* Native Win32 Application shell wrapper
*/
class nsAppShell : public nsBaseAppShell {
class nsAppShell final : public nsBaseAppShell {
public:
nsAppShell()
: mEventWnd(nullptr),
@ -49,6 +49,7 @@ class nsAppShell : public nsBaseAppShell {
static LRESULT CALLBACK EventWindowProc(HWND, UINT, WPARAM, LPARAM);
protected:
nsresult InitHiddenWindow();
HWND mEventWnd;
bool mNativeCallbackPending;