mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Bug 1238404 - Use 'using' directive instead of having separate Dispatch impl in subclasses of nsIEventTarget. r=froydnj
--HG-- extra : source : 76255b192a7d6dae74f19c68653537d5f8f39775
This commit is contained in:
parent
769983140c
commit
f569fa65f9
@ -80,10 +80,7 @@ public:
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIEVENTTARGET
|
||||
// missing from NS_DECL_NSIEVENTTARGET because MSVC
|
||||
nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
|
||||
return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
|
||||
}
|
||||
using nsIEventTarget::Dispatch;
|
||||
|
||||
explicit WebSocketImpl(WebSocket* aWebSocket)
|
||||
: mWebSocket(aWebSocket)
|
||||
|
@ -81,10 +81,7 @@ public:
|
||||
NS_DECL_NSITHREADOBSERVER
|
||||
NS_DECL_NSIRUNNABLE
|
||||
NS_DECL_NSIOBSERVER
|
||||
// missing from NS_DECL_NSIEVENTTARGET because MSVC
|
||||
nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
|
||||
return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
|
||||
}
|
||||
using nsIEventTarget::Dispatch;
|
||||
|
||||
nsSocketTransportService();
|
||||
|
||||
|
@ -21,10 +21,7 @@ public:
|
||||
NS_DECL_NSISTREAMTRANSPORTSERVICE
|
||||
NS_DECL_NSIEVENTTARGET
|
||||
NS_DECL_NSIOBSERVER
|
||||
// missing from NS_DECL_NSIEVENTTARGET because MSVC
|
||||
nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
|
||||
return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
|
||||
}
|
||||
using nsIEventTarget::Dispatch;
|
||||
|
||||
nsresult Init();
|
||||
|
||||
|
@ -45,10 +45,7 @@ public:
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
NS_DECL_NSITHREADOBSERVER
|
||||
NS_DECL_NSIOBSERVER
|
||||
// missing from NS_DECL_NSIEVENTTARGET because MSVC
|
||||
nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
|
||||
return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
|
||||
}
|
||||
using nsIEventTarget::Dispatch;
|
||||
|
||||
enum ShutdownMethod
|
||||
{
|
||||
|
@ -55,10 +55,6 @@ public:
|
||||
// Forward behaviour to wrapped thread pool implementation.
|
||||
NS_FORWARD_SAFE_NSITHREADPOOL(mPool);
|
||||
|
||||
// See bug 1155059 - MSVC forces us to not declare Dispatch normally in idl
|
||||
// NS_FORWARD_SAFE_NSIEVENTTARGET(mEventTarget);
|
||||
nsresult Dispatch(nsIRunnable *event, uint32_t flags) { return !mEventTarget ? NS_ERROR_NULL_POINTER : mEventTarget->Dispatch(event, flags); }
|
||||
|
||||
NS_IMETHOD DispatchFromScript(nsIRunnable *event, uint32_t flags) override {
|
||||
return Dispatch(event, flags);
|
||||
}
|
||||
@ -66,6 +62,8 @@ public:
|
||||
NS_IMETHOD Dispatch(already_AddRefed<nsIRunnable>&& event, uint32_t flags) override
|
||||
{ return !mEventTarget ? NS_ERROR_NULL_POINTER : mEventTarget->Dispatch(Move(event), flags); }
|
||||
|
||||
using nsIEventTarget::Dispatch;
|
||||
|
||||
NS_IMETHOD IsOnCurrentThread(bool *_retval) override { return !mEventTarget ? NS_ERROR_NULL_POINTER : mEventTarget->IsOnCurrentThread(_retval); }
|
||||
|
||||
// Creates necessary statics. Called once at startup.
|
||||
|
@ -13,15 +13,10 @@
|
||||
|
||||
native alreadyAddRefed_nsIRunnable(already_AddRefed<nsIRunnable>&&);
|
||||
|
||||
[scriptable, uuid(f9d60700-e6dc-4a72-9537-689058655472)]
|
||||
[scriptable, uuid(88145945-3278-424e-9f37-d874cbdd9f6f)]
|
||||
interface nsIEventTarget : nsISupports
|
||||
{
|
||||
/* until we can get rid of all uses, keep the non-alreadyAddRefed<> version */
|
||||
/**
|
||||
* This must be non-virtual due to issues with MSVC 2013's ordering of
|
||||
* vtbls for overloads. With other platforms we can leave this virtual
|
||||
* and avoid adding lots of Dispatch() methods to classes inheriting this.
|
||||
*/
|
||||
%{C++
|
||||
nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
|
||||
return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
|
||||
|
@ -17,7 +17,7 @@
|
||||
*
|
||||
* See nsIThreadManager for the API used to create and locate threads.
|
||||
*/
|
||||
[scriptable, uuid(594feb13-6164-4054-b5a1-ad62e10ea15d)]
|
||||
[scriptable, uuid(5801d193-29d1-4964-a6b7-70eb697ddf2b)]
|
||||
interface nsIThread : nsIEventTarget
|
||||
{
|
||||
/**
|
||||
|
@ -13,7 +13,7 @@ interface nsIThreadObserver;
|
||||
* The XPCOM thread object implements this interface, which allows a consumer
|
||||
* to observe dispatch activity on the thread.
|
||||
*/
|
||||
[scriptable, uuid(9cc51754-2eb3-4b46-ae99-38a61881c622)]
|
||||
[scriptable, uuid(a3a72e5f-71d9-4add-8f30-59a78fb6d5eb)]
|
||||
interface nsIThreadInternal : nsIThread
|
||||
{
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ interface nsIThreadPoolListener : nsISupports
|
||||
* anonymous (unnamed) worker threads. An event dispatched to the thread pool
|
||||
* will be run on the next available worker thread.
|
||||
*/
|
||||
[scriptable, uuid(cacd4a2e-2655-4ff8-894c-10c15883cd0a)]
|
||||
[scriptable, uuid(76ce99c9-8e43-489a-9789-f27cc4424965)]
|
||||
interface nsIThreadPool : nsIEventTarget
|
||||
{
|
||||
/**
|
||||
|
@ -33,10 +33,7 @@ public:
|
||||
NS_DECL_NSITHREAD
|
||||
NS_DECL_NSITHREADINTERNAL
|
||||
NS_DECL_NSISUPPORTSPRIORITY
|
||||
// missing from NS_DECL_NSIEVENTTARGET because MSVC
|
||||
nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
|
||||
return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
|
||||
}
|
||||
using nsIEventTarget::Dispatch;
|
||||
|
||||
enum MainThreadFlag
|
||||
{
|
||||
|
@ -28,10 +28,7 @@ public:
|
||||
NS_DECL_NSIEVENTTARGET
|
||||
NS_DECL_NSITHREADPOOL
|
||||
NS_DECL_NSIRUNNABLE
|
||||
// missing from NS_DECL_NSIEVENTTARGET because MSVC
|
||||
nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
|
||||
return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
|
||||
}
|
||||
using nsIEventTarget::Dispatch;
|
||||
|
||||
nsThreadPool();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user