XPCOM:nsIEventTargetManager: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 4: Line 4:


[http://lxr.mozilla.org/mozilla/source/xpcom/threads/nsIEventTarget.idl nsIEventTarget] abstracts the posting of a [http://lxr.mozilla.org/mozilla/source/xpcom/threads/plevent.h#506 PLEvent] to a thread event queue.  It is currently implemented by [http://lxr.mozilla.org/mozilla/source/xpcom/threads/nsEventQueue.h#43 nsEventQueue], [http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsSocketTransportService2.h#126 nsSocketTransportService], and [http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsIOThreadPool.cpp#74 nsIOThreadPool].  Most consumers only know how to work with a [http://lxr.mozilla.org/mozilla/source/xpcom/threads/nsIEventQueue.idl nsIEventQueue], which is only implemented by the [http://lxr.mozilla.org/mozilla/source/xpcom/threads/nsEventQueue.h#43 nsEventQueue] class.
[http://lxr.mozilla.org/mozilla/source/xpcom/threads/nsIEventTarget.idl nsIEventTarget] abstracts the posting of a [http://lxr.mozilla.org/mozilla/source/xpcom/threads/plevent.h#506 PLEvent] to a thread event queue.  It is currently implemented by [http://lxr.mozilla.org/mozilla/source/xpcom/threads/nsEventQueue.h#43 nsEventQueue], [http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsSocketTransportService2.h#126 nsSocketTransportService], and [http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsIOThreadPool.cpp#74 nsIOThreadPool].  Most consumers only know how to work with a [http://lxr.mozilla.org/mozilla/source/xpcom/threads/nsIEventQueue.idl nsIEventQueue], which is only implemented by the [http://lxr.mozilla.org/mozilla/source/xpcom/threads/nsEventQueue.h#43 nsEventQueue] class.
== Proposal ==
[scriptable, uuid(...)]
interface nsIEventTargetManager : nsISupports {
  void post(in nsIEventTarget target, in nsIRunnable runnable,
            in boolean synchronous);
  nsIEventTarget getEventTarget(in ACString name);
  nsIEventTarget setEventTarget(in ACString name, in nsIEventTarget);
};

Revision as of 19:44, 9 November 2005

Summary

Provide an interface that exposes our event queue system in a freezable and scriptable fashion.

nsIEventTarget abstracts the posting of a PLEvent to a thread event queue. It is currently implemented by nsEventQueue, nsSocketTransportService, and nsIOThreadPool. Most consumers only know how to work with a nsIEventQueue, which is only implemented by the nsEventQueue class.

Proposal

[scriptable, uuid(...)]
interface nsIEventTargetManager : nsISupports {
  void post(in nsIEventTarget target, in nsIRunnable runnable,
            in boolean synchronous);
  nsIEventTarget getEventTarget(in ACString name);
  nsIEventTarget setEventTarget(in ACString name, in nsIEventTarget);
};