mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
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:
parent
b266068297
commit
815e4d5f22
@ -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)
|
||||
return NS_OK;
|
||||
|
||||
@ -154,7 +154,7 @@ nsMemoryImpl::RunFlushers(const char16_t* aReason)
|
||||
nsCOMPtr<nsIObserver> observer;
|
||||
bool loop = true;
|
||||
|
||||
while (NS_SUCCEEDED(e->HasMoreElements(&loop)) && loop)
|
||||
while (NS_SUCCEEDED(e->HasMoreElements(&loop)) && loop)
|
||||
{
|
||||
e->GetNext(getter_AddRefs(observer));
|
||||
|
||||
@ -166,7 +166,7 @@ nsMemoryImpl::RunFlushers(const char16_t* aReason)
|
||||
}
|
||||
}
|
||||
|
||||
sIsFlushing = 0;
|
||||
sIsFlushing = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ nsMemoryImpl::FlushEvent::Run()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mozilla::Atomic<int32_t>
|
||||
mozilla::Atomic<bool>
|
||||
nsMemoryImpl::sIsFlushing;
|
||||
|
||||
PRIntervalTime
|
||||
|
@ -38,7 +38,7 @@ protected:
|
||||
const char16_t* mReason;
|
||||
};
|
||||
|
||||
static mozilla::Atomic<int32_t> sIsFlushing;
|
||||
static mozilla::Atomic<bool> sIsFlushing;
|
||||
static FlushEvent sFlushEvent;
|
||||
static PRIntervalTime sLastFlushTime;
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ using namespace mozilla;
|
||||
NS_IMPL_ISUPPORTS2(TimerThread, nsIRunnable, nsIObserver)
|
||||
|
||||
TimerThread::TimerThread() :
|
||||
mInitInProgress(0),
|
||||
mInitInProgress(false),
|
||||
mInitialized(false),
|
||||
mMonitor("TimerThread.mMonitor"),
|
||||
mShutdown(false),
|
||||
@ -84,7 +84,7 @@ nsresult TimerThread::Init()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mInitInProgress.exchange(1) == 0) {
|
||||
if (mInitInProgress.exchange(true) == false) {
|
||||
// We hold on to mThread to keep the thread alive.
|
||||
nsresult rv = NS_NewThread(getter_AddRefs(mThread), this);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -244,7 +244,7 @@ NS_IMETHODIMP TimerThread::Run()
|
||||
if (NS_FAILED(timer->PostTimerEvent())) {
|
||||
nsrefcnt rc;
|
||||
NS_RELEASE2(timer, rc);
|
||||
|
||||
|
||||
// The nsITimer interface requires that its users keep a reference
|
||||
// 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
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIRUNNABLE
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
|
||||
NS_HIDDEN_(nsresult) Init();
|
||||
NS_HIDDEN_(nsresult) Shutdown();
|
||||
|
||||
@ -56,7 +56,7 @@ public:
|
||||
private:
|
||||
~TimerThread();
|
||||
|
||||
mozilla::Atomic<int32_t> mInitInProgress;
|
||||
mozilla::Atomic<bool> mInitInProgress;
|
||||
bool mInitialized;
|
||||
|
||||
// These two internal helper methods must be called while mLock is held.
|
||||
@ -72,7 +72,7 @@ private:
|
||||
bool mShutdown;
|
||||
bool mWaiting;
|
||||
bool mSleeping;
|
||||
|
||||
|
||||
nsTArray<nsTimerImpl*> mTimers;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user