Bug 1805294 [wpt PR 37463] - WebKit export of https://bugs.webkit.org/show_bug.cgi...
[gecko.git] / widget / nsIAppShell.idl
blob14028b15d8c6ad72772041867e200d35bedef4c7
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 interface nsIRunnable;
10 %{ C++
11 template <class T> struct already_AddRefed;
13 /**
14 * After the default timezone changes, this topic is notified. Some systems may
15 * not support monitoring timezone.
17 #define DEFAULT_TIMEZONE_CHANGED_OBSERVER_TOPIC "default-timezone-changed"
20 /**
21 * Interface for the native event system layer. This interface is designed
22 * to be used on the main application thread only.
24 [uuid(7cd5c71d-223b-4afe-931d-5eedb1f2b01f)]
25 interface nsIAppShell : nsISupports
27 /**
28 * Enter an event loop. Don't leave until exit() is called.
30 void run();
32 /**
33 * Exit the handle event loop
35 void exit();
37 /**
38 * Give hint to native event queue notification mechanism. If the native
39 * platform needs to tradeoff performance vs. native event starvation this
40 * hint tells the native dispatch code which to favor. The default is to
41 * prevent native event starvation.
43 * Calls to this function may be nested. When the number of calls that pass
44 * PR_TRUE is subtracted from the number of calls that pass PR_FALSE is
45 * greater than 0, performance is given precedence over preventing event
46 * starvation.
48 * The starvationDelay arg is only used when favorPerfOverStarvation is
49 * PR_FALSE. It is the amount of time in milliseconds to wait before the
50 * PR_FALSE actually takes effect.
52 void favorPerformanceHint(in boolean favorPerfOverStarvation,
53 in unsigned long starvationDelay);
55 /**
56 * Suspends the use of additional platform-specific methods (besides the
57 * nsIAppShell->run() event loop) to run Gecko events on the main
58 * application thread. Under some circumstances these "additional methods"
59 * can cause Gecko event handlers to be re-entered, sometimes leading to
60 * hangs and crashes. Calls to suspendNative() and resumeNative() may be
61 * nested. On some platforms (those that don't use any "additional
62 * methods") this will be a no-op. Does not (in itself) stop Gecko events
63 * from being processed on the main application thread. But if the
64 * nsIAppShell->run() event loop is blocked when this call is made, Gecko
65 * events will stop being processed until resumeNative() is called (even
66 * if a plugin or library is temporarily processing events on a nested
67 * event loop).
69 void suspendNative();
71 /**
72 * Resumes the use of additional platform-specific methods to run Gecko
73 * events on the main application thread. Calls to suspendNative() and
74 * resumeNative() may be nested. On some platforms this will be a no-op.
76 void resumeNative();
78 /**
79 * The current event loop nesting level.
81 readonly attribute unsigned long eventloopNestingLevel;