- Revision
- 290361
- Author
- [email protected]
- Date
- 2022-02-23 01:59:12 -0800 (Wed, 23 Feb 2022)
Log Message
Thread safety analysis macros are confusing for non-Lock use-cases
https://bugs.webkit.org/show_bug.cgi?id=237022
Patch by Kimmo Kinnunen <[email protected]> on 2022-02-23
Reviewed by Chris Dumez.
Source/WebKit:
Use WTF_GUARDED_BY_CAPABILITY instead of WTF_GUARDED_BY_LOCK
for non-lock use-cases.
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/WebGPU/RemoteGPU.h:
* GPUProcess/media/RemoteVideoFrameObjectHeap.h:
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h:
Source/WTF:
Thread safety analysis proves that a capability is acquired or not acquired.
Change the semantics of thread safety analysis application in WebKit:
Before, we had only one capability, "lock".
After, we have arbitrary amount of capabilities, one of which is "lock".
Add thread safety analysis macros to support non-Lock use-cases better.
Non-lock use-case:
Before:
class WTF_CAPABILITY_LOCK ThreadAssertion { ... };
"WTF::ThreadAssertion is obviously not a lock but we use the lock capability machinery to obtain the analysis support.
It behaves like the lock capability and can be acquired."
After:
class WTF_CAPABILITY("is current") ThreadAssertion { ... };
"WTF::ThreadAssertion has a capability called 'is current' that can be acquired."
The documentation string "lock", "is current" will appear in the compile error messages to clarify the
violations.
* wtf/ThreadAssertions.h:
(WTF::WTF_ASSERTS_ACQUIRED_CAPABILITY):
* wtf/ThreadSafetyAnalysis.h:
Tools:
* Scripts/webkitpy/style/checkers/cpp.py:
(check_identifier_name_in_declaration):
* TestWebKitAPI/Tests/WTF/ThreadAssertionsTest.cpp:
(TestWebKitAPI::WTF_REQUIRES_CAPABILITY):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (290360 => 290361)
--- trunk/Source/WTF/ChangeLog 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Source/WTF/ChangeLog 2022-02-23 09:59:12 UTC (rev 290361)
@@ -1,3 +1,34 @@
+2022-02-23 Kimmo Kinnunen <[email protected]>
+
+ Thread safety analysis macros are confusing for non-Lock use-cases
+ https://bugs.webkit.org/show_bug.cgi?id=237022
+
+ Reviewed by Chris Dumez.
+
+ Thread safety analysis proves that a capability is acquired or not acquired.
+ Change the semantics of thread safety analysis application in WebKit:
+ Before, we had only one capability, "lock".
+ After, we have arbitrary amount of capabilities, one of which is "lock".
+
+ Add thread safety analysis macros to support non-Lock use-cases better.
+
+ Non-lock use-case:
+ Before:
+ class WTF_CAPABILITY_LOCK ThreadAssertion { ... };
+ "WTF::ThreadAssertion is obviously not a lock but we use the lock capability machinery to obtain the analysis support.
+ It behaves like the lock capability and can be acquired."
+
+ After:
+ class WTF_CAPABILITY("is current") ThreadAssertion { ... };
+ "WTF::ThreadAssertion has a capability called 'is current' that can be acquired."
+
+ The documentation string "lock", "is current" will appear in the compile error messages to clarify the
+ violations.
+
+ * wtf/ThreadAssertions.h:
+ (WTF::WTF_ASSERTS_ACQUIRED_CAPABILITY):
+ * wtf/ThreadSafetyAnalysis.h:
+
2022-02-22 Chris Dumez <[email protected]>
Add a URL constructor that takes a String
Modified: trunk/Source/WTF/wtf/ThreadAssertions.h (290360 => 290361)
--- trunk/Source/WTF/wtf/ThreadAssertions.h 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Source/WTF/wtf/ThreadAssertions.h 2022-02-23 09:59:12 UTC (rev 290361)
@@ -41,11 +41,11 @@
// void doTask() { assertIsCurrent(m_ownerThread); doTaskImpl(); }
// template<typename> void doTaskCompileFailure() { doTaskImpl(); }
// private:
-// void doTaskImpl() WTF_REQUIRES_LOCK(m_ownerThread);
-// int m_value WTF_GUARDED_BY_LOCK(m_ownerThread) { 0 };
+// void doTaskImpl() WTF_REQUIRES_CAPABILITY(m_ownerThread);
+// int m_value WTF_GUARDED_BY_CAPABILITY(m_ownerThread) { 0 };
// NO_UNIQUE_ADDRESS ThreadAssertion m_ownerThread;
// };
-class WTF_CAPABILITY_LOCK ThreadAssertion {
+class WTF_CAPABILITY("is current") ThreadAssertion {
public:
ThreadAssertion() = default;
enum UninitializedTag { Uninitialized };
@@ -64,7 +64,7 @@
friend void assertIsCurrent(const ThreadAssertion&);
};
-inline void assertIsCurrent(const ThreadAssertion& threadAssertion) WTF_ASSERTS_ACQUIRED_LOCK(threadAssertion)
+inline void assertIsCurrent(const ThreadAssertion& threadAssertion) WTF_ASSERTS_ACQUIRED_CAPABILITY(threadAssertion)
{
ASSERT_UNUSED(threadAssertion, Thread::current().uid() == threadAssertion.m_uid);
}
@@ -74,8 +74,8 @@
// a known named thread.
// Example:
// extern NamedAssertion& mainThread;
-// inline void assertIsMainThread() WTF_ASSERTS_ACQUIRED_LOCK(mainThread);
-// void myTask() WTF_REQUIRES_LOCK(mainThread) { printf("my task is running"); }
+// inline void assertIsMainThread() WTF_ASSERTS_ACQUIRED_CAPABILITY(mainThread);
+// void myTask() WTF_REQUIRES_CAPABILITY(mainThread) { printf("my task is running"); }
// void runner() {
// assertIsMainThread();
// myTask();
@@ -83,15 +83,15 @@
// template<typename> runnerCompileFailure() {
// myTask();
// }
-class WTF_CAPABILITY_LOCK NamedAssertion { };
+class WTF_CAPABILITY("is current") NamedAssertion { };
-// To be used with WTF_REQUIRES_LOCK(mainThread). Symbol is undefined.
+// To be used with WTF_REQUIRES_CAPABILITY(mainThread). Symbol is undefined.
extern NamedAssertion& mainThread;
-inline void assertIsMainThread() WTF_ASSERTS_ACQUIRED_LOCK(mainThread) { ASSERT(isMainThread()); }
+inline void assertIsMainThread() WTF_ASSERTS_ACQUIRED_CAPABILITY(mainThread) { ASSERT(isMainThread()); }
-// To be used with WTF_REQUIRES_LOCK(mainRunLoop). Symbol is undefined.
+// To be used with WTF_REQUIRES_CAPABILITY(mainRunLoop). Symbol is undefined.
extern NamedAssertion& mainRunLoop;
-inline void assertIsMainRunLoop() WTF_ASSERTS_ACQUIRED_LOCK(mainRunLoop) { ASSERT(isMainRunLoop()); }
+inline void assertIsMainRunLoop() WTF_ASSERTS_ACQUIRED_CAPABILITY(mainRunLoop) { ASSERT(isMainRunLoop()); }
}
Modified: trunk/Source/WTF/wtf/ThreadSafetyAnalysis.h (290360 => 290361)
--- trunk/Source/WTF/wtf/ThreadSafetyAnalysis.h 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Source/WTF/wtf/ThreadSafetyAnalysis.h 2022-02-23 09:59:12 UTC (rev 290361)
@@ -35,21 +35,39 @@
#define WTF_THREAD_ANNOTATION_ATTRIBUTE(x)
#endif
-#define WTF_ACQUIRES_LOCK_IF(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(try_acquire_capability(__VA_ARGS__))
-#define WTF_ACQUIRES_LOCK(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(acquire_capability(__VA_ARGS__))
-#define WTF_ACQUIRES_SHARED_LOCK_IF(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(try_acquire_shared_capability(__VA_ARGS__))
-#define WTF_ACQUIRES_SHARED_LOCK(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(acquire_shared_capability(__VA_ARGS__))
-#define WTF_ASSERTS_ACQUIRED_LOCK(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(assert_capability(x))
-#define WTF_ASSERTS_ACQUIRED_SHARED_LOCK(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(assert_shared_capability(x))
-#define WTF_CAPABILITY_LOCK WTF_THREAD_ANNOTATION_ATTRIBUTE(capability("mutex"))
+#define WTF_ACQUIRES_CAPABILITY_IF(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(try_acquire_capability(__VA_ARGS__))
+#define WTF_ACQUIRES_CAPABILITY(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(acquire_capability(__VA_ARGS__))
+#define WTF_ACQUIRES_SHARED_CAPABILITY_IF(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(try_acquire_shared_capability(__VA_ARGS__))
+#define WTF_ACQUIRES_SHARED_CAPABILITY(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(acquire_shared_capability(__VA_ARGS__))
+#define WTF_ASSERTS_ACQUIRED_CAPABILITY(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(assert_capability(x))
+#define WTF_ASSERTS_ACQUIRED_SHARED_CAPABILITY(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(assert_shared_capability(x))
+#define WTF_CAPABILITY(name) WTF_THREAD_ANNOTATION_ATTRIBUTE(capability(name))
#define WTF_CAPABILITY_SCOPED_LOCK WTF_THREAD_ANNOTATION_ATTRIBUTE(scoped_lockable)
-#define WTF_EXCLUDES_LOCK(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(locks_excluded(__VA_ARGS__))
-#define WTF_GUARDED_BY_LOCK(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(guarded_by(x))
+#define WTF_EXCLUDES_CAPABILITY(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(locks_excluded(__VA_ARGS__))
+#define WTF_GUARDED_BY_CAPABILITY(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(guarded_by(x))
#define WTF_IGNORES_THREAD_SAFETY_ANALYSIS WTF_THREAD_ANNOTATION_ATTRIBUTE(no_thread_safety_analysis)
-#define WTF_POINTEE_GUARDED_BY_LOCK(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(pt_guarded_by(x))
-#define WTF_RELEASES_LOCK_GENERIC(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(release_generic_capability(__VA_ARGS__))
-#define WTF_RELEASES_LOCK(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(release_capability(__VA_ARGS__))
-#define WTF_RELEASES_SHARED_LOCK(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(release_shared_capability(__VA_ARGS__))
-#define WTF_REQUIRES_LOCK(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(requires_capability(__VA_ARGS__))
-#define WTF_REQUIRES_SHARED_LOCK(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(requires_shared_capability(__VA_ARGS__))
-#define WTF_RETURNS_LOCK(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(lock_returned(x))
+#define WTF_POINTEE_GUARDED_BY_CAPABILITY(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(pt_guarded_by(x))
+#define WTF_RELEASES_GENERIC_CAPABILITY(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(release_generic_capability(__VA_ARGS__))
+#define WTF_RELEASES_CAPABILITY(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(release_capability(__VA_ARGS__))
+#define WTF_RELEASES_SHARED_CAPABILITY(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(release_shared_capability(__VA_ARGS__))
+#define WTF_REQUIRES_CAPABILITY(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(requires_capability(__VA_ARGS__))
+#define WTF_REQUIRES_SHARED_CAPABILITY(...) WTF_THREAD_ANNOTATION_ATTRIBUTE(requires_shared_capability(__VA_ARGS__))
+#define WTF_RETURNS_CAPABILITY(x) WTF_THREAD_ANNOTATION_ATTRIBUTE(lock_returned(x))
+
+// Using WTF_CAPABILITY_LOCK is a common use-case. Introduce terms containing "LOCK" for maximum readability.
+#define WTF_ACQUIRES_LOCK_IF(...) WTF_ACQUIRES_CAPABILITY_IF(__VA_ARGS__)
+#define WTF_ACQUIRES_LOCK(...) WTF_ACQUIRES_CAPABILITY(__VA_ARGS__)
+#define WTF_ACQUIRES_SHARED_LOCK_IF(...) WTF_ACQUIRES_SHARED_CAPABILITY_IF(__VA_ARGS__)
+#define WTF_ACQUIRES_SHARED_LOCK(...) WTF_ACQUIRES_SHARED_CAPABILITY(__VA_ARGS__)
+#define WTF_ASSERTS_ACQUIRED_LOCK(x) WTF_ASSERTS_ACQUIRED_CAPABILITY(x)
+#define WTF_ASSERTS_ACQUIRED_SHARED_LOCK(x) WTF_ASSERTS_ACQUIRED_SHARED_CAPABILITY(x)
+#define WTF_CAPABILITY_LOCK WTF_CAPABILITY("lock")
+#define WTF_EXCLUDES_LOCK(...) WTF_EXCLUDES_CAPABILITY(__VA_ARGS__)
+#define WTF_GUARDED_BY_LOCK(x) WTF_GUARDED_BY_CAPABILITY(x)
+#define WTF_POINTEE_GUARDED_BY_LOCK(x) WTF_POINTEE_GUARDED_BY_CAPABILITY(x)
+#define WTF_RELEASES_GENERIC_LOCK(...) WTF_RELEASES_GENERIC_CAPABILITY(__VA_ARGS__)
+#define WTF_RELEASES_LOCK(...) WTF_RELEASES_CAPABILITY(__VA_ARGS__)
+#define WTF_RELEASES_SHARED_LOCK(...) WTF_RELEASES_SHARED_CAPABILITY(__VA_ARGS__)
+#define WTF_REQUIRES_LOCK(...) WTF_REQUIRES_CAPABILITY(__VA_ARGS__)
+#define WTF_REQUIRES_SHARED_LOCK(...) WTF_REQUIRES_SHARED_CAPABILITY(__VA_ARGS__)
+#define WTF_RETURNS_LOCK(x) WTF_RETURNS_CAPABILITY(x)
Modified: trunk/Source/WebKit/ChangeLog (290360 => 290361)
--- trunk/Source/WebKit/ChangeLog 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Source/WebKit/ChangeLog 2022-02-23 09:59:12 UTC (rev 290361)
@@ -1,3 +1,19 @@
+2022-02-23 Kimmo Kinnunen <[email protected]>
+
+ Thread safety analysis macros are confusing for non-Lock use-cases
+ https://bugs.webkit.org/show_bug.cgi?id=237022
+
+ Reviewed by Chris Dumez.
+
+ Use WTF_GUARDED_BY_CAPABILITY instead of WTF_GUARDED_BY_LOCK
+ for non-lock use-cases.
+
+ * GPUProcess/graphics/RemoteGraphicsContextGL.h:
+ * GPUProcess/graphics/RemoteRenderingBackend.h:
+ * GPUProcess/graphics/WebGPU/RemoteGPU.h:
+ * GPUProcess/media/RemoteVideoFrameObjectHeap.h:
+ * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h:
+
2022-02-23 Pablo Saavedra <[email protected]>
[GTK][WPE] PlatformDisplay::terminateEglDisplays() is never called
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h (290360 => 290361)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h 2022-02-23 09:59:12 UTC (rev 290361)
@@ -140,7 +140,7 @@
using GCGLContext = WebCore::GraphicsContextGLTextureMapper;
#endif
- RefPtr<GCGLContext> m_context WTF_GUARDED_BY_LOCK(m_streamThread);
+ RefPtr<GCGLContext> m_context WTF_GUARDED_BY_CAPABILITY(m_streamThread);
GraphicsContextGLIdentifier m_graphicsContextGLIdentifier;
Ref<RemoteRenderingBackend> m_renderingBackend;
#if ENABLE(VIDEO)
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h (290360 => 290361)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h 2022-02-23 09:59:12 UTC (rev 290361)
@@ -144,7 +144,7 @@
Lock m_remoteDisplayListsLock;
bool m_canRegisterRemoteDisplayLists WTF_GUARDED_BY_LOCK(m_remoteDisplayListsLock) { false };
- HashMap<QualifiedRenderingResourceIdentifier, Ref<RemoteDisplayListRecorder>> m_remoteDisplayLists WTF_GUARDED_BY_LOCK(m_remoteDisplayListsLock);
+ HashMap<QualifiedRenderingResourceIdentifier, Ref<RemoteDisplayListRecorder>> m_remoteDisplayLists WTF_GUARDED_BY_CAPABILITY(m_remoteDisplayListsLock);
};
} // namespace WebKit
Modified: trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h (290360 => 290361)
--- trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h 2022-02-23 09:59:12 UTC (rev 290361)
@@ -138,8 +138,8 @@
WeakPtr<GPUConnectionToWebProcess> m_gpuConnectionToWebProcess;
Ref<IPC::StreamConnectionWorkQueue> m_workQueue;
RefPtr<IPC::StreamServerConnection> m_streamConnection;
- RefPtr<PAL::WebGPU::GPU> m_backing WTF_GUARDED_BY_LOCK(m_streamThread);
- Ref<WebGPU::ObjectHeap> m_objectHeap WTF_GUARDED_BY_LOCK(m_streamThread);
+ RefPtr<PAL::WebGPU::GPU> m_backing WTF_GUARDED_BY_CAPABILITY(m_streamThread);
+ Ref<WebGPU::ObjectHeap> m_objectHeap WTF_GUARDED_BY_CAPABILITY(m_streamThread);
const WebGPUIdentifier m_identifier;
Ref<RemoteRenderingBackend> m_renderingBackend;
NO_UNIQUE_ADDRESS ThreadAssertion m_streamThread;
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.h (290360 => 290361)
--- trunk/Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.h 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.h 2022-02-23 09:59:12 UTC (rev 290361)
@@ -64,7 +64,7 @@
void getVideoFrameBuffer(RemoteVideoFrameReadReference&&);
#endif
- GPUConnectionToWebProcess* m_gpuConnectionToWebProcess WTF_GUARDED_BY_LOCK(m_consumeThread);
+ GPUConnectionToWebProcess* m_gpuConnectionToWebProcess WTF_GUARDED_BY_CAPABILITY(m_consumeThread);
const Ref<IPC::Connection> m_connection;
ThreadAssertion m_consumeThread NO_UNIQUE_ADDRESS;
#if PLATFORM(COCOA)
Modified: trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h (290360 => 290361)
--- trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h 2022-02-23 09:59:12 UTC (rev 290361)
@@ -88,7 +88,7 @@
// WebCore::SampleBufferDisplayLayer::Client
void sampleBufferDisplayLayerStatusDidFail() final;
- GPUConnectionToWebProcess& m_gpuConnection WTF_GUARDED_BY_LOCK(m_consumeThread);
+ GPUConnectionToWebProcess& m_gpuConnection WTF_GUARDED_BY_CAPABILITY(m_consumeThread);
SampleBufferDisplayLayerIdentifier m_identifier;
Ref<IPC::Connection> m_connection;
std::unique_ptr<WebCore::ImageTransferSessionVT> m_imageTransferSession;
Modified: trunk/Tools/ChangeLog (290360 => 290361)
--- trunk/Tools/ChangeLog 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Tools/ChangeLog 2022-02-23 09:59:12 UTC (rev 290361)
@@ -1,3 +1,15 @@
+2022-02-23 Kimmo Kinnunen <[email protected]>
+
+ Thread safety analysis macros are confusing for non-Lock use-cases
+ https://bugs.webkit.org/show_bug.cgi?id=237022
+
+ Reviewed by Chris Dumez.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_identifier_name_in_declaration):
+ * TestWebKitAPI/Tests/WTF/ThreadAssertionsTest.cpp:
+ (TestWebKitAPI::WTF_REQUIRES_CAPABILITY):
+
2022-02-23 Youenn Fablet <[email protected]>
Enable WebRTCRemoteVideoFrameEnabled by default in WebKitTestRunner
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (290360 => 290361)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2022-02-23 09:59:12 UTC (rev 290361)
@@ -4163,6 +4163,7 @@
and not modified_identifier == "DFG_OPERATION"
and not modified_identifier == "LOG_CHANNEL"
and not modified_identifier == "WTF_GUARDED_BY_LOCK"
+ and not modified_identifier == "WTF_GUARDED_BY_CAPABILITY"
and not modified_identifier.find('chrono_literals') >= 0):
error(line_number, 'readability/naming/underscores', 4, identifier + " is incorrectly named. Don't use underscores in your identifier names.")
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadAssertionsTest.cpp (290360 => 290361)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadAssertionsTest.cpp 2022-02-23 09:32:13 UTC (rev 290360)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/ThreadAssertionsTest.cpp 2022-02-23 09:59:12 UTC (rev 290361)
@@ -46,8 +46,8 @@
template<typename T> int doTaskCompileFailure(T n) { return doTaskImpl(n); }
template<typename T> void accessVariableCompileFailure(T n) { m_value = n; }
private:
- int doTaskImpl(int n) WTF_REQUIRES_LOCK(m_ownerThread) { return n + 1; }
- int m_value WTF_GUARDED_BY_LOCK(m_ownerThread) { 0 };
+ int doTaskImpl(int n) WTF_REQUIRES_CAPABILITY(m_ownerThread) { return n + 1; }
+ int m_value WTF_GUARDED_BY_CAPABILITY(m_ownerThread) { 0 };
NO_UNIQUE_ADDRESS ThreadAssertion m_ownerThread;
};
}
@@ -64,7 +64,7 @@
// instance.accessVariableCompileFailure(10);
}
-static int testMainThreadFunction() WTF_REQUIRES_LOCK(mainThread) { return 11; }
+static int testMainThreadFunction() WTF_REQUIRES_CAPABILITY(mainThread) { return 11; }
TEST(WTF_ThreadAssertions, TestMainThreadNamedAssertion)
{
@@ -75,7 +75,7 @@
EXPECT_EQ(11, testMainThreadFunction());
}
-static int testMainRunLoopFunction() WTF_REQUIRES_LOCK(mainRunLoop) { return 12; }
+static int testMainRunLoopFunction() WTF_REQUIRES_CAPABILITY(mainRunLoop) { return 12; }
TEST(WTF_ThreadAssertions, TestMainRunLoopNamedAssertion)
{