Skip to content

Commit 43db180

Browse files
author
Cristian Tuns
committed
Backed out changeset 3b8c7fa73e82 (bug 1207753) for causing build bustages on Monitor.h CLOSED TREE
1 parent a792cc6 commit 43db180

File tree

16 files changed

+151
-666
lines changed

16 files changed

+151
-666
lines changed

mfbt/Maybe.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "mozilla/MemoryChecking.h"
2222
#include "mozilla/OperatorNewExtensions.h"
2323
#include "mozilla/Poison.h"
24-
#include "mozilla/ThreadSafety.h"
2524

2625
class nsCycleCollectionTraversalCallback;
2726

@@ -637,13 +636,7 @@ class MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS Maybe
637636
constexpr void reset() {
638637
if (isSome()) {
639638
if constexpr (!std::is_trivially_destructible_v<T>) {
640-
/*
641-
* Static analyzer gets confused if we have Maybe<MutexAutoLock>,
642-
* so we suppress thread-safety warnings here
643-
*/
644-
PUSH_IGNORE_THREAD_SAFETY
645639
ref().T::~T();
646-
POP_THREAD_SAFETY
647640
poisonData();
648641
}
649642
mIsSome = false;

mfbt/ThreadSafety.h

Lines changed: 0 additions & 135 deletions
This file was deleted.

mfbt/moz.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ EXPORTS.mozilla = [
108108
"TemplateLib.h",
109109
"TextUtils.h",
110110
"ThreadLocal.h",
111-
"ThreadSafety.h",
112111
"ThreadSafeWeakPtr.h",
113112
"ToString.h",
114113
"Tuple.h",

mozglue/baseprofiler/public/BaseProfilerDetail.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define BaseProfilerDetail_h
1111

1212
#include "mozilla/Atomics.h"
13-
#include "mozilla/Attributes.h"
1413
#include "mozilla/Maybe.h"
1514
#include "mozilla/PlatformMutex.h"
1615
#include "mozilla/PlatformRWLock.h"

xpcom/base/StaticMonitor.h

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
#include "mozilla/Atomics.h"
1111
#include "mozilla/CondVar.h"
12-
#include "mozilla/ThreadSafety.h"
1312

1413
namespace mozilla {
1514

16-
class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS CAPABILITY StaticMonitor {
15+
class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS StaticMonitor {
1716
public:
1817
// In debug builds, check that mMutex is initialized for us as we expect by
1918
// the compiler. In non-debug builds, don't declare a constructor so that
@@ -22,20 +21,17 @@ class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS CAPABILITY StaticMonitor {
2221
StaticMonitor() { MOZ_ASSERT(!mMutex); }
2322
#endif
2423

25-
void Lock() CAPABILITY_ACQUIRE() { Mutex()->Lock(); }
24+
void Lock() { Mutex()->Lock(); }
2625

27-
void Unlock() CAPABILITY_RELEASE() { Mutex()->Unlock(); }
26+
void Unlock() { Mutex()->Unlock(); }
2827

2928
void Wait() { CondVar()->Wait(); }
30-
CVStatus Wait(TimeDuration aDuration) {
31-
AssertCurrentThreadOwns();
32-
return CondVar()->Wait(aDuration);
33-
}
29+
CVStatus Wait(TimeDuration aDuration) { return CondVar()->Wait(aDuration); }
3430

3531
void Notify() { CondVar()->Notify(); }
3632
void NotifyAll() { CondVar()->NotifyAll(); }
3733

38-
void AssertCurrentThreadOwns() ASSERT_CAPABILITY(this) {
34+
void AssertCurrentThreadOwns() {
3935
#ifdef DEBUG
4036
Mutex()->AssertCurrentThreadOwns();
4137
#endif
@@ -86,14 +82,14 @@ class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS CAPABILITY StaticMonitor {
8682
static void operator delete(void*);
8783
};
8884

89-
class MOZ_STACK_CLASS SCOPED_CAPABILITY StaticMonitorAutoLock {
85+
class MOZ_STACK_CLASS StaticMonitorAutoLock {
9086
public:
91-
explicit StaticMonitorAutoLock(StaticMonitor& aMonitor) CAPABILITY_ACQUIRE(aMonitor)
87+
explicit StaticMonitorAutoLock(StaticMonitor& aMonitor)
9288
: mMonitor(&aMonitor) {
9389
mMonitor->Lock();
9490
}
9591

96-
~StaticMonitorAutoLock() CAPABILITY_RELEASE() { mMonitor->Unlock(); }
92+
~StaticMonitorAutoLock() { mMonitor->Unlock(); }
9793

9894
void Wait() { mMonitor->Wait(); }
9995
CVStatus Wait(TimeDuration aDuration) { return mMonitor->Wait(aDuration); }

xpcom/base/StaticMutex.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace mozilla {
2626
* initialized to 0 in order to initialize mMutex. It is only safe to use
2727
* StaticMutex as a global or static variable.
2828
*/
29-
class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS CAPABILITY StaticMutex {
29+
class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS StaticMutex {
3030
public:
3131
// In debug builds, check that mMutex is initialized for us as we expect by
3232
// the compiler. In non-debug builds, don't declare a constructor so that
@@ -35,11 +35,11 @@ class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS CAPABILITY StaticMutex {
3535
StaticMutex() { MOZ_ASSERT(!mMutex); }
3636
#endif
3737

38-
void Lock() CAPABILITY_ACQUIRE() { Mutex()->Lock(); }
38+
void Lock() { Mutex()->Lock(); }
3939

40-
void Unlock() CAPABILITY_RELEASE() { Mutex()->Unlock(); }
40+
void Unlock() { Mutex()->Unlock(); }
4141

42-
void AssertCurrentThreadOwns() ASSERT_CAPABILITY(this) {
42+
void AssertCurrentThreadOwns() {
4343
#ifdef DEBUG
4444
Mutex()->AssertCurrentThreadOwns();
4545
#endif

xpcom/tests/gtest/TestDeadlockDetector.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void DisableCrashReporter() {
7171
// Single-threaded sanity tests
7272

7373
// Stupidest possible deadlock.
74-
static int Sanity_Child() NO_THREAD_SAFETY_ANALYSIS {
74+
static int Sanity_Child() {
7575
DisableCrashReporter();
7676

7777
MUTEX m1("dd.sanity.m1");
@@ -92,7 +92,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(SanityDeathTest)) {
9292
}
9393

9494
// Slightly less stupid deadlock.
95-
static int Sanity2_Child() NO_THREAD_SAFETY_ANALYSIS {
95+
static int Sanity2_Child() {
9696
DisableCrashReporter();
9797

9898
MUTEX m1("dd.sanity2.m1");
@@ -118,7 +118,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity2DeathTest)) {
118118
#if 0
119119
// Temporarily disabled, see bug 1370644.
120120
int
121-
Sanity3_Child() NO_THREAD_SAFETY_ANALYSIS
121+
Sanity3_Child()
122122
{
123123
DisableCrashReporter();
124124

@@ -156,7 +156,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity3DeathTest))
156156
}
157157
#endif
158158

159-
static int Sanity4_Child() NO_THREAD_SAFETY_ANALYSIS {
159+
static int Sanity4_Child() {
160160
DisableCrashReporter();
161161

162162
mozilla::ReentrantMonitor m1 MOZ_UNANNOTATED("dd.sanity4.m1");
@@ -179,7 +179,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity4DeathTest)) {
179179
ASSERT_DEATH_IF_SUPPORTED(Sanity4_Child(), regex);
180180
}
181181

182-
static int Sanity5_Child() NO_THREAD_SAFETY_ANALYSIS {
182+
static int Sanity5_Child() {
183183
DisableCrashReporter();
184184

185185
mozilla::RecursiveMutex m1 MOZ_UNANNOTATED("dd.sanity4.m1");
@@ -225,7 +225,7 @@ struct ThreadState {
225225
#if 0
226226
// Temporarily disabled, see bug 1370644.
227227
static void
228-
TwoThreads_thread(void* arg) NO_THREAD_SAFETY_ANALYSIS
228+
TwoThreads_thread(void* arg)
229229
{
230230
ThreadState* state = static_cast<ThreadState*>(arg);
231231

@@ -247,7 +247,7 @@ TwoThreads_thread(void* arg) NO_THREAD_SAFETY_ANALYSIS
247247
}
248248

249249
int
250-
TwoThreads_Child() NO_THREAD_SAFETY_ANALYSIS
250+
TwoThreads_Child()
251251
{
252252
DisableCrashReporter();
253253

@@ -284,7 +284,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(TwoThreadsDeathTest))
284284
}
285285
#endif
286286

287-
static void ContentionNoDeadlock_thread(void* arg) NO_THREAD_SAFETY_ANALYSIS {
287+
static void ContentionNoDeadlock_thread(void* arg) {
288288
const uint32_t K = 100000;
289289

290290
ThreadState* state = static_cast<ThreadState*>(arg);
@@ -300,7 +300,7 @@ static void ContentionNoDeadlock_thread(void* arg) NO_THREAD_SAFETY_ANALYSIS {
300300
}
301301
}
302302

303-
static int ContentionNoDeadlock_Child() NO_THREAD_SAFETY_ANALYSIS {
303+
static int ContentionNoDeadlock_Child() {
304304
const size_t kMutexCount = 4;
305305

306306
PRThread* threads[3];

xpcom/tests/gtest/TestRecursiveMutex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using mozilla::RecursiveMutexAutoLock;
1515
// well, actually recursively acquirable.
1616

1717
TEST(RecursiveMutex, SmokeTest)
18-
NO_THREAD_SAFETY_ANALYSIS {
18+
{
1919
RecursiveMutex mutex("testing mutex");
2020

2121
RecursiveMutexAutoLock lock1(mutex);

xpcom/tests/gtest/TestSynchronization.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static PRThread* spawn(void (*run)(void*), void* arg) {
2121
// Sanity check: tests that can be done on a single thread
2222
//
2323
TEST(Synchronization, Sanity)
24-
NO_THREAD_SAFETY_ANALYSIS {
24+
{
2525
Mutex lock("sanity::lock");
2626
lock.Lock();
2727
lock.AssertCurrentThreadOwns();
@@ -112,7 +112,7 @@ TEST(Synchronization, MonitorContention)
112112

113113
static ReentrantMonitor* gMon2;
114114

115-
static void MonitorContention2_thread(void* /*arg*/) NO_THREAD_SAFETY_ANALYSIS {
115+
static void MonitorContention2_thread(void* /*arg*/) {
116116
for (int i = 0; i < 100000; ++i) {
117117
gMon2->Enter();
118118
gMon2->AssertCurrentThreadIn();
@@ -144,7 +144,7 @@ TEST(Synchronization, MonitorContention2)
144144
static ReentrantMonitor* gMon3;
145145
static int32_t gMonFirst;
146146

147-
static void MonitorSyncSanity_thread(void* /*arg*/) NO_THREAD_SAFETY_ANALYSIS {
147+
static void MonitorSyncSanity_thread(void* /*arg*/) {
148148
gMon3->Enter();
149149
gMon3->AssertCurrentThreadIn();
150150
if (gMonFirst) {
@@ -294,7 +294,7 @@ TEST(Synchronization, AutoUnlock)
294294
// AutoMonitor tests
295295
//
296296
TEST(Synchronization, AutoMonitor)
297-
NO_THREAD_SAFETY_ANALYSIS {
297+
{
298298
ReentrantMonitor m1("automonitor");
299299
ReentrantMonitor m2("automonitor2");
300300

xpcom/threads/BlockingResourceBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ void RecursiveMutex::Unlock() {
502502
UnlockInternal();
503503
}
504504

505-
void RecursiveMutex::AssertCurrentThreadIn() const {
505+
void RecursiveMutex::AssertCurrentThreadIn() {
506506
MOZ_ASSERT(IsAcquired() && mOwningThread == PR_GetCurrentThread());
507507
}
508508

0 commit comments

Comments
 (0)