Bug 969165 - Convert Atomic<T> where T != bool but is used as a bool over to Atomic<bool>, now that it's supported, in xpcom/. r=froydnj

--HG--
extra : rebase_source : 4b4e47e4246c3764f1b8d50a308b7a717c53a865
This commit is contained in:
Jeff Walden 2014-02-06 22:05:24 -08:00
Родитель b266068297
Коммит 815e4d5f22
4 изменённых файлов: 11 добавлений и 11 удалений

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

@ -113,7 +113,7 @@ nsMemoryImpl::FlushMemory(const char16_t* aReason, bool aImmediate)
} }
} }
int32_t lastVal = sIsFlushing.exchange(1); bool lastVal = sIsFlushing.exchange(true);
if (lastVal) if (lastVal)
return NS_OK; return NS_OK;
@ -154,7 +154,7 @@ nsMemoryImpl::RunFlushers(const char16_t* aReason)
nsCOMPtr<nsIObserver> observer; nsCOMPtr<nsIObserver> observer;
bool loop = true; bool loop = true;
while (NS_SUCCEEDED(e->HasMoreElements(&loop)) && loop) while (NS_SUCCEEDED(e->HasMoreElements(&loop)) && loop)
{ {
e->GetNext(getter_AddRefs(observer)); e->GetNext(getter_AddRefs(observer));
@ -166,7 +166,7 @@ nsMemoryImpl::RunFlushers(const char16_t* aReason)
} }
} }
sIsFlushing = 0; sIsFlushing = false;
return NS_OK; return NS_OK;
} }
@ -182,7 +182,7 @@ nsMemoryImpl::FlushEvent::Run()
return NS_OK; return NS_OK;
} }
mozilla::Atomic<int32_t> mozilla::Atomic<bool>
nsMemoryImpl::sIsFlushing; nsMemoryImpl::sIsFlushing;
PRIntervalTime PRIntervalTime

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

@ -38,7 +38,7 @@ protected:
const char16_t* mReason; const char16_t* mReason;
}; };
static mozilla::Atomic<int32_t> sIsFlushing; static mozilla::Atomic<bool> sIsFlushing;
static FlushEvent sFlushEvent; static FlushEvent sFlushEvent;
static PRIntervalTime sLastFlushTime; static PRIntervalTime sLastFlushTime;
}; };

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

@ -20,7 +20,7 @@ using namespace mozilla;
NS_IMPL_ISUPPORTS2(TimerThread, nsIRunnable, nsIObserver) NS_IMPL_ISUPPORTS2(TimerThread, nsIRunnable, nsIObserver)
TimerThread::TimerThread() : TimerThread::TimerThread() :
mInitInProgress(0), mInitInProgress(false),
mInitialized(false), mInitialized(false),
mMonitor("TimerThread.mMonitor"), mMonitor("TimerThread.mMonitor"),
mShutdown(false), mShutdown(false),
@ -84,7 +84,7 @@ nsresult TimerThread::Init()
return NS_OK; return NS_OK;
} }
if (mInitInProgress.exchange(1) == 0) { if (mInitInProgress.exchange(true) == false) {
// We hold on to mThread to keep the thread alive. // We hold on to mThread to keep the thread alive.
nsresult rv = NS_NewThread(getter_AddRefs(mThread), this); nsresult rv = NS_NewThread(getter_AddRefs(mThread), this);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
@ -244,7 +244,7 @@ NS_IMETHODIMP TimerThread::Run()
if (NS_FAILED(timer->PostTimerEvent())) { if (NS_FAILED(timer->PostTimerEvent())) {
nsrefcnt rc; nsrefcnt rc;
NS_RELEASE2(timer, rc); NS_RELEASE2(timer, rc);
// The nsITimer interface requires that its users keep a reference // The nsITimer interface requires that its users keep a reference
// to the timers they use while those timers are initialized but // to the timers they use while those timers are initialized but
// have not yet fired. If this ever happens, it is a bug in the // have not yet fired. If this ever happens, it is a bug in the

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

@ -37,7 +37,7 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIRUNNABLE NS_DECL_NSIRUNNABLE
NS_DECL_NSIOBSERVER NS_DECL_NSIOBSERVER
NS_HIDDEN_(nsresult) Init(); NS_HIDDEN_(nsresult) Init();
NS_HIDDEN_(nsresult) Shutdown(); NS_HIDDEN_(nsresult) Shutdown();
@ -56,7 +56,7 @@ public:
private: private:
~TimerThread(); ~TimerThread();
mozilla::Atomic<int32_t> mInitInProgress; mozilla::Atomic<bool> mInitInProgress;
bool mInitialized; bool mInitialized;
// These two internal helper methods must be called while mLock is held. // These two internal helper methods must be called while mLock is held.
@ -72,7 +72,7 @@ private:
bool mShutdown; bool mShutdown;
bool mWaiting; bool mWaiting;
bool mSleeping; bool mSleeping;
nsTArray<nsTimerImpl*> mTimers; nsTArray<nsTimerImpl*> mTimers;
}; };