Bug 1119956 derive from DiscardableRunnable instead of CancelableRunnable when Cancel() is not supported r=asuth,sg
Differential Revision: https://phabricator.services.mozilla.com/D98118
This commit is contained in:
@@ -1060,7 +1060,7 @@ static void AsyncFulfillImageBitmapPromise(Promise* aPromise,
|
||||
|
||||
class CreateImageBitmapFromBlobRunnable;
|
||||
|
||||
class CreateImageBitmapFromBlob final : public CancelableRunnable,
|
||||
class CreateImageBitmapFromBlob final : public DiscardableRunnable,
|
||||
public imgIContainerCallback,
|
||||
public nsIInputStreamCallback {
|
||||
friend class CreateImageBitmapFromBlobRunnable;
|
||||
@@ -1093,7 +1093,7 @@ class CreateImageBitmapFromBlob final : public CancelableRunnable,
|
||||
already_AddRefed<nsIInputStream> aInputStream,
|
||||
const Maybe<IntRect>& aCropRect,
|
||||
nsIEventTarget* aMainThreadEventTarget)
|
||||
: CancelableRunnable("dom::CreateImageBitmapFromBlob"),
|
||||
: DiscardableRunnable("dom::CreateImageBitmapFromBlob"),
|
||||
mMutex("dom::CreateImageBitmapFromBlob::mMutex"),
|
||||
mPromise(aPromise),
|
||||
mGlobalObject(aGlobal),
|
||||
@@ -1153,7 +1153,7 @@ class CreateImageBitmapFromBlob final : public CancelableRunnable,
|
||||
void* mThread;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(CreateImageBitmapFromBlob, CancelableRunnable,
|
||||
NS_IMPL_ISUPPORTS_INHERITED(CreateImageBitmapFromBlob, DiscardableRunnable,
|
||||
imgIContainerCallback, nsIInputStreamCallback)
|
||||
|
||||
class CreateImageBitmapFromBlobRunnable : public WorkerRunnable {
|
||||
|
||||
@@ -29,7 +29,7 @@ class RemoteLazyInputStream;
|
||||
|
||||
namespace {
|
||||
|
||||
class InputStreamCallbackRunnable final : public CancelableRunnable {
|
||||
class InputStreamCallbackRunnable final : public DiscardableRunnable {
|
||||
public:
|
||||
// Note that the execution can be synchronous in case the event target is
|
||||
// null.
|
||||
@@ -60,7 +60,7 @@ class InputStreamCallbackRunnable final : public CancelableRunnable {
|
||||
private:
|
||||
InputStreamCallbackRunnable(nsIInputStreamCallback* aCallback,
|
||||
RemoteLazyInputStream* aStream)
|
||||
: CancelableRunnable("dom::InputStreamCallbackRunnable"),
|
||||
: DiscardableRunnable("dom::InputStreamCallbackRunnable"),
|
||||
mCallback(aCallback),
|
||||
mStream(aStream) {
|
||||
MOZ_ASSERT(mCallback);
|
||||
@@ -71,7 +71,7 @@ class InputStreamCallbackRunnable final : public CancelableRunnable {
|
||||
RefPtr<RemoteLazyInputStream> mStream;
|
||||
};
|
||||
|
||||
class FileMetadataCallbackRunnable final : public CancelableRunnable {
|
||||
class FileMetadataCallbackRunnable final : public DiscardableRunnable {
|
||||
public:
|
||||
static void Execute(nsIFileMetadataCallback* aCallback,
|
||||
nsIEventTarget* aEventTarget,
|
||||
@@ -97,7 +97,7 @@ class FileMetadataCallbackRunnable final : public CancelableRunnable {
|
||||
private:
|
||||
FileMetadataCallbackRunnable(nsIFileMetadataCallback* aCallback,
|
||||
RemoteLazyInputStream* aStream)
|
||||
: CancelableRunnable("dom::FileMetadataCallbackRunnable"),
|
||||
: DiscardableRunnable("dom::FileMetadataCallbackRunnable"),
|
||||
mCallback(aCallback),
|
||||
mStream(aStream) {
|
||||
MOZ_ASSERT(mCallback);
|
||||
@@ -849,7 +849,7 @@ RemoteLazyInputStream::Length(int64_t* aLength) {
|
||||
|
||||
namespace {
|
||||
|
||||
class InputStreamLengthCallbackRunnable final : public CancelableRunnable {
|
||||
class InputStreamLengthCallbackRunnable final : public DiscardableRunnable {
|
||||
public:
|
||||
static void Execute(nsIInputStreamLengthCallback* aCallback,
|
||||
nsIEventTarget* aEventTarget,
|
||||
@@ -876,7 +876,7 @@ class InputStreamLengthCallbackRunnable final : public CancelableRunnable {
|
||||
InputStreamLengthCallbackRunnable(nsIInputStreamLengthCallback* aCallback,
|
||||
RemoteLazyInputStream* aStream,
|
||||
int64_t aLength)
|
||||
: CancelableRunnable("dom::InputStreamLengthCallbackRunnable"),
|
||||
: DiscardableRunnable("dom::InputStreamLengthCallbackRunnable"),
|
||||
mCallback(aCallback),
|
||||
mStream(aStream),
|
||||
mLength(aLength) {
|
||||
|
||||
@@ -19,10 +19,10 @@ namespace {
|
||||
|
||||
// This runnable is used in case the last stream is forgotten on the 'wrong'
|
||||
// thread.
|
||||
class ShutdownRunnable final : public CancelableRunnable {
|
||||
class ShutdownRunnable final : public DiscardableRunnable {
|
||||
public:
|
||||
explicit ShutdownRunnable(RemoteLazyInputStreamChild* aActor)
|
||||
: CancelableRunnable("dom::ShutdownRunnable"), mActor(aActor) {}
|
||||
: DiscardableRunnable("dom::ShutdownRunnable"), mActor(aActor) {}
|
||||
|
||||
NS_IMETHOD
|
||||
Run() override {
|
||||
@@ -36,10 +36,10 @@ class ShutdownRunnable final : public CancelableRunnable {
|
||||
|
||||
// This runnable is used in case StreamNeeded() has been called on a non-owning
|
||||
// thread.
|
||||
class StreamNeededRunnable final : public CancelableRunnable {
|
||||
class StreamNeededRunnable final : public DiscardableRunnable {
|
||||
public:
|
||||
explicit StreamNeededRunnable(RemoteLazyInputStreamChild* aActor)
|
||||
: CancelableRunnable("dom::StreamNeededRunnable"), mActor(aActor) {}
|
||||
: DiscardableRunnable("dom::StreamNeededRunnable"), mActor(aActor) {}
|
||||
|
||||
NS_IMETHOD
|
||||
Run() override {
|
||||
@@ -58,11 +58,11 @@ class StreamNeededRunnable final : public CancelableRunnable {
|
||||
|
||||
// When the stream has been received from the parent, we inform the
|
||||
// RemoteLazyInputStream.
|
||||
class StreamReadyRunnable final : public CancelableRunnable {
|
||||
class StreamReadyRunnable final : public DiscardableRunnable {
|
||||
public:
|
||||
StreamReadyRunnable(RemoteLazyInputStream* aDestinationStream,
|
||||
already_AddRefed<nsIInputStream> aCreatedStream)
|
||||
: CancelableRunnable("dom::StreamReadyRunnable"),
|
||||
: DiscardableRunnable("dom::StreamReadyRunnable"),
|
||||
mDestinationStream(aDestinationStream),
|
||||
mCreatedStream(std::move(aCreatedStream)) {
|
||||
MOZ_ASSERT(mDestinationStream);
|
||||
@@ -82,10 +82,10 @@ class StreamReadyRunnable final : public CancelableRunnable {
|
||||
|
||||
// This runnable is used in case LengthNeeded() has been called on a non-owning
|
||||
// thread.
|
||||
class LengthNeededRunnable final : public CancelableRunnable {
|
||||
class LengthNeededRunnable final : public DiscardableRunnable {
|
||||
public:
|
||||
explicit LengthNeededRunnable(RemoteLazyInputStreamChild* aActor)
|
||||
: CancelableRunnable("dom::LengthNeededRunnable"), mActor(aActor) {}
|
||||
: DiscardableRunnable("dom::LengthNeededRunnable"), mActor(aActor) {}
|
||||
|
||||
NS_IMETHOD
|
||||
Run() override {
|
||||
@@ -104,10 +104,10 @@ class LengthNeededRunnable final : public CancelableRunnable {
|
||||
|
||||
// When the stream has been received from the parent, we inform the
|
||||
// RemoteLazyInputStream.
|
||||
class LengthReadyRunnable final : public CancelableRunnable {
|
||||
class LengthReadyRunnable final : public DiscardableRunnable {
|
||||
public:
|
||||
LengthReadyRunnable(RemoteLazyInputStream* aDestinationStream, int64_t aSize)
|
||||
: CancelableRunnable("dom::LengthReadyRunnable"),
|
||||
: DiscardableRunnable("dom::LengthReadyRunnable"),
|
||||
mDestinationStream(aDestinationStream),
|
||||
mSize(aSize) {
|
||||
MOZ_ASSERT(mDestinationStream);
|
||||
|
||||
@@ -1063,9 +1063,9 @@ class DelayedActionRunnable final : public CancelableRunnable {
|
||||
* Actor class declarations
|
||||
******************************************************************************/
|
||||
|
||||
// CancelableRunnable is used to make workers happy.
|
||||
// DiscardableRunnable is used to make workers happy.
|
||||
class BackgroundRequestChild::PreprocessHelper final
|
||||
: public CancelableRunnable,
|
||||
: public DiscardableRunnable,
|
||||
public nsIInputStreamCallback,
|
||||
public nsIFileMetadataCallback {
|
||||
enum class State {
|
||||
@@ -1096,7 +1096,7 @@ class BackgroundRequestChild::PreprocessHelper final
|
||||
|
||||
public:
|
||||
PreprocessHelper(uint32_t aCloneDataIndex, BackgroundRequestChild* aActor)
|
||||
: CancelableRunnable(
|
||||
: DiscardableRunnable(
|
||||
"indexedDB::BackgroundRequestChild::PreprocessHelper"),
|
||||
mOwningEventTarget(aActor->GetActorEventTarget()),
|
||||
mActor(aActor),
|
||||
@@ -2820,7 +2820,7 @@ void BackgroundRequestChild::PreprocessHelper::Finish() {
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(BackgroundRequestChild::PreprocessHelper,
|
||||
CancelableRunnable, nsIInputStreamCallback,
|
||||
DiscardableRunnable, nsIInputStreamCallback,
|
||||
nsIFileMetadataCallback)
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class FlushRejections : public CancelableRunnable {
|
||||
class FlushRejections : public DiscardableRunnable {
|
||||
public:
|
||||
FlushRejections() : CancelableRunnable("dom::FlushRejections") {}
|
||||
FlushRejections() : DiscardableRunnable("dom::FlushRejections") {}
|
||||
|
||||
static void Init() {
|
||||
if (!sDispatched.init()) {
|
||||
|
||||
@@ -85,10 +85,10 @@ void ReportingObserver::TakeRecords(nsTArray<RefPtr<Report>>& aRecords) {
|
||||
|
||||
namespace {
|
||||
|
||||
class ReportRunnable final : public CancelableRunnable {
|
||||
class ReportRunnable final : public DiscardableRunnable {
|
||||
public:
|
||||
explicit ReportRunnable(nsIGlobalObject* aGlobal)
|
||||
: CancelableRunnable("ReportRunnable"), mGlobal(aGlobal) {}
|
||||
: DiscardableRunnable("ReportRunnable"), mGlobal(aGlobal) {}
|
||||
|
||||
// MOZ_CAN_RUN_SCRIPT_BOUNDARY until Runnable::Run is MOZ_CAN_RUN_SCRIPT. See
|
||||
// bug 1535398.
|
||||
|
||||
@@ -245,10 +245,10 @@ NS_IMPL_ISUPPORTS(WebSocketImpl, nsIInterfaceRequestor, nsIWebSocketListener,
|
||||
nsIObserver, nsISupportsWeakReference, nsIRequest,
|
||||
nsIEventTarget, nsIWebSocketImpl)
|
||||
|
||||
class CallDispatchConnectionCloseEvents final : public CancelableRunnable {
|
||||
class CallDispatchConnectionCloseEvents final : public DiscardableRunnable {
|
||||
public:
|
||||
explicit CallDispatchConnectionCloseEvents(WebSocketImpl* aWebSocketImpl)
|
||||
: CancelableRunnable("dom::CallDispatchConnectionCloseEvents"),
|
||||
: DiscardableRunnable("dom::CallDispatchConnectionCloseEvents"),
|
||||
mWebSocketImpl(aWebSocketImpl) {
|
||||
aWebSocketImpl->AssertIsOnTargetThread();
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ class ChildImpl::ShutdownObserver final : public nsIObserver {
|
||||
~ShutdownObserver() { AssertIsOnMainThread(); }
|
||||
};
|
||||
|
||||
class ChildImpl::SendInitBackgroundRunnable final : public CancelableRunnable {
|
||||
class ChildImpl::SendInitBackgroundRunnable final : public DiscardableRunnable {
|
||||
nsCOMPtr<nsISerialEventTarget> mOwningEventTarget;
|
||||
RefPtr<StrongWorkerRef> mWorkerRef;
|
||||
Endpoint<PBackgroundParent> mParent;
|
||||
@@ -616,7 +616,8 @@ class ChildImpl::SendInitBackgroundRunnable final : public CancelableRunnable {
|
||||
Endpoint<PBackgroundParent>&& aParent,
|
||||
std::function<void(Endpoint<PBackgroundParent>&& aParent)>&& aFunc,
|
||||
unsigned int aThreadLocalIndex)
|
||||
: CancelableRunnable("Background::ChildImpl::SendInitBackgroundRunnable"),
|
||||
: DiscardableRunnable(
|
||||
"Background::ChildImpl::SendInitBackgroundRunnable"),
|
||||
mOwningEventTarget(GetCurrentSerialEventTarget()),
|
||||
mParent(std::move(aParent)),
|
||||
mMutex("SendInitBackgroundRunnable::mMutex"),
|
||||
|
||||
@@ -747,10 +747,11 @@ nsresult CycleCollectedJSContext::NotifyUnhandledRejections::Cancel() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class FinalizationRegistryCleanup::CleanupRunnable : public CancelableRunnable {
|
||||
class FinalizationRegistryCleanup::CleanupRunnable
|
||||
: public DiscardableRunnable {
|
||||
public:
|
||||
explicit CleanupRunnable(FinalizationRegistryCleanup* aCleanupWork)
|
||||
: CancelableRunnable("CleanupRunnable"), mCleanupWork(aCleanupWork) {}
|
||||
: DiscardableRunnable("CleanupRunnable"), mCleanupWork(aCleanupWork) {}
|
||||
|
||||
// MOZ_CAN_RUN_SCRIPT_BOUNDARY until Runnable::Run is MOZ_CAN_RUN_SCRIPT. See
|
||||
// bug 1535398.
|
||||
|
||||
@@ -117,7 +117,7 @@ struct DeferredFinalizeFunctionHolder {
|
||||
void* data;
|
||||
};
|
||||
|
||||
class IncrementalFinalizeRunnable : public CancelableRunnable {
|
||||
class IncrementalFinalizeRunnable : public DiscardableRunnable {
|
||||
typedef AutoTArray<DeferredFinalizeFunctionHolder, 16> DeferredFinalizeArray;
|
||||
typedef CycleCollectedJSRuntime::DeferredFinalizerTable
|
||||
DeferredFinalizerTable;
|
||||
@@ -1560,7 +1560,7 @@ void CycleCollectedJSRuntime::DumpJSHeap(FILE* aFile) {
|
||||
|
||||
IncrementalFinalizeRunnable::IncrementalFinalizeRunnable(
|
||||
CycleCollectedJSRuntime* aRt, DeferredFinalizerTable& aFinalizers)
|
||||
: CancelableRunnable("IncrementalFinalizeRunnable"),
|
||||
: DiscardableRunnable("IncrementalFinalizeRunnable"),
|
||||
mRuntime(aRt),
|
||||
mFinalizeFunctionToRun(0),
|
||||
mReleasing(false) {
|
||||
|
||||
@@ -1334,10 +1334,10 @@ struct CCGraphDescriber : public LinkedListElement<CCGraphDescriber> {
|
||||
Type mType;
|
||||
};
|
||||
|
||||
class LogStringMessageAsync : public CancelableRunnable {
|
||||
class LogStringMessageAsync : public DiscardableRunnable {
|
||||
public:
|
||||
explicit LogStringMessageAsync(const nsAString& aMsg)
|
||||
: mozilla::CancelableRunnable("LogStringMessageAsync"), mMsg(aMsg) {}
|
||||
: mozilla::DiscardableRunnable("LogStringMessageAsync"), mMsg(aMsg) {}
|
||||
|
||||
NS_IMETHOD Run() override {
|
||||
nsCOMPtr<nsIConsoleService> cs =
|
||||
|
||||
@@ -774,7 +774,7 @@ nsMultiplexInputStream::CloseWithStatus(nsresult aStatus) { return Close(); }
|
||||
|
||||
// This class is used to inform nsMultiplexInputStream that it's time to execute
|
||||
// the asyncWait callback.
|
||||
class AsyncWaitRunnable final : public CancelableRunnable {
|
||||
class AsyncWaitRunnable final : public DiscardableRunnable {
|
||||
RefPtr<nsMultiplexInputStream> mStream;
|
||||
|
||||
public:
|
||||
@@ -796,7 +796,7 @@ class AsyncWaitRunnable final : public CancelableRunnable {
|
||||
|
||||
private:
|
||||
explicit AsyncWaitRunnable(nsMultiplexInputStream* aStream)
|
||||
: CancelableRunnable("AsyncWaitRunnable"), mStream(aStream) {
|
||||
: DiscardableRunnable("AsyncWaitRunnable"), mStream(aStream) {
|
||||
MOZ_ASSERT(aStream);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user