Bug 1339677. Part 2 - some code cleanup and remove unnecessary scope qualifiers. r=gerald

MozReview-Commit-ID: 5h7Mv5joGHy

--HG--
extra : rebase_source : 0f81f34b6a7a78e1832c8c5e8f3f570e7e4719fc
extra : intermediate-source : 88dbebd4cfab00aa234b04c3d279ab1e3b82833f
extra : source : 66e5c1b54d22de67b9838afb790805ef8cf1f23e
This commit is contained in:
JW Wang 2017-01-24 16:24:10 +08:00
Родитель 51d90c702d
Коммит 46381af26b
1 изменённых файлов: 5 добавлений и 11 удалений

Просмотреть файл

@ -278,11 +278,6 @@ public:
{
public:
virtual void Disconnect() = 0;
// MSVC complains when an inner class (ThenValueBase::{Resolve,Reject}Runnable)
// tries to access an inherited protected member.
bool IsDisconnected() const { return mDisconnected; }
virtual void AssertIsDead() = 0;
protected:
@ -364,22 +359,21 @@ protected:
aPromise->mMutex.AssertCurrentThreadOwns();
MOZ_ASSERT(!aPromise->IsPending());
RefPtr<Runnable> runnable =
static_cast<Runnable*>(new (typename ThenValueBase::ResolveOrRejectRunnable)(this, aPromise));
nsCOMPtr<nsIRunnable> r = new ResolveOrRejectRunnable(this, aPromise);
PROMISE_LOG("%s Then() call made from %s [Runnable=%p, Promise=%p, ThenValue=%p]",
aPromise->mValue.IsResolve() ? "Resolving" : "Rejecting", ThenValueBase::mCallSite,
runnable.get(), aPromise, this);
aPromise->mValue.IsResolve() ? "Resolving" : "Rejecting", mCallSite,
r.get(), aPromise, this);
// Promise consumers are allowed to disconnect the Request object and
// then shut down the thread or task queue that the promise result would
// be dispatched on. So we unfortunately can't assert that promise
// dispatch succeeds. :-(
mResponseTarget->Dispatch(runnable.forget(), AbstractThread::DontAssertDispatchSuccess);
mResponseTarget->Dispatch(r.forget(), AbstractThread::DontAssertDispatchSuccess);
}
void Disconnect() override
{
MOZ_DIAGNOSTIC_ASSERT(ThenValueBase::mResponseTarget->IsCurrentThreadIn());
MOZ_DIAGNOSTIC_ASSERT(mResponseTarget->IsCurrentThreadIn());
MOZ_DIAGNOSTIC_ASSERT(!Request::mComplete);
Request::mDisconnected = true;