|
1 /* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsAppShell_h__ |
|
7 #define nsAppShell_h__ |
|
8 |
|
9 #include "nsBaseAppShell.h" |
|
10 #include <windows.h> |
|
11 #include "mozilla/TimeStamp.h" |
|
12 #include "mozilla/Mutex.h" |
|
13 |
|
14 // The maximum time we allow before forcing a native event callback. |
|
15 // In seconds. |
|
16 #define NATIVE_EVENT_STARVATION_LIMIT 1 |
|
17 |
|
18 /** |
|
19 * Native Win32 Application shell wrapper |
|
20 */ |
|
21 class nsAppShell : public nsBaseAppShell |
|
22 { |
|
23 public: |
|
24 nsAppShell() : |
|
25 mEventWnd(nullptr), |
|
26 mNativeCallbackPending(false), |
|
27 mLastNativeEventScheduledMutex("nsAppShell::mLastNativeEventScheduledMutex") |
|
28 {} |
|
29 typedef mozilla::TimeStamp TimeStamp; |
|
30 typedef mozilla::Mutex Mutex; |
|
31 |
|
32 nsresult Init(); |
|
33 void DoProcessMoreGeckoEvents(); |
|
34 |
|
35 static UINT GetTaskbarButtonCreatedMessage(); |
|
36 |
|
37 protected: |
|
38 NS_IMETHOD Run(); |
|
39 NS_IMETHOD Exit(); |
|
40 virtual void ScheduleNativeEventCallback(); |
|
41 virtual bool ProcessNextNativeEvent(bool mayWait); |
|
42 virtual ~nsAppShell(); |
|
43 |
|
44 static LRESULT CALLBACK EventWindowProc(HWND, UINT, WPARAM, LPARAM); |
|
45 |
|
46 protected: |
|
47 HWND mEventWnd; |
|
48 bool mNativeCallbackPending; |
|
49 |
|
50 Mutex mLastNativeEventScheduledMutex; |
|
51 TimeStamp mLastNativeEventScheduled; |
|
52 }; |
|
53 |
|
54 #endif // nsAppShell_h__ |