Skip to content

Commit 4e1448e

Browse files
author
Mihai Alexandru Michis
committed
Backed out 2 changesets (bug 1510226) for causing xpcshell crashes and xpcshell failures in test_TelemetrySession.js CLOSED TREE
Backed out changeset cb739de6606d (bug 1510226) Backed out changeset b6f670610dc3 (bug 1510226)
1 parent 5cce421 commit 4e1448e

17 files changed

+176
-54
lines changed

dom/canvas/ImageBitmap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,11 +1083,11 @@ class CreateImageBitmapFromBlob final : public CancelableRunnable,
10831083
mCropRect(aCropRect),
10841084
mOriginalCropRect(aCropRect),
10851085
mMainThreadEventTarget(aMainThreadEventTarget),
1086-
mThread(PR_GetCurrentThread()) {}
1086+
mThread(GetCurrentVirtualThread()) {}
10871087

10881088
virtual ~CreateImageBitmapFromBlob() {}
10891089

1090-
bool IsCurrentThread() const { return mThread == PR_GetCurrentThread(); }
1090+
bool IsCurrentThread() const { return mThread == GetCurrentVirtualThread(); }
10911091

10921092
// Called on the owning thread.
10931093
nsresult StartMimeTypeAndDecodeAndCropBlob();

dom/indexedDB/ActorsParent.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5147,7 +5147,7 @@ struct ConnectionPool::DatabaseInfo final {
51475147

51485148
void AssertIsOnConnectionThread() const {
51495149
MOZ_ASSERT(mDEBUGConnectionThread);
5150-
MOZ_ASSERT(PR_GetCurrentThread() == mDEBUGConnectionThread);
5150+
MOZ_ASSERT(GetCurrentPhysicalThread() == mDEBUGConnectionThread);
51515151
}
51525152

51535153
uint64_t TotalTransactionCount() const {
@@ -10904,7 +10904,7 @@ nsresult ConnectionPool::GetOrCreateConnection(
1090410904
NS_ConvertUTF16toUTF8(aDatabase->FilePath()).get()));
1090510905

1090610906
#ifdef DEBUG
10907-
dbInfo->mDEBUGConnectionThread = PR_GetCurrentThread();
10907+
dbInfo->mDEBUGConnectionThread = GetCurrentPhysicalThread();
1090810908
#endif
1090910909
}
1091010910

