Bug 1293690 P1 Allow WorkerHolder::HoldWorker() callers to specify the status value they consider to be a failure. r=baku

This commit is contained in:
Ben Kelly 2016-08-18 07:11:04 -07:00
parent 32e17247b7
commit 3b1186e9b0
4 changed files with 7 additions and 6 deletions

View File

@ -22,13 +22,13 @@ WorkerHolder::~WorkerHolder()
}
bool
WorkerHolder::HoldWorker(WorkerPrivate* aWorkerPrivate)
WorkerHolder::HoldWorker(WorkerPrivate* aWorkerPrivate, Status aFailStatus)
{
NS_ASSERT_OWNINGTHREAD(WorkerHolder);
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
if (!aWorkerPrivate->AddHolder(this)) {
if (!aWorkerPrivate->AddHolder(this, aFailStatus)) {
return false;
}

View File

@ -77,7 +77,8 @@ public:
WorkerHolder();
virtual ~WorkerHolder();
bool HoldWorker(WorkerPrivate* aWorkerPrivate);
bool HoldWorker(WorkerPrivate* aWorkerPrivate,
Status aFailStatus = Canceling);
void ReleaseWorker();
virtual bool Notify(Status aStatus) = 0;

View File

@ -5260,14 +5260,14 @@ WorkerPrivate::RemoveChildWorker(ParentType* aChildWorker)
}
bool
WorkerPrivate::AddHolder(WorkerHolder* aHolder)
WorkerPrivate::AddHolder(WorkerHolder* aHolder, Status aFailStatus)
{
AssertIsOnWorkerThread();
{
MutexAutoLock lock(mMutex);
if (mStatus >= Canceling) {
if (mStatus >= aFailStatus) {
return false;
}
}

View File

@ -1449,7 +1449,7 @@ private:
ShutdownGCTimers();
bool
AddHolder(WorkerHolder* aHolder);
AddHolder(WorkerHolder* aHolder, Status aFailStatus);
void
RemoveHolder(WorkerHolder* aHolder);