From 5c01d7c3eed6ae43f2c43828ab1129ef5d999f29 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 1 Jun 2016 10:04:54 +1000 Subject: [PATCH] Bug 1276549 - Remove rvalue reference mark for already_AddRefed params of nsIEventTarget::Dispatch and related methods. r=froydnj MozReview-Commit-ID: J5RAfGW3X7T --HG-- extra : source : e1ff4b0d5d9d2599ac00bac376597357ffd58ce0 --- dom/base/WebSocket.cpp | 8 ++++---- dom/canvas/WebGLContextLossHandler.cpp | 4 ++-- dom/workers/WorkerPrivate.cpp | 16 ++++++++-------- dom/workers/WorkerPrivate.h | 14 +++++++------- dom/workers/WorkerThread.cpp | 8 ++++---- dom/workers/WorkerThread.h | 8 ++++---- netwerk/base/nsSocketTransportService2.cpp | 4 ++-- netwerk/base/nsStreamTransportService.cpp | 4 ++-- xpcom/threads/LazyIdleThread.cpp | 4 ++-- xpcom/threads/SharedThreadPool.h | 4 ++-- xpcom/threads/nsIEventTarget.idl | 2 +- xpcom/threads/nsThread.cpp | 12 ++++++------ xpcom/threads/nsThread.h | 6 +++--- xpcom/threads/nsThreadPool.cpp | 6 +++--- xpcom/threads/nsThreadPool.h | 2 +- 15 files changed, 51 insertions(+), 51 deletions(-) diff --git a/dom/base/WebSocket.cpp b/dom/base/WebSocket.cpp index 09e109c63553..b089654f9a61 100644 --- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -2719,10 +2719,10 @@ class WorkerRunnableDispatcher final : public WorkerRunnable public: WorkerRunnableDispatcher(WebSocketImpl* aImpl, WorkerPrivate* aWorkerPrivate, - already_AddRefed&& aEvent) + already_AddRefed aEvent) : WorkerRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount) , mWebSocketImpl(aImpl) - , mEvent(aEvent) + , mEvent(Move(aEvent)) { } @@ -2779,7 +2779,7 @@ WebSocketImpl::DispatchFromScript(nsIRunnable* aEvent, uint32_t aFlags) } NS_IMETHODIMP -WebSocketImpl::Dispatch(already_AddRefed&& aEvent, uint32_t aFlags) +WebSocketImpl::Dispatch(already_AddRefed aEvent, uint32_t aFlags) { nsCOMPtr event_ref(aEvent); // If the target is the main-thread we can just dispatch the runnable. @@ -2811,7 +2811,7 @@ WebSocketImpl::Dispatch(already_AddRefed&& aEvent, uint32_t aFlags) } NS_IMETHODIMP -WebSocketImpl::DelayedDispatch(already_AddRefed&&, uint32_t) +WebSocketImpl::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/dom/canvas/WebGLContextLossHandler.cpp b/dom/canvas/WebGLContextLossHandler.cpp index 771ce4c31c6c..caea5026519c 100644 --- a/dom/canvas/WebGLContextLossHandler.cpp +++ b/dom/canvas/WebGLContextLossHandler.cpp @@ -68,7 +68,7 @@ ContextLossWorkerEventTarget::DispatchFromScript(nsIRunnable* aEvent, uint32_t a } NS_IMETHODIMP -ContextLossWorkerEventTarget::Dispatch(already_AddRefed&& aEvent, +ContextLossWorkerEventTarget::Dispatch(already_AddRefed aEvent, uint32_t aFlags) { nsCOMPtr eventRef(aEvent); @@ -78,7 +78,7 @@ ContextLossWorkerEventTarget::Dispatch(already_AddRefed&& aEvent, } NS_IMETHODIMP -ContextLossWorkerEventTarget::DelayedDispatch(already_AddRefed&&, +ContextLossWorkerEventTarget::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 4c581b0b67a7..70c79e4a31b1 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -1828,7 +1828,7 @@ TimerThreadEventTarget::DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFla } NS_IMETHODIMP -TimerThreadEventTarget::Dispatch(already_AddRefed&& aRunnable, uint32_t aFlags) +TimerThreadEventTarget::Dispatch(already_AddRefed aRunnable, uint32_t aFlags) { // This should only happen on the timer thread. MOZ_ASSERT(!NS_IsMainThread()); @@ -1850,7 +1850,7 @@ TimerThreadEventTarget::Dispatch(already_AddRefed&& aRunnable, uint } NS_IMETHODIMP -TimerThreadEventTarget::DelayedDispatch(already_AddRefed&&, uint32_t) +TimerThreadEventTarget::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -2402,7 +2402,7 @@ WorkerPrivateParent::WrapObject(JSContext* aCx, JS::Handle a template nsresult -WorkerPrivateParent::DispatchPrivate(already_AddRefed&& aRunnable, +WorkerPrivateParent::DispatchPrivate(already_AddRefed aRunnable, nsIEventTarget* aSyncLoopTarget) { // May be called on any thread! @@ -2480,7 +2480,7 @@ WorkerPrivateParent::DisableDebugger() template nsresult WorkerPrivateParent::DispatchControlRunnable( - already_AddRefed&& aWorkerControlRunnable) + already_AddRefed aWorkerControlRunnable) { // May be called on any thread! RefPtr runnable(aWorkerControlRunnable); @@ -2518,7 +2518,7 @@ WorkerPrivateParent::DispatchControlRunnable( template nsresult WorkerPrivateParent::DispatchDebuggerRunnable( - already_AddRefed&& aDebuggerRunnable) + already_AddRefed aDebuggerRunnable) { // May be called on any thread! @@ -2548,7 +2548,7 @@ WorkerPrivateParent::DispatchDebuggerRunnable( template already_AddRefed -WorkerPrivateParent::MaybeWrapAsWorkerRunnable(already_AddRefed&& aRunnable) +WorkerPrivateParent::MaybeWrapAsWorkerRunnable(already_AddRefed aRunnable) { // May be called on any thread! @@ -6738,7 +6738,7 @@ EventTarget::DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFlags) template NS_IMETHODIMP WorkerPrivateParent:: -EventTarget::Dispatch(already_AddRefed&& aRunnable, uint32_t aFlags) +EventTarget::Dispatch(already_AddRefed aRunnable, uint32_t aFlags) { // May be called on any thread! nsCOMPtr event(aRunnable); @@ -6774,7 +6774,7 @@ EventTarget::Dispatch(already_AddRefed&& aRunnable, uint32_t aFlags template NS_IMETHODIMP WorkerPrivateParent:: -EventTarget::DelayedDispatch(already_AddRefed&&, uint32_t) +EventTarget::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index 2745d24a1d20..7a538d05c3d7 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -238,7 +238,7 @@ private: ErrorResult& aRv); nsresult - DispatchPrivate(already_AddRefed&& aRunnable, nsIEventTarget* aSyncLoopTarget); + DispatchPrivate(already_AddRefed aRunnable, nsIEventTarget* aSyncLoopTarget); public: virtual JSObject* @@ -263,19 +263,19 @@ public: } nsresult - Dispatch(already_AddRefed&& aRunnable) + Dispatch(already_AddRefed aRunnable) { return DispatchPrivate(Move(aRunnable), nullptr); } nsresult - DispatchControlRunnable(already_AddRefed&& aWorkerControlRunnable); + DispatchControlRunnable(already_AddRefed aWorkerControlRunnable); nsresult - DispatchDebuggerRunnable(already_AddRefed&& aDebuggerRunnable); + DispatchDebuggerRunnable(already_AddRefed aDebuggerRunnable); already_AddRefed - MaybeWrapAsWorkerRunnable(already_AddRefed&& aRunnable); + MaybeWrapAsWorkerRunnable(already_AddRefed aRunnable); already_AddRefed GetEventTarget(); @@ -1538,10 +1538,10 @@ protected: NS_IMETHOD - Dispatch(already_AddRefed&& aRunnable, uint32_t aFlags) override; + Dispatch(already_AddRefed aRunnable, uint32_t aFlags) override; NS_IMETHOD - DelayedDispatch(already_AddRefed&&, uint32_t) override; + DelayedDispatch(already_AddRefed, uint32_t) override; NS_IMETHOD IsOnCurrentThread(bool* aIsOnCurrentThread) override; diff --git a/dom/workers/WorkerThread.cpp b/dom/workers/WorkerThread.cpp index 893e6b958346..4e79a72c2a16 100644 --- a/dom/workers/WorkerThread.cpp +++ b/dom/workers/WorkerThread.cpp @@ -145,7 +145,7 @@ WorkerThread::SetWorker(const WorkerThreadFriendKey& /* aKey */, nsresult WorkerThread::DispatchPrimaryRunnable(const WorkerThreadFriendKey& /* aKey */, - already_AddRefed&& aRunnable) + already_AddRefed aRunnable) { nsCOMPtr runnable(aRunnable); @@ -170,7 +170,7 @@ WorkerThread::DispatchPrimaryRunnable(const WorkerThreadFriendKey& /* aKey */, nsresult WorkerThread::DispatchAnyThread(const WorkerThreadFriendKey& /* aKey */, - already_AddRefed&& aWorkerRunnable) + already_AddRefed aWorkerRunnable) { // May be called on any thread! @@ -213,7 +213,7 @@ WorkerThread::DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFlags) } NS_IMETHODIMP -WorkerThread::Dispatch(already_AddRefed&& aRunnable, uint32_t aFlags) +WorkerThread::Dispatch(already_AddRefed aRunnable, uint32_t aFlags) { // May be called on any thread! nsCOMPtr runnable(aRunnable); // in case we exit early @@ -299,7 +299,7 @@ WorkerThread::Dispatch(already_AddRefed&& aRunnable, uint32_t aFlag } NS_IMETHODIMP -WorkerThread::DelayedDispatch(already_AddRefed&&, uint32_t) +WorkerThread::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/dom/workers/WorkerThread.h b/dom/workers/WorkerThread.h index f80a589a014d..d1df13332d97 100644 --- a/dom/workers/WorkerThread.h +++ b/dom/workers/WorkerThread.h @@ -68,11 +68,11 @@ public: nsresult DispatchPrimaryRunnable(const WorkerThreadFriendKey& aKey, - already_AddRefed&& aRunnable); + already_AddRefed aRunnable); nsresult DispatchAnyThread(const WorkerThreadFriendKey& aKey, - already_AddRefed&& aWorkerRunnable); + already_AddRefed aWorkerRunnable); uint32_t RecursionDepth(const WorkerThreadFriendKey& aKey) const; @@ -86,13 +86,13 @@ private: // This should only be called by consumers that have an // nsIEventTarget/nsIThread pointer. NS_IMETHOD - Dispatch(already_AddRefed&& aRunnable, uint32_t aFlags) override; + Dispatch(already_AddRefed aRunnable, uint32_t aFlags) override; NS_IMETHOD DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFlags) override; NS_IMETHOD - DelayedDispatch(already_AddRefed&&, uint32_t) override; + DelayedDispatch(already_AddRefed, uint32_t) override; }; } // namespace workers diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 4107ca2d2336..ed20ea24542c 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -161,7 +161,7 @@ nsSocketTransportService::DispatchFromScript(nsIRunnable *event, uint32_t flags) } NS_IMETHODIMP -nsSocketTransportService::Dispatch(already_AddRefed&& event, uint32_t flags) +nsSocketTransportService::Dispatch(already_AddRefed event, uint32_t flags) { nsCOMPtr event_ref(event); SOCKET_LOG(("STS dispatch [%p]\n", event_ref.get())); @@ -178,7 +178,7 @@ nsSocketTransportService::Dispatch(already_AddRefed&& event, uint32 } NS_IMETHODIMP -nsSocketTransportService::DelayedDispatch(already_AddRefed&&, uint32_t) +nsSocketTransportService::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/netwerk/base/nsStreamTransportService.cpp b/netwerk/base/nsStreamTransportService.cpp index 52d2a35df4d6..23ca3b860008 100644 --- a/netwerk/base/nsStreamTransportService.cpp +++ b/netwerk/base/nsStreamTransportService.cpp @@ -514,7 +514,7 @@ nsStreamTransportService::DispatchFromScript(nsIRunnable *task, uint32_t flags) } NS_IMETHODIMP -nsStreamTransportService::Dispatch(already_AddRefed&& task, uint32_t flags) +nsStreamTransportService::Dispatch(already_AddRefed task, uint32_t flags) { nsCOMPtr event(task); // so it gets released on failure paths nsCOMPtr pool; @@ -530,7 +530,7 @@ nsStreamTransportService::Dispatch(already_AddRefed&& task, uint32_ } NS_IMETHODIMP -nsStreamTransportService::DelayedDispatch(already_AddRefed&&, uint32_t) +nsStreamTransportService::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/xpcom/threads/LazyIdleThread.cpp b/xpcom/threads/LazyIdleThread.cpp index 2c744977f263..3b42b5a06777 100644 --- a/xpcom/threads/LazyIdleThread.cpp +++ b/xpcom/threads/LazyIdleThread.cpp @@ -398,7 +398,7 @@ LazyIdleThread::DispatchFromScript(nsIRunnable* aEvent, uint32_t aFlags) } NS_IMETHODIMP -LazyIdleThread::Dispatch(already_AddRefed&& aEvent, +LazyIdleThread::Dispatch(already_AddRefed aEvent, uint32_t aFlags) { ASSERT_OWNING_THREAD(); @@ -431,7 +431,7 @@ LazyIdleThread::Dispatch(already_AddRefed&& aEvent, } NS_IMETHODIMP -LazyIdleThread::DelayedDispatch(already_AddRefed&&, uint32_t) +LazyIdleThread::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/xpcom/threads/SharedThreadPool.h b/xpcom/threads/SharedThreadPool.h index 83835d9165de..2d4aeca19f25 100644 --- a/xpcom/threads/SharedThreadPool.h +++ b/xpcom/threads/SharedThreadPool.h @@ -64,10 +64,10 @@ public: return Dispatch(event, flags); } - NS_IMETHOD Dispatch(already_AddRefed&& event, uint32_t flags) override + NS_IMETHOD Dispatch(already_AddRefed event, uint32_t flags) override { return !mEventTarget ? NS_ERROR_NULL_POINTER : mEventTarget->Dispatch(Move(event), flags); } - NS_IMETHOD DelayedDispatch(already_AddRefed&&, uint32_t) override + NS_IMETHOD DelayedDispatch(already_AddRefed, uint32_t) override { return NS_ERROR_NOT_IMPLEMENTED; } using nsIEventTarget::Dispatch; diff --git a/xpcom/threads/nsIEventTarget.idl b/xpcom/threads/nsIEventTarget.idl index 3d9d15817dbc..3088b72ccfa1 100644 --- a/xpcom/threads/nsIEventTarget.idl +++ b/xpcom/threads/nsIEventTarget.idl @@ -11,7 +11,7 @@ #include "mozilla/AlreadyAddRefed.h" %} -native alreadyAddRefed_nsIRunnable(already_AddRefed&&); +native alreadyAddRefed_nsIRunnable(already_AddRefed); [scriptable, uuid(88145945-3278-424e-9f37-d874cbdd9f6f)] interface nsIEventTarget : nsISupports diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index 4e125c42992e..fe0b7b867456 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -636,7 +636,7 @@ nsThread::PutEvent(nsIRunnable* aEvent, nsNestedEventTarget* aTarget) } nsresult -nsThread::PutEvent(already_AddRefed&& aEvent, nsNestedEventTarget* aTarget) +nsThread::PutEvent(already_AddRefed aEvent, nsNestedEventTarget* aTarget) { // We want to leak the reference when we fail to dispatch it, so that // we won't release the event in a wrong thread. @@ -673,7 +673,7 @@ nsThread::PutEvent(already_AddRefed&& aEvent, nsNestedEventTarget* } nsresult -nsThread::DispatchInternal(already_AddRefed&& aEvent, uint32_t aFlags, +nsThread::DispatchInternal(already_AddRefed aEvent, uint32_t aFlags, nsNestedEventTarget* aTarget) { // We want to leak the reference when we fail to dispatch it, so that @@ -739,7 +739,7 @@ nsThread::DispatchFromScript(nsIRunnable* aEvent, uint32_t aFlags) } NS_IMETHODIMP -nsThread::Dispatch(already_AddRefed&& aEvent, uint32_t aFlags) +nsThread::Dispatch(already_AddRefed aEvent, uint32_t aFlags) { LOG(("THRD(%p) Dispatch [%p %x]\n", this, /* XXX aEvent */nullptr, aFlags)); @@ -747,7 +747,7 @@ nsThread::Dispatch(already_AddRefed&& aEvent, uint32_t aFlags) } NS_IMETHODIMP -nsThread::DelayedDispatch(already_AddRefed&& aEvent, uint32_t aDelayMs) +nsThread::DelayedDispatch(already_AddRefed aEvent, uint32_t aDelayMs) { NS_ENSURE_TRUE(!!aDelayMs, NS_ERROR_UNEXPECTED); @@ -1304,7 +1304,7 @@ nsThread::nsNestedEventTarget::DispatchFromScript(nsIRunnable* aEvent, uint32_t } NS_IMETHODIMP -nsThread::nsNestedEventTarget::Dispatch(already_AddRefed&& aEvent, uint32_t aFlags) +nsThread::nsNestedEventTarget::Dispatch(already_AddRefed aEvent, uint32_t aFlags) { LOG(("THRD(%p) Dispatch [%p %x] to nested loop %p\n", mThread.get().get(), /*XXX aEvent*/ nullptr, aFlags, this)); @@ -1313,7 +1313,7 @@ nsThread::nsNestedEventTarget::Dispatch(already_AddRefed&& aEvent, } NS_IMETHODIMP -nsThread::nsNestedEventTarget::DelayedDispatch(already_AddRefed&&, uint32_t) +nsThread::nsNestedEventTarget::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/xpcom/threads/nsThread.h b/xpcom/threads/nsThread.h index 457971683255..250e860d704a 100644 --- a/xpcom/threads/nsThread.h +++ b/xpcom/threads/nsThread.h @@ -111,10 +111,10 @@ protected: // Wrappers for event queue methods: nsresult PutEvent(nsIRunnable* aEvent, nsNestedEventTarget* aTarget); - nsresult PutEvent(already_AddRefed&& aEvent, + nsresult PutEvent(already_AddRefed aEvent, nsNestedEventTarget* aTarget); - nsresult DispatchInternal(already_AddRefed&& aEvent, + nsresult DispatchInternal(already_AddRefed aEvent, uint32_t aFlags, nsNestedEventTarget* aTarget); struct nsThreadShutdownContext* ShutdownInternal(bool aSync); @@ -140,7 +140,7 @@ protected: mQueue.PutEvent(aEvent, aProofOfLock); } - void PutEvent(already_AddRefed&& aEvent, + void PutEvent(already_AddRefed aEvent, mozilla::MutexAutoLock& aProofOfLock) { mQueue.PutEvent(mozilla::Move(aEvent), aProofOfLock); diff --git a/xpcom/threads/nsThreadPool.cpp b/xpcom/threads/nsThreadPool.cpp index 6760e7bdadb9..55f5d9e7fc8f 100644 --- a/xpcom/threads/nsThreadPool.cpp +++ b/xpcom/threads/nsThreadPool.cpp @@ -68,7 +68,7 @@ nsThreadPool::PutEvent(nsIRunnable* aEvent) } nsresult -nsThreadPool::PutEvent(already_AddRefed&& aEvent, uint32_t aFlags) +nsThreadPool::PutEvent(already_AddRefed aEvent, uint32_t aFlags) { // Avoid spawning a new thread while holding the event queue lock... @@ -248,7 +248,7 @@ nsThreadPool::DispatchFromScript(nsIRunnable* aEvent, uint32_t aFlags) } NS_IMETHODIMP -nsThreadPool::Dispatch(already_AddRefed&& aEvent, uint32_t aFlags) +nsThreadPool::Dispatch(already_AddRefed aEvent, uint32_t aFlags) { LOG(("THRD-P(%p) dispatch [%p %x]\n", this, /* XXX aEvent*/ nullptr, aFlags)); @@ -279,7 +279,7 @@ nsThreadPool::Dispatch(already_AddRefed&& aEvent, uint32_t aFlags) } NS_IMETHODIMP -nsThreadPool::DelayedDispatch(already_AddRefed&&, uint32_t) +nsThreadPool::DelayedDispatch(already_AddRefed, uint32_t) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/xpcom/threads/nsThreadPool.h b/xpcom/threads/nsThreadPool.h index e95c07359e21..3fcbd7c8e998 100644 --- a/xpcom/threads/nsThreadPool.h +++ b/xpcom/threads/nsThreadPool.h @@ -37,7 +37,7 @@ private: void ShutdownThread(nsIThread* aThread); nsresult PutEvent(nsIRunnable* aEvent); - nsresult PutEvent(already_AddRefed&& aEvent, uint32_t aFlags); + nsresult PutEvent(already_AddRefed aEvent, uint32_t aFlags); nsCOMArray mThreads; mozilla::Mutex mMutex;