Copy as Markdown

Other Tools

/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/xpcom/threads/nsIThreadManager.idl
*/
#ifndef __gen_nsIThreadManager_h__
#define __gen_nsIThreadManager_h__
#include "nsISupports.h"
#include "js/GCAnnotations.h"
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIEventTarget; /* forward declaration */
class nsIRunnable; /* forward declaration */
class nsIThread; /* forward declaration */
#include "mozilla/Maybe.h"
/* starting interface: nsINestedEventLoopCondition */
#define NS_INESTEDEVENTLOOPCONDITION_IID_STR "039a227d-0cb7-44a5-a8f9-dbb7071979f2"
#define NS_INESTEDEVENTLOOPCONDITION_IID \
{0x039a227d, 0x0cb7, 0x44a5, \
{ 0xa8, 0xf9, 0xdb, 0xb7, 0x07, 0x19, 0x79, 0xf2 }}
class NS_NO_VTABLE nsINestedEventLoopCondition : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INESTEDEVENTLOOPCONDITION_IID)
/* Used by ToJSValue to check which scriptable interface is implemented. */
using ScriptableInterfaceType = nsINestedEventLoopCondition;
/* boolean isDone (); */
JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD IsDone(bool *_retval) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsINestedEventLoopCondition, NS_INESTEDEVENTLOOPCONDITION_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSINESTEDEVENTLOOPCONDITION \
NS_IMETHOD IsDone(bool *_retval) override;
/* Use this macro when declaring the members of this interface when the
class doesn't implement the interface. This is useful for forwarding. */
#define NS_DECL_NON_VIRTUAL_NSINESTEDEVENTLOOPCONDITION \
nsresult IsDone(bool *_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSINESTEDEVENTLOOPCONDITION(_to) \
NS_IMETHOD IsDone(bool *_retval) override { return _to IsDone(_retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSINESTEDEVENTLOOPCONDITION(_to) \
NS_IMETHOD IsDone(bool *_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->IsDone(_retval); }
/* starting interface: nsIThreadManager */
#define NS_ITHREADMANAGER_IID_STR "1be89eca-e2f7-453b-8d38-c11ba247f6f3"
#define NS_ITHREADMANAGER_IID \
{0x1be89eca, 0xe2f7, 0x453b, \
{ 0x8d, 0x38, 0xc1, 0x1b, 0xa2, 0x47, 0xf6, 0xf3 }}
class nsIThreadManager : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITHREADMANAGER_IID)
/* Used by ToJSValue to check which scriptable interface is implemented. */
using ScriptableInterfaceType = nsIThreadManager;
#if defined(MOZ_ASAN) || defined(MOZ_TSAN) || !defined(__OPTIMIZE__)
static constexpr uint32_t DEFAULT_STACK_SIZE = 0;
#else
static constexpr uint32_t DEFAULT_STACK_SIZE = 256 * 1024;
#endif
static const uint32_t kThreadPoolStackSize = DEFAULT_STACK_SIZE;
struct ThreadCreationOptions {
// The size in bytes to reserve for the thread's stack. A value of `0` means
// to use the platform default.
uint32_t stackSize = nsIThreadManager::DEFAULT_STACK_SIZE;
// If set to `true`, any attempts to dispatch runnables to this thread
// without `DISPATCH_IGNORE_BLOCK_DISPATCH` will fail.
//
// This is intended to be used for threads which are expected to generally
// only service a single runnable (other than thread lifecycle runnables),
// and perform their own event dispatching internaly, such as thread pool
// threads or the timer thread.
bool blockDispatch = false;
// (Windows-only) Whether the thread should have a MessageLoop capable of
// processing native UI events. Defaults to false.
bool isUiThread = false;
// If set, long task markers will be collected for tasks
// longer than longTaskLength ms when profiling is enabled.
mozilla::Maybe<uint32_t> longTaskLength;
};
/* [noscript] nsIThread newNamedThread (in ACString name, in ThreadCreationOptions options); */
NS_IMETHOD NewNamedThread(const nsACString& name, nsIThreadManager::ThreadCreationOptions options, nsIThread **_retval) = 0;
/* readonly attribute nsIThread mainThread; */
NS_IMETHOD GetMainThread(nsIThread **aMainThread) = 0;
/* readonly attribute nsIThread currentThread; */
NS_IMETHOD GetCurrentThread(nsIThread **aCurrentThread) = 0;
/* [optional_argc] void dispatchToMainThread (in nsIRunnable event, [optional] in uint32_t priority); */
NS_IMETHOD DispatchToMainThread(nsIRunnable *event, uint32_t priority, uint8_t _argc) = 0;
/* [optional_argc] void dispatchToMainThreadWithMicroTask (in nsIRunnable event, [optional] in uint32_t priority); */
NS_IMETHOD DispatchToMainThreadWithMicroTask(nsIRunnable *event, uint32_t priority, uint8_t _argc) = 0;
/* void idleDispatchToMainThread (in nsIRunnable event, [optional] in uint32_t timeout); */
NS_IMETHOD IdleDispatchToMainThread(nsIRunnable *event, uint32_t timeout) = 0;
/* void dispatchDirectTaskToCurrentThread (in nsIRunnable event); */
NS_IMETHOD DispatchDirectTaskToCurrentThread(nsIRunnable *event) = 0;
/* void spinEventLoopUntil (in ACString aVeryGoodReasonToDoThis, in nsINestedEventLoopCondition condition); */
NS_IMETHOD SpinEventLoopUntil(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition) = 0;
/* void spinEventLoopUntilOrQuit (in ACString aVeryGoodReasonToDoThis, in nsINestedEventLoopCondition condition); */
NS_IMETHOD SpinEventLoopUntilOrQuit(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition) = 0;
/* void spinEventLoopUntilEmpty (); */
NS_IMETHOD SpinEventLoopUntilEmpty(void) = 0;
/* readonly attribute nsIEventTarget mainThreadEventTarget; */
NS_IMETHOD GetMainThreadEventTarget(nsIEventTarget **aMainThreadEventTarget) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIThreadManager, NS_ITHREADMANAGER_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSITHREADMANAGER \
NS_IMETHOD NewNamedThread(const nsACString& name, nsIThreadManager::ThreadCreationOptions options, nsIThread **_retval) override; \
NS_IMETHOD GetMainThread(nsIThread **aMainThread) override; \
NS_IMETHOD GetCurrentThread(nsIThread **aCurrentThread) override; \
NS_IMETHOD DispatchToMainThread(nsIRunnable *event, uint32_t priority, uint8_t _argc) override; \
NS_IMETHOD DispatchToMainThreadWithMicroTask(nsIRunnable *event, uint32_t priority, uint8_t _argc) override; \
NS_IMETHOD IdleDispatchToMainThread(nsIRunnable *event, uint32_t timeout) override; \
NS_IMETHOD DispatchDirectTaskToCurrentThread(nsIRunnable *event) override; \
NS_IMETHOD SpinEventLoopUntil(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition) override; \
NS_IMETHOD SpinEventLoopUntilOrQuit(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition) override; \
NS_IMETHOD SpinEventLoopUntilEmpty(void) override; \
NS_IMETHOD GetMainThreadEventTarget(nsIEventTarget **aMainThreadEventTarget) override;
/* Use this macro when declaring the members of this interface when the
class doesn't implement the interface. This is useful for forwarding. */
#define NS_DECL_NON_VIRTUAL_NSITHREADMANAGER \
nsresult NewNamedThread(const nsACString& name, nsIThreadManager::ThreadCreationOptions options, nsIThread **_retval); \
nsresult GetMainThread(nsIThread **aMainThread); \
nsresult GetCurrentThread(nsIThread **aCurrentThread); \
nsresult DispatchToMainThread(nsIRunnable *event, uint32_t priority, uint8_t _argc); \
nsresult DispatchToMainThreadWithMicroTask(nsIRunnable *event, uint32_t priority, uint8_t _argc); \
nsresult IdleDispatchToMainThread(nsIRunnable *event, uint32_t timeout); \
nsresult DispatchDirectTaskToCurrentThread(nsIRunnable *event); \
nsresult SpinEventLoopUntil(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition); \
nsresult SpinEventLoopUntilOrQuit(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition); \
nsresult SpinEventLoopUntilEmpty(void); \
nsresult GetMainThreadEventTarget(nsIEventTarget **aMainThreadEventTarget);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSITHREADMANAGER(_to) \
NS_IMETHOD NewNamedThread(const nsACString& name, nsIThreadManager::ThreadCreationOptions options, nsIThread **_retval) override { return _to NewNamedThread(name, options, _retval); } \
NS_IMETHOD GetMainThread(nsIThread **aMainThread) override { return _to GetMainThread(aMainThread); } \
NS_IMETHOD GetCurrentThread(nsIThread **aCurrentThread) override { return _to GetCurrentThread(aCurrentThread); } \
NS_IMETHOD DispatchToMainThread(nsIRunnable *event, uint32_t priority, uint8_t _argc) override { return _to DispatchToMainThread(event, priority, _argc); } \
NS_IMETHOD DispatchToMainThreadWithMicroTask(nsIRunnable *event, uint32_t priority, uint8_t _argc) override { return _to DispatchToMainThreadWithMicroTask(event, priority, _argc); } \
NS_IMETHOD IdleDispatchToMainThread(nsIRunnable *event, uint32_t timeout) override { return _to IdleDispatchToMainThread(event, timeout); } \
NS_IMETHOD DispatchDirectTaskToCurrentThread(nsIRunnable *event) override { return _to DispatchDirectTaskToCurrentThread(event); } \
NS_IMETHOD SpinEventLoopUntil(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition) override { return _to SpinEventLoopUntil(aVeryGoodReasonToDoThis, condition); } \
NS_IMETHOD SpinEventLoopUntilOrQuit(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition) override { return _to SpinEventLoopUntilOrQuit(aVeryGoodReasonToDoThis, condition); } \
NS_IMETHOD SpinEventLoopUntilEmpty(void) override { return _to SpinEventLoopUntilEmpty(); } \
NS_IMETHOD GetMainThreadEventTarget(nsIEventTarget **aMainThreadEventTarget) override { return _to GetMainThreadEventTarget(aMainThreadEventTarget); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSITHREADMANAGER(_to) \
NS_IMETHOD NewNamedThread(const nsACString& name, nsIThreadManager::ThreadCreationOptions options, nsIThread **_retval) override { return !_to ? NS_ERROR_NULL_POINTER : _to->NewNamedThread(name, options, _retval); } \
NS_IMETHOD GetMainThread(nsIThread **aMainThread) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetMainThread(aMainThread); } \
NS_IMETHOD GetCurrentThread(nsIThread **aCurrentThread) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCurrentThread(aCurrentThread); } \
NS_IMETHOD DispatchToMainThread(nsIRunnable *event, uint32_t priority, uint8_t _argc) override { return !_to ? NS_ERROR_NULL_POINTER : _to->DispatchToMainThread(event, priority, _argc); } \
NS_IMETHOD DispatchToMainThreadWithMicroTask(nsIRunnable *event, uint32_t priority, uint8_t _argc) override { return !_to ? NS_ERROR_NULL_POINTER : _to->DispatchToMainThreadWithMicroTask(event, priority, _argc); } \
NS_IMETHOD IdleDispatchToMainThread(nsIRunnable *event, uint32_t timeout) override { return !_to ? NS_ERROR_NULL_POINTER : _to->IdleDispatchToMainThread(event, timeout); } \
NS_IMETHOD DispatchDirectTaskToCurrentThread(nsIRunnable *event) override { return !_to ? NS_ERROR_NULL_POINTER : _to->DispatchDirectTaskToCurrentThread(event); } \
NS_IMETHOD SpinEventLoopUntil(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SpinEventLoopUntil(aVeryGoodReasonToDoThis, condition); } \
NS_IMETHOD SpinEventLoopUntilOrQuit(const nsACString& aVeryGoodReasonToDoThis, nsINestedEventLoopCondition *condition) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SpinEventLoopUntilOrQuit(aVeryGoodReasonToDoThis, condition); } \
NS_IMETHOD SpinEventLoopUntilEmpty(void) override { return !_to ? NS_ERROR_NULL_POINTER : _to->SpinEventLoopUntilEmpty(); } \
NS_IMETHOD GetMainThreadEventTarget(nsIEventTarget **aMainThreadEventTarget) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetMainThreadEventTarget(aMainThreadEventTarget); }
#endif /* __gen_nsIThreadManager_h__ */