dom/media/MediaManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4072,7 +4072,7 @@ void SourceListener::Activate(RefPtr<MediaDevice> aAudioDevice,
40724072
MOZ_ASSERT(!mStopped, "Cannot activate stopped source listener");
40734073
MOZ_ASSERT(!Activated(), "Already activated");
40744074

4075-
mMainThreadCheck = PR_GetCurrentThread();
4075+
mMainThreadCheck = GetCurrentVirtualThread();
40764076
if (aAudioDevice) {
40774077
bool offWhileDisabled =
40784078
aAudioDevice->GetMediaSource() == MediaSourceEnum::Microphone &&

ipc/glue/MessageChannel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ bool MessageChannel::Open(Transport* aTransport, MessageLoop* aIOLoop,
829829

830830
mMonitor = new RefCountedMonitor();
831831
mWorkerLoop = MessageLoop::current();
832-
mWorkerThread = PR_GetCurrentThread();
832+
mWorkerThread = GetCurrentVirtualThread();
833833
mWorkerLoop->AddDestructionObserver(this);
834834
mListener->OnIPCChannelOpened();
835835

@@ -910,7 +910,7 @@ void MessageChannel::OnOpenAsSlave(MessageChannel* aTargetChan, Side aSide) {
910910
void MessageChannel::CommonThreadOpenInit(MessageChannel* aTargetChan,
911911
Side aSide) {
912912
mWorkerLoop = MessageLoop::current();
913-
mWorkerThread = PR_GetCurrentThread();
913+
mWorkerThread = GetCurrentVirtualThread();
914914
mWorkerLoop->AddDestructionObserver(this);
915915
mListener->OnIPCChannelOpened();
916916

ipc/glue/MessageChannel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver {
544544
// Can be run on either thread
545545
void AssertWorkerThread() const {
546546
MOZ_ASSERT(mWorkerThread, "Channel hasn't been opened yet");
547-
MOZ_RELEASE_ASSERT(mWorkerThread == PR_GetCurrentThread(),
547+
MOZ_RELEASE_ASSERT(mWorkerThread == GetCurrentVirtualThread(),
548548
"not on worker thread!");
549549
}
550550

@@ -562,7 +562,7 @@ class MessageChannel : HasResultCodes, MessageLoop::DestructionObserver {
562562
// If we aren't a same-thread channel, our "link" thread is _not_ our
563563
// worker thread!
564564
MOZ_ASSERT(mWorkerThread, "Channel hasn't been opened yet");
565-
MOZ_RELEASE_ASSERT(mWorkerThread != PR_GetCurrentThread(),
565+
MOZ_RELEASE_ASSERT(mWorkerThread != GetCurrentVirtualThread(),
566566
"on worker thread but should not be!");
567567
}
568568

tools/fuzzing/ipc/ProtocolFuzzer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ mozilla::dom::ContentParent* ProtocolFuzzerHelper::CreateContentParent(
2424
mozilla::dom::ContentParent* aOpener, const nsAString& aRemoteType) {
2525
auto* cp = new mozilla::dom::ContentParent(aOpener, aRemoteType);
2626
// TODO: this duplicates MessageChannel::Open
27-
cp->GetIPCChannel()->mWorkerThread = PR_GetCurrentThread();
27+
cp->GetIPCChannel()->mWorkerThread = GetCurrentVirtualThread();
2828
cp->GetIPCChannel()->mMonitor = new RefCountedMonitor();
2929
return cp;
3030
}

xpcom/base/nsISupportsImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ nsresult NS_FASTCALL NS_TableDrivenQI(void* aThis, REFNSIID aIID,
3232
}
3333

3434
#ifdef MOZ_THREAD_SAFETY_OWNERSHIP_CHECKS_SUPPORTED
35-
nsAutoOwningThread::nsAutoOwningThread() : mThread(PR_GetCurrentThread()) {}
35+
nsAutoOwningThread::nsAutoOwningThread() : mThread(GetCurrentVirtualThread()) {}
3636

3737
void nsAutoOwningThread::AssertCurrentThreadOwnsMe(const char* msg) const {
3838
if (MOZ_UNLIKELY(!IsCurrentThread())) {
@@ -42,6 +42,6 @@ void nsAutoOwningThread::AssertCurrentThreadOwnsMe(const char* msg) const {
4242
}
4343

4444
bool nsAutoOwningThread::IsCurrentThread() const {
45-
return mThread == PR_GetCurrentThread();
45+
return mThread == GetCurrentVirtualThread();
4646
}
4747
#endif

xpcom/threads/TaskQueue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ bool TaskQueue::IsEmpty() {
164164
}
165165

166166
bool TaskQueue::IsCurrentThreadIn() const {
167-
bool in = mRunningThread == PR_GetCurrentThread();
167+
bool in = mRunningThread == GetCurrentPhysicalThread();
168168
return in;
169169
}
170170

xpcom/threads/TaskQueue.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ class TaskQueue : public AbstractThread {
156156
sCurrentThreadTLS.set(aQueue);
157157

158158
MOZ_ASSERT(mQueue->mRunningThread == nullptr);
159-
mQueue->mRunningThread = PR_GetCurrentThread();
159+
mQueue->mRunningThread = GetCurrentPhysicalThread();
160160
}
161161

162162
~AutoTaskGuard() {
163163
DrainDirectTasks();
164164

165-
MOZ_ASSERT(mQueue->mRunningThread == PR_GetCurrentThread());
165+
MOZ_ASSERT(mQueue->mRunningThread == GetCurrentPhysicalThread());
166166
mQueue->mRunningThread = nullptr;
167167

168168
sCurrentThreadTLS.set(mLastCurrentThread);

xpcom/threads/ThreadEventTarget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ NS_IMPL_ISUPPORTS_INHERITED(DelayedRunnable, Runnable, nsITimerCallback)
8989
ThreadEventTarget::ThreadEventTarget(ThreadTargetSink* aSink,
9090
bool aIsMainThread)
9191
: mSink(aSink), mIsMainThread(aIsMainThread) {
92-
mThread = PR_GetCurrentThread();
92+
mVirtualThread = GetCurrentVirtualThread();
9393
}
9494

95-
void ThreadEventTarget::SetCurrentThread(PRThread* aThread) {
96-
mThread = aThread;
95+
void ThreadEventTarget::SetCurrentThread() {
96+
mVirtualThread = GetCurrentVirtualThread();
9797
}
9898

9999
NS_IMPL_ISUPPORTS(ThreadEventTarget, nsIEventTarget, nsISerialEventTarget)
@@ -185,6 +185,6 @@ ThreadEventTarget::IsOnCurrentThread(bool* aIsOnCurrentThread) {
185185

186186
NS_IMETHODIMP_(bool)
187187
ThreadEventTarget::IsOnCurrentThreadInfallible() {
188-
// Rely on mThread being correct.
188+
// Rely on mVirtualThread being correct.
189189
MOZ_CRASH("IsOnCurrentThreadInfallible should never be called on nsIThread");
190190
}

0 commit comments

Comments
 (0)