diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp index 27668a34a302..7d650d83fdd0 100644 --- a/xpcom/base/nsMemoryImpl.cpp +++ b/xpcom/base/nsMemoryImpl.cpp @@ -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 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 +mozilla::Atomic nsMemoryImpl::sIsFlushing; PRIntervalTime diff --git a/xpcom/base/nsMemoryImpl.h b/xpcom/base/nsMemoryImpl.h index 2d04c1bdc8b6..eba170afa2e8 100644 --- a/xpcom/base/nsMemoryImpl.h +++ b/xpcom/base/nsMemoryImpl.h @@ -38,7 +38,7 @@ protected: const char16_t* mReason; }; - static mozilla::Atomic sIsFlushing; + static mozilla::Atomic sIsFlushing; static FlushEvent sFlushEvent; static PRIntervalTime sLastFlushTime; }; diff --git a/xpcom/threads/TimerThread.cpp b/xpcom/threads/TimerThread.cpp index e0934423a77b..0303283076cb 100644 --- a/xpcom/threads/TimerThread.cpp +++ b/xpcom/threads/TimerThread.cpp @@ -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 diff --git a/xpcom/threads/TimerThread.h b/xpcom/threads/TimerThread.h index 81d4f6cd9cac..3e76bfc77887 100644 --- a/xpcom/threads/TimerThread.h +++ b/xpcom/threads/TimerThread.h @@ -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 mInitInProgress; + mozilla::Atomic 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 mTimers; };