Bug 1181321 - Eliminate duplicate mRefCnt members in PromiseNativeHandler subclasses. r=baku

This commit is contained in:
Michael Layzell 2015-07-09 08:56:00 +02:00
parent 24f5535c05
commit f2e6cdf030
7 changed files with 32 additions and 9 deletions

View File

@ -43,8 +43,6 @@ Atomic<uintptr_t> gIDGenerator(0);
using namespace workers;
NS_IMPL_ISUPPORTS0(PromiseNativeHandler)
// This class processes the promise's callbacks with promise's result.
class PromiseCallbackTask final : public nsRunnable
{
@ -949,7 +947,8 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(AllResolveHandler)
NS_IMPL_CYCLE_COLLECTING_RELEASE(AllResolveHandler)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AllResolveHandler)
NS_INTERFACE_MAP_END_INHERITING(PromiseNativeHandler)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION(AllResolveHandler, mCountdownHolder)
@ -1560,6 +1559,8 @@ PromiseWorkerProxy::Create(workers::WorkerPrivate* aWorkerPrivate,
return proxy.forget();
}
NS_IMPL_ISUPPORTS0(PromiseWorkerProxy)
PromiseWorkerProxy::PromiseWorkerProxy(workers::WorkerPrivate* aWorkerPrivate,
Promise* aWorkerPromise,
const JSStructuredCloneCallbacks* aCallbacks)

View File

@ -25,9 +25,6 @@ protected:
{ }
public:
// NS_IMPL_ISUPPORTS0 in Promise.cpp.
NS_DECL_ISUPPORTS
virtual void
ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) = 0;

View File

@ -69,8 +69,7 @@ class PromiseWorkerProxy : public PromiseNativeHandler,
{
friend class PromiseWorkerProxyRunnable;
// This overrides the non-threadsafe refcounting in PromiseNativeHandler.
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PromiseWorkerProxy, override)
NS_DECL_THREADSAFE_ISUPPORTS
public:
static already_AddRefed<PromiseWorkerProxy>

View File

@ -332,6 +332,8 @@ class CacheScriptLoader;
class CacheCreator final : public PromiseNativeHandler
{
public:
NS_DECL_ISUPPORTS
explicit CacheCreator(WorkerPrivate* aWorkerPrivate)
: mCacheName(aWorkerPrivate->ServiceWorkerCacheName())
, mPrivateBrowsing(aWorkerPrivate->IsInPrivateBrowsing())
@ -398,11 +400,13 @@ private:
bool mPrivateBrowsing;
};
NS_IMPL_ISUPPORTS0(CacheCreator)
class CacheScriptLoader final : public PromiseNativeHandler
, public nsIStreamLoaderObserver
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_ISUPPORTS
NS_DECL_NSISTREAMLOADEROBSERVER
CacheScriptLoader(WorkerPrivate* aWorkerPrivate, ScriptLoadInfo& aLoadInfo,
@ -453,6 +457,8 @@ NS_IMPL_ISUPPORTS(CacheScriptLoader, nsIStreamLoaderObserver)
class CachePromiseHandler final : public PromiseNativeHandler
{
public:
NS_DECL_ISUPPORTS
CachePromiseHandler(ScriptLoaderRunnable* aRunnable,
ScriptLoadInfo& aLoadInfo,
uint32_t aIndex)
@ -481,6 +487,8 @@ private:
uint32_t mIndex;
};
NS_IMPL_ISUPPORTS0(CachePromiseHandler)
class ScriptLoaderRunnable final : public WorkerFeature,
public nsIRunnable,
public nsIStreamLoaderObserver,

View File

@ -147,6 +147,8 @@ class RespondWithHandler final : public PromiseNativeHandler
nsMainThreadPtrHandle<ServiceWorker> mServiceWorker;
RequestMode mRequestMode;
public:
NS_DECL_ISUPPORTS
RespondWithHandler(nsMainThreadPtrHandle<nsIInterceptedChannel>& aChannel,
nsMainThreadPtrHandle<ServiceWorker>& aServiceWorker,
RequestMode aRequestMode)
@ -161,6 +163,8 @@ public:
void RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
void CancelRequest();
private:
~RespondWithHandler() {}
};
struct RespondWithClosure
@ -216,6 +220,8 @@ public:
}
};
NS_IMPL_ISUPPORTS0(RespondWithHandler)
void
RespondWithHandler::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
{

View File

@ -1599,6 +1599,8 @@ class KeepAliveHandler final : public PromiseNativeHandler
{}
public:
NS_DECL_ISUPPORTS
explicit KeepAliveHandler(const nsMainThreadPtrHandle<ServiceWorker>& aServiceWorker)
: mServiceWorker(aServiceWorker)
{}
@ -1624,6 +1626,8 @@ public:
}
};
NS_IMPL_ISUPPORTS0(KeepAliveHandler)
// Returns a Promise if the event was successfully dispatched and no exceptions
// were raised, otherwise returns null.
already_AddRefed<Promise>
@ -1674,6 +1678,8 @@ class LifecycleEventPromiseHandler final : public PromiseNativeHandler
{ }
public:
NS_DECL_ISUPPORTS
LifecycleEventPromiseHandler(const nsMainThreadPtrHandle<ContinueLifecycleTask>& aTask,
const nsMainThreadPtrHandle<ServiceWorker>& aServiceWorker,
bool aActivateImmediately)
@ -1725,6 +1731,8 @@ public:
}
};
NS_IMPL_ISUPPORTS0(LifecycleEventPromiseHandler)
bool
LifecycleEventWorkerRunnable::DispatchLifecycleEvent(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
{

View File

@ -298,6 +298,8 @@ NS_IMPL_ISUPPORTS(CompareCache, nsIStreamLoaderObserver)
class CompareManager final : public PromiseNativeHandler
{
public:
NS_DECL_ISUPPORTS
explicit CompareManager(CompareCallback* aCallback)
: mCallback(aCallback)
, mState(WaitingForOpen)
@ -647,6 +649,8 @@ private:
bool mInCache;
};
NS_IMPL_ISUPPORTS0(CompareManager)
NS_IMETHODIMP
CompareNetwork::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
{