From 151a0ccd4ecb3ba0aa91439a88dba60956faea3f Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 7 May 2020 05:02:21 +0000 Subject: [PATCH] Bug 1634253 - P1. Fix constness. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D73819 --- dom/workers/WorkerThread.cpp | 3 ++- dom/workers/WorkerThread.h | 2 +- xpcom/threads/nsThread.cpp | 4 ++-- xpcom/threads/nsThread.h | 12 ++++++------ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dom/workers/WorkerThread.cpp b/dom/workers/WorkerThread.cpp index 64a16f480900..b3bcba97498c 100644 --- a/dom/workers/WorkerThread.cpp +++ b/dom/workers/WorkerThread.cpp @@ -322,7 +322,8 @@ uint32_t WorkerThread::RecursionDepth( return mNestedEventLoopDepth; } -PerformanceCounter* WorkerThread::GetPerformanceCounter(nsIRunnable* aEvent) { +PerformanceCounter* WorkerThread::GetPerformanceCounter( + nsIRunnable* aEvent) const { if (mWorkerPrivate) { return mWorkerPrivate->GetPerformanceCounter(); } diff --git a/dom/workers/WorkerThread.h b/dom/workers/WorkerThread.h index 8b09001e61d8..a643a187fc2c 100644 --- a/dom/workers/WorkerThread.h +++ b/dom/workers/WorkerThread.h @@ -75,7 +75,7 @@ class WorkerThread final : public nsThread { uint32_t RecursionDepth(const WorkerThreadFriendKey& aKey) const; - PerformanceCounter* GetPerformanceCounter(nsIRunnable* aEvent) override; + PerformanceCounter* GetPerformanceCounter(nsIRunnable* aEvent) const override; NS_INLINE_DECL_REFCOUNTING_INHERITED(WorkerThread, nsThread) diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index a6c42366ddf5..ed57d8d74a0e 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -1005,7 +1005,7 @@ static bool GetLabeledRunnableName(nsIRunnable* aEvent, nsACString& aName, #endif mozilla::PerformanceCounter* nsThread::GetPerformanceCounter( - nsIRunnable* aEvent) { + nsIRunnable* aEvent) const { RefPtr docRunnable = do_QueryObject(aEvent); if (docRunnable) { mozilla::dom::DocGroup* docGroup = docRunnable->DocGroup(); @@ -1352,7 +1352,7 @@ void nsThread::SetScriptObserver( mScriptObserver = aScriptObserver; } -void nsThread::DoMainThreadSpecificProcessing(bool aReallyWait) { +void nsThread::DoMainThreadSpecificProcessing(bool aReallyWait) const { MOZ_ASSERT(mIsMainThread); ipc::CancelCPOWs(); diff --git a/xpcom/threads/nsThread.h b/xpcom/threads/nsThread.h index 37decfbad608..fcde82df2402 100644 --- a/xpcom/threads/nsThread.h +++ b/xpcom/threads/nsThread.h @@ -124,7 +124,7 @@ class PerformanceCounterState { bool mCurrentRunnableIsIdleRunnable = false; // Whether we're attached to the mainthread nsThread. - bool mIsMainThread; + const bool mIsMainThread; // The timestamp from which time to be accounted for should be measured. This // can be the start of a runnable running or the end of a nested runnable @@ -179,7 +179,7 @@ class nsThread : public nsIThreadInternal, public: // The PRThread corresponding to this thread. - PRThread* GetPRThread() { return mThread; } + PRThread* GetPRThread() const { return mThread; } const void* StackBase() const { return mStackBase; } size_t StackSize() const { return mStackSize; } @@ -225,10 +225,10 @@ class nsThread : public nsIThreadInternal, mozilla::SynchronizedEventQueue* EventQueue() { return mEvents.get(); } - bool ShuttingDown() { return mShutdownContext != nullptr; } + bool ShuttingDown() const { return mShutdownContext != nullptr; } virtual mozilla::PerformanceCounter* GetPerformanceCounter( - nsIRunnable* aEvent); + nsIRunnable* aEvent) const; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; @@ -258,7 +258,7 @@ class nsThread : public nsIThreadInternal, nsLocalExecutionRecord EnterLocalExecution(); private: - void DoMainThreadSpecificProcessing(bool aReallyWait); + void DoMainThreadSpecificProcessing(bool aReallyWait) const; protected: friend class nsThreadShutdownEvent; @@ -328,7 +328,7 @@ class nsThread : public nsIThreadInternal, int8_t mPriority; - bool mIsMainThread; + const bool mIsMainThread; mozilla::Atomic* mIsAPoolThreadFree; // Set to true if this thread creates a JSRuntime.