Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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/. */
6
7
#include "nsISupports.idl"
8
9
interface nsIRunnable;
10
%{ C++
11
template <class T> struct already_AddRefed;
12
%}
13
14
/**
15
* Interface for the native event system layer. This interface is designed
16
* to be used on the main application thread only.
17
*/
18
[uuid(7cd5c71d-223b-4afe-931d-5eedb1f2b01f)]
19
interface nsIAppShell : nsISupports
20
{
21
/**
22
* Enter an event loop. Don't leave until exit() is called.
23
*/
24
void run();
25
26
/**
27
* Exit the handle event loop
28
*/
29
void exit();
30
31
/**
32
* Give hint to native event queue notification mechanism. If the native
33
* platform needs to tradeoff performance vs. native event starvation this
34
* hint tells the native dispatch code which to favor. The default is to
35
* prevent native event starvation.
36
*
37
* Calls to this function may be nested. When the number of calls that pass
38
* PR_TRUE is subtracted from the number of calls that pass PR_FALSE is
39
* greater than 0, performance is given precedence over preventing event
40
* starvation.
41
*
42
* The starvationDelay arg is only used when favorPerfOverStarvation is
43
* PR_FALSE. It is the amount of time in milliseconds to wait before the
44
* PR_FALSE actually takes effect.
45
*/
46
void favorPerformanceHint(in boolean favorPerfOverStarvation,
47
in unsigned long starvationDelay);
48
49
/**
50
* Suspends the use of additional platform-specific methods (besides the
51
* nsIAppShell->run() event loop) to run Gecko events on the main
52
* application thread. Under some circumstances these "additional methods"
53
* can cause Gecko event handlers to be re-entered, sometimes leading to
54
* hangs and crashes. Calls to suspendNative() and resumeNative() may be
55
* nested. On some platforms (those that don't use any "additional
56
* methods") this will be a no-op. Does not (in itself) stop Gecko events
57
* from being processed on the main application thread. But if the
58
* nsIAppShell->run() event loop is blocked when this call is made, Gecko
59
* events will stop being processed until resumeNative() is called (even
60
* if a plugin or library is temporarily processing events on a nested
61
* event loop).
62
*/
63
void suspendNative();
64
65
/**
66
* Resumes the use of additional platform-specific methods to run Gecko
67
* events on the main application thread. Calls to suspendNative() and
68
* resumeNative() may be nested. On some platforms this will be a no-op.
69
*/
70
void resumeNative();
71
72
/**
73
* The current event loop nesting level.
74
*/
75
readonly attribute unsigned long eventloopNestingLevel;
76
};