Bug 983971 - Do not use gralloc for small size on ICS gonk r=nical
[gecko.git] / widget / nsIAppShell.idl
blob3c0af793c633b9817bd3da9b3470283da8b51cff
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;
11 /**
12 * Interface for the native event system layer. This interface is designed
13 * to be used on the main application thread only.
15 [uuid(2d10ca53-f143-439a-bb2e-c1fbc71f6a05)]
16 interface nsIAppShell : nsISupports
18 /**
19 * Enter an event loop. Don't leave until exit() is called.
21 void run();
23 /**
24 * Exit the handle event loop
26 void exit();
28 /**
29 * Give hint to native event queue notification mechanism. If the native
30 * platform needs to tradeoff performance vs. native event starvation this
31 * hint tells the native dispatch code which to favor. The default is to
32 * prevent native event starvation.
34 * Calls to this function may be nested. When the number of calls that pass
35 * PR_TRUE is subtracted from the number of calls that pass PR_FALSE is
36 * greater than 0, performance is given precedence over preventing event
37 * starvation.
39 * The starvationDelay arg is only used when favorPerfOverStarvation is
40 * PR_FALSE. It is the amount of time in milliseconds to wait before the
41 * PR_FALSE actually takes effect.
43 void favorPerformanceHint(in boolean favorPerfOverStarvation,
44 in unsigned long starvationDelay);
46 /**
47 * Suspends the use of additional platform-specific methods (besides the
48 * nsIAppShell->run() event loop) to run Gecko events on the main
49 * application thread. Under some circumstances these "additional methods"
50 * can cause Gecko event handlers to be re-entered, sometimes leading to
51 * hangs and crashes. Calls to suspendNative() and resumeNative() may be
52 * nested. On some platforms (those that don't use any "additional
53 * methods") this will be a no-op. Does not (in itself) stop Gecko events
54 * from being processed on the main application thread. But if the
55 * nsIAppShell->run() event loop is blocked when this call is made, Gecko
56 * events will stop being processed until resumeNative() is called (even
57 * if a plugin or library is temporarily processing events on a nested
58 * event loop).
60 void suspendNative();
62 /**
63 * Resumes the use of additional platform-specific methods to run Gecko
64 * events on the main application thread. Calls to suspendNative() and
65 * resumeNative() may be nested. On some platforms this will be a no-op.
67 void resumeNative();
69 /**
70 * The current event loop nesting level.
72 readonly attribute unsigned long eventloopNestingLevel;
74 /**
75 * Allows running of a "synchronous section", in the form of an nsIRunnable
76 * once the event loop has reached a "stable state". We've reached a stable
77 * state when the currently executing task/event has finished, see:
78 * http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#synchronous-section
79 * In practice this runs aRunnable once the currently executing event
80 * finishes. If called multiple times per task/event, all the runnables will
81 * be executed, in the order in which runInStableState() was called.
83 void runInStableState(in nsIRunnable runnable);
85 /**
86 * Run the given runnable before the next iteration of the event loop (this
87 * includes native events too). If a nested loop is spawned within the current
88 * event then the runnable will not be run until that loop has terminated.
90 void runBeforeNextEvent(in nsIRunnable runnable);