Diff
Modified: trunk/Source/WTF/ChangeLog (276690 => 276691)
--- trunk/Source/WTF/ChangeLog 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Source/WTF/ChangeLog 2021-04-28 06:26:12 UTC (rev 276691)
@@ -1,3 +1,18 @@
+2021-04-27 Kimmo Kinnunen <[email protected]>
+
+ Add a Condition type that supports thread safety analysis
+ https://bugs.webkit.org/show_bug.cgi?id=224970
+
+ Reviewed by Darin Adler.
+
+ Add CheckedCondition, a condition variable to be used with CheckedLock.
+ Use thread safety analysis annotations for CheckedCondition.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/CheckedCondition.h: Added.
+ * wtf/CheckedLock.h:
+
2021-04-27 Ben Nham <[email protected]>
Memory pressure events should be logged to com.apple.WebKit subsystem
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (276690 => 276691)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2021-04-28 06:26:12 UTC (rev 276691)
@@ -456,6 +456,7 @@
7AFEC6B01EB22B5900DADE36 /* UUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UUID.cpp; sourceTree = "<group>"; };
7B2739DC2624DAAA0040F182 /* ThreadSafetyAnalysis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreadSafetyAnalysis.h; sourceTree = "<group>"; };
7B2739DD2624DAC30040F182 /* CheckedLock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CheckedLock.h; sourceTree = "<group>"; };
+ 7B2739F0263179C30040F182 /* CheckedCondition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CheckedCondition.h; sourceTree = "<group>"; };
7C137941222326C700D7A824 /* AUTHORS */ = {isa = PBXFileReference; lastKnownFileType = text; path = AUTHORS; sourceTree = "<group>"; };
7C137942222326D500D7A824 /* ieee.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ieee.h; sourceTree = "<group>"; };
7C137943222326D500D7A824 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
@@ -981,6 +982,7 @@
413FE8F51F8D2EAB00F6D7D7 /* CallbackAggregator.h */,
A8A4726A151A825A004123FF /* CheckedArithmetic.h */,
A8A4726B151A825A004123FF /* CheckedBoolean.h */,
+ 7B2739F0263179C30040F182 /* CheckedCondition.h */,
7B2739DD2624DAC30040F182 /* CheckedLock.h */,
0F66B2801DC97BAB004A1D3F /* ClockType.cpp */,
0F66B2811DC97BAB004A1D3F /* ClockType.h */,
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (276690 => 276691)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2021-04-28 06:26:12 UTC (rev 276691)
@@ -28,6 +28,7 @@
CallbackAggregator.h
CheckedArithmetic.h
CheckedBoolean.h
+ CheckedCondition.h
CheckedLock.h
ClockType.h
CommaPrinter.h
Added: trunk/Source/WTF/wtf/CheckedCondition.h (0 => 276691)
--- trunk/Source/WTF/wtf/CheckedCondition.h (rev 0)
+++ trunk/Source/WTF/wtf/CheckedCondition.h 2021-04-28 06:26:12 UTC (rev 276691)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/CheckedLock.h>
+#include <wtf/Condition.h>
+
+namespace WTF {
+
+// A condition variable type for CheckedLock.
+class CheckedCondition final {
+ WTF_MAKE_NONCOPYABLE(CheckedCondition);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ constexpr CheckedCondition() = default;
+
+ bool waitUntil(CheckedLock& lock, const TimeWithDynamicClockType& timeout) WTF_REQUIRES_LOCK(lock)
+ {
+ return m_condition.waitUntil(uncheckedCast(lock), timeout);
+ }
+ template<typename Functor>
+ bool waitUntil(CheckedLock& lock, const TimeWithDynamicClockType& timeout, const Functor& predicate) WTF_REQUIRES_LOCK(lock)
+ {
+ return m_condition.waitUntil(uncheckedCast(lock), timeout, predicate);
+ }
+ template<typename Functor>
+ bool waitFor(CheckedLock& lock, Seconds relativeTimeout, const Functor& predicate) WTF_REQUIRES_LOCK(lock)
+ {
+ return m_condition.waitFor(uncheckedCast(lock), relativeTimeout, predicate);
+ }
+ bool waitFor(CheckedLock& lock, Seconds relativeTimeout) WTF_REQUIRES_LOCK(lock)
+ {
+ return m_condition.waitFor(uncheckedCast(lock), relativeTimeout);
+ }
+ void wait(CheckedLock& lock) WTF_REQUIRES_LOCK(lock)
+ {
+ return m_condition.wait(uncheckedCast(lock));
+ }
+ template<typename Functor>
+ void wait(CheckedLock& lock, const Functor& predicate) WTF_REQUIRES_LOCK(lock)
+ {
+ m_condition.wait(uncheckedCast(lock), predicate);
+ }
+ bool notifyOne()
+ {
+ return m_condition.notifyOne();
+ }
+ void notifyAll()
+ {
+ m_condition.notifyAll();
+ }
+private:
+ static Lock& uncheckedCast(CheckedLock& lock) { return static_cast<Lock&>(lock); }
+ Condition m_condition;
+};
+
+} // namespace WTF
+
+using WTF::CheckedCondition;
Modified: trunk/Source/WTF/wtf/CheckedLock.h (276690 => 276691)
--- trunk/Source/WTF/wtf/CheckedLock.h 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Source/WTF/wtf/CheckedLock.h 2021-04-28 06:26:12 UTC (rev 276691)
@@ -67,6 +67,7 @@
void safepoint() { Lock::safepoint(); }
bool isHeld() const { return Lock::isHeld(); }
bool isLocked() const { return Lock::isLocked(); }
+ friend class CheckedCondition;
};
using AdoptLockTag = std::adopt_lock_t;
Modified: trunk/Source/WebKit/ChangeLog (276690 => 276691)
--- trunk/Source/WebKit/ChangeLog 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Source/WebKit/ChangeLog 2021-04-28 06:26:12 UTC (rev 276691)
@@ -1,3 +1,41 @@
+2021-04-27 Kimmo Kinnunen <[email protected]>
+
+ Add a Condition type that supports thread safety analysis
+ https://bugs.webkit.org/show_bug.cgi?id=224970
+
+ Reviewed by Darin Adler.
+
+ Use CheckedCondition and CheckedLock as an example of the
+ added implementations.
+
+ * Platform/IPC/Connection.cpp:
+ (IPC::Connection::waitForMessage):
+ (IPC::Connection::processIncomingMessage):
+ (IPC::Connection::connectionDidClose):
+ * Platform/IPC/Connection.h:
+ (IPC::Connection::WTF_GUARDED_BY_LOCK):
+ Use CheckedCondition (as an example).
+
+ Mark up variables protected by
+ IPC::Connection::m_waitForMessageMutex
+ to use thread safety analysis.
+
+ * Shared/mac/MediaFormatReader/MediaTrackReader.cpp:
+ (WebKit::MediaTrackReader::greatestPresentationTime const):
+ Fix unlocked access.
+
+ (WebKit::MediaTrackReader::addSample):
+ (WebKit::MediaTrackReader::waitForSample const):
+ (WebKit::MediaTrackReader::finishParsing):
+ (WebKit::MediaTrackReader::copyProperty):
+ (WebKit::MediaTrackReader::finalize):
+ * Shared/mac/MediaFormatReader/MediaTrackReader.h:
+ Use CheckedCondition (as an example).
+
+ Mark up variables protected by
+ MediaTrackReader::m_sampleStorageLock
+ to use thread safety analysis.
+
2021-04-27 Chris Dumez <[email protected]>
Improve local storage size estimation for quota limitation
Modified: trunk/Source/WebKit/Platform/IPC/Connection.cpp (276690 => 276691)
--- trunk/Source/WebKit/Platform/IPC/Connection.cpp 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Source/WebKit/Platform/IPC/Connection.cpp 2021-04-28 06:26:12 UTC (rev 276691)
@@ -520,7 +520,7 @@
WaitForMessageState waitingForMessage(messageName, destinationID, waitForOptions);
{
- auto locker = holdLock(m_waitForMessageMutex);
+ Locker locker { m_waitForMessageMutex };
// We don't support having multiple clients waiting for messages.
ASSERT(!m_waitingForMessage);
@@ -569,7 +569,7 @@
// Handle any messages that are blocked on a response from us.
SyncMessageState::singleton().dispatchMessages();
- std::unique_lock<Lock> lock(m_waitForMessageMutex);
+ Locker lock { m_waitForMessageMutex };
if (m_waitingForMessage->decoder) {
auto decoder = WTFMove(m_waitingForMessage->decoder);
@@ -578,7 +578,7 @@
}
// Now we wait.
- bool didTimeout = !m_waitForMessageCondition.waitUntil(lock, timeout.deadline());
+ bool didTimeout = !m_waitForMessageCondition.waitUntil(m_waitForMessageMutex, timeout.deadline());
// We timed out, lost our connection, or a sync message came in with InterruptWaitingIfSyncMessageArrives, so stop waiting.
if (didTimeout || m_waitingForMessage->messageWaitingInterrupted) {
m_waitingForMessage = nullptr;
@@ -748,7 +748,7 @@
}
// FIXME: These are practically the same mutex, so maybe they could be merged.
- auto waitForMessagesLocker = holdLock(m_waitForMessageMutex);
+ Locker waitForMessagesLocker { m_waitForMessageMutex };
auto incomingMessagesLocker = holdLock(m_incomingMessagesMutex);
if (auto* receiveQueue = m_receiveQueues.get(*message)) {
@@ -866,7 +866,7 @@
}
{
- auto locker = holdLock(m_waitForMessageMutex);
+ Locker locker { m_waitForMessageMutex };
ASSERT(m_shouldWaitForMessages);
m_shouldWaitForMessages = false;
Modified: trunk/Source/WebKit/Platform/IPC/Connection.h (276690 => 276691)
--- trunk/Source/WebKit/Platform/IPC/Connection.h 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Source/WebKit/Platform/IPC/Connection.h 2021-04-28 06:26:12 UTC (rev 276691)
@@ -33,8 +33,9 @@
#include "MessageReceiveQueueMap.h"
#include "MessageReceiver.h"
#include "Timeout.h"
+#include <wtf/CheckedCondition.h>
+#include <wtf/CheckedLock.h>
#include <wtf/CompletionHandler.h>
-#include <wtf/Condition.h>
#include <wtf/Deque.h>
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
@@ -411,18 +412,18 @@
// Outgoing messages.
Lock m_outgoingMessagesMutex;
Deque<UniqueRef<Encoder>> m_outgoingMessages;
-
- Condition m_waitForMessageCondition;
- Lock m_waitForMessageMutex;
+ CheckedCondition m_waitForMessageCondition;
+ CheckedLock m_waitForMessageMutex;
+
struct WaitForMessageState;
- WaitForMessageState* m_waitingForMessage { nullptr };
+ WaitForMessageState* m_waitingForMessage WTF_GUARDED_BY_LOCK(m_waitForMessageMutex) { nullptr }; // NOLINT
class SyncMessageState;
Lock m_syncReplyStateMutex;
bool m_shouldWaitForSyncReplies;
- bool m_shouldWaitForMessages;
+ bool m_shouldWaitForMessages WTF_GUARDED_BY_LOCK(m_waitForMessageMutex);
struct PendingSyncReply;
Vector<PendingSyncReply> m_pendingSyncReplies;
Modified: trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.cpp (276690 => 276691)
--- trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.cpp 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.cpp 2021-04-28 06:26:12 UTC (rev 276691)
@@ -87,6 +87,7 @@
MediaTime MediaTrackReader::greatestPresentationTime() const
{
+ Locker locker { m_sampleStorageLock };
auto& sampleMap = m_sampleStorage->sampleMap;
if (sampleMap.empty())
return MediaTime::invalidTime();
@@ -98,7 +99,7 @@
void MediaTrackReader::addSample(Ref<MediaSample>&& sample, MTPluginByteSourceRef byteSource)
{
ASSERT(!isMainRunLoop());
- auto locker = holdLock(m_sampleStorageLock);
+ Locker locker { m_sampleStorageLock };
if (!m_sampleStorage)
m_sampleStorage = makeUnique<SampleStorage>();
@@ -116,10 +117,11 @@
void MediaTrackReader::waitForSample(Function<bool(SampleMap&, bool)>&& predicate) const
{
- auto locker = holdLock(m_sampleStorageLock);
+ Locker locker { m_sampleStorageLock };
if (!m_sampleStorage)
m_sampleStorage = makeUnique<SampleStorage>();
m_sampleStorageCondition.wait(m_sampleStorageLock, [predicate = WTFMove(predicate), this] {
+ assertIsHeld(m_sampleStorageLock);
return predicate(m_sampleStorage->sampleMap, m_sampleStorage->hasAllSamples);
});
}
@@ -129,7 +131,7 @@
ASSERT(!isMainRunLoop());
ALWAYS_LOG(LOGIDENTIFIER);
- auto locker = holdLock(m_sampleStorageLock);
+ Locker locker { m_sampleStorageLock };
if (!m_sampleStorage)
m_sampleStorage = makeUnique<SampleStorage>();
m_sampleStorage->hasAllSamples = true;
@@ -165,8 +167,9 @@
return noErr;
}
- auto locker = holdLock(m_sampleStorageLock);
+ Locker locker { m_sampleStorageLock };
m_sampleStorageCondition.wait(m_sampleStorageLock, [&] {
+ assertIsHeld(m_sampleStorageLock);
return !!m_sampleStorage;
});
@@ -198,7 +201,7 @@
void MediaTrackReader::finalize()
{
- auto locker = holdLock(m_sampleStorageLock);
+ Locker locker { m_sampleStorageLock };
storageQueue().dispatch([sampleStorage = std::exchange(m_sampleStorage, nullptr)]() mutable {
sampleStorage = nullptr;
});
Modified: trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.h (276690 => 276691)
--- trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.h 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Source/WebKit/Shared/mac/MediaFormatReader/MediaTrackReader.h 2021-04-28 06:26:12 UTC (rev 276691)
@@ -29,7 +29,8 @@
#include "CoreMediaWrapped.h"
#include <WebCore/SampleMap.h>
-#include <wtf/Condition.h>
+#include <wtf/CheckedCondition.h>
+#include <wtf/CheckedLock.h>
DECLARE_CORE_MEDIA_TRAITS(TrackReader);
@@ -105,9 +106,9 @@
const CMMediaType m_mediaType;
const MediaTime m_duration;
std::atomic<Enabled> m_isEnabled { Enabled::Unknown };
- mutable Condition m_sampleStorageCondition;
- mutable Lock m_sampleStorageLock;
- mutable std::unique_ptr<SampleStorage> m_sampleStorage;
+ mutable CheckedCondition m_sampleStorageCondition;
+ mutable CheckedLock m_sampleStorageLock;
+ mutable std::unique_ptr<SampleStorage> m_sampleStorage WTF_GUARDED_BY_LOCK(m_sampleStorageLock);
Ref<const Logger> m_logger;
const void* m_logIdentifier;
};
Modified: trunk/Tools/ChangeLog (276690 => 276691)
--- trunk/Tools/ChangeLog 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Tools/ChangeLog 2021-04-28 06:26:12 UTC (rev 276691)
@@ -1,3 +1,18 @@
+2021-04-27 Kimmo Kinnunen <[email protected]>
+
+ Add a Condition type that supports thread safety analysis
+ https://bugs.webkit.org/show_bug.cgi?id=224970
+
+ Reviewed by Darin Adler.
+
+ A simple test for CheckedCondition to make sure
+ it compiles.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WTF/CheckedConditionTest.cpp: Copied from Tools/TestWebKitAPI/Tests/WTF/CheckedLockTest.cpp.
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WTF/CheckedLockTest.cpp:
+
2021-04-27 Sam Sneddon <[email protected]>
Make TestInput immutable
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (276690 => 276691)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-04-28 06:26:12 UTC (rev 276691)
@@ -583,6 +583,7 @@
7AEAD47F1E20116C00416EFE /* CrossPartitionFileSchemeAccess.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7AEAD47C1E20113800416EFE /* CrossPartitionFileSchemeAccess.mm */; };
7AEAD4811E20122700416EFE /* CrossPartitionFileSchemeAccess.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7AEAD47D1E20114E00416EFE /* CrossPartitionFileSchemeAccess.html */; };
7B2739E0262571CC0040F182 /* CheckedLockTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B2739DF262571CC0040F182 /* CheckedLockTest.cpp */; };
+ 7B2739EF26315E7E0040F182 /* CheckedConditionTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B2739EE26315E7D0040F182 /* CheckedConditionTest.cpp */; };
7B7D096A2519F8F90017A078 /* WebGLNoCrashOnOtherThreadAccess.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7B7D09692519F8F90017A078 /* WebGLNoCrashOnOtherThreadAccess.mm */; };
7C1AF7951E8DCBAB002645B9 /* PrepareForMoveToWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C1AF7931E8DCBAB002645B9 /* PrepareForMoveToWindow.mm */; };
7C3965061CDD74F90094DBB8 /* ColorTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3965051CDD74F90094DBB8 /* ColorTests.cpp */; };
@@ -2432,6 +2433,7 @@
7AEAD47C1E20113800416EFE /* CrossPartitionFileSchemeAccess.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CrossPartitionFileSchemeAccess.mm; sourceTree = "<group>"; };
7AEAD47D1E20114E00416EFE /* CrossPartitionFileSchemeAccess.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = CrossPartitionFileSchemeAccess.html; path = Tests/mac/CrossPartitionFileSchemeAccess.html; sourceTree = SOURCE_ROOT; };
7B2739DF262571CC0040F182 /* CheckedLockTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckedLockTest.cpp; sourceTree = "<group>"; };
+ 7B2739EE26315E7D0040F182 /* CheckedConditionTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckedConditionTest.cpp; sourceTree = "<group>"; };
7B7D09692519F8F90017A078 /* WebGLNoCrashOnOtherThreadAccess.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGLNoCrashOnOtherThreadAccess.mm; sourceTree = "<group>"; };
7C1AF7931E8DCBAB002645B9 /* PrepareForMoveToWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrepareForMoveToWindow.mm; sourceTree = "<group>"; };
7C3965051CDD74F90094DBB8 /* ColorTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorTests.cpp; sourceTree = "<group>"; };
@@ -4376,6 +4378,7 @@
93A427AE180DA60F00CD24D7 /* BoxPtr.cpp */,
0451A5A6235E438E009DF945 /* BumpPointerAllocator.cpp */,
A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */,
+ 7B2739EE26315E7D0040F182 /* CheckedConditionTest.cpp */,
7B2739DF262571CC0040F182 /* CheckedLockTest.cpp */,
E302BDA92404B92300865277 /* CompactRefPtrTuple.cpp */,
9B0C051824FDFB7000F2FE31 /* CompactUniquePtrTuple.cpp */,
@@ -5132,6 +5135,7 @@
7C83DF181D0A590C00FEBCF3 /* BoxPtr.cpp in Sources */,
04DB2396235E43EC00328F17 /* BumpPointerAllocator.cpp in Sources */,
7C83DEA01D0A590C00FEBCF3 /* CheckedArithmeticOperations.cpp in Sources */,
+ 7B2739EF26315E7E0040F182 /* CheckedConditionTest.cpp in Sources */,
7B2739E0262571CC0040F182 /* CheckedLockTest.cpp in Sources */,
E302BDAA2404B92400865277 /* CompactRefPtrTuple.cpp in Sources */,
9B0C051924FDFB7D00F2FE31 /* CompactUniquePtrTuple.cpp in Sources */,
Copied: trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedConditionTest.cpp (from rev 276690, trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedLockTest.cpp) (0 => 276691)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedConditionTest.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedConditionTest.cpp 2021-04-28 06:26:12 UTC (rev 276691)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <wtf/CheckedCondition.h>
+
+namespace TestWebKitAPI {
+
+TEST(WTF_CheckedLock, CheckedConditionCompiles)
+{
+ CheckedLock lock;
+ CheckedCondition condition;
+ Locker locker { lock }; // Comment this to ensure that thread safety analysis creates a compile error.
+ bool result = condition.waitFor(lock, 0_s);
+ EXPECT_FALSE(result);
+}
+
+} // namespace TestWebKitAPI
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedLockTest.cpp (276690 => 276691)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedLockTest.cpp 2021-04-28 04:50:39 UTC (rev 276690)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedLockTest.cpp 2021-04-28 06:26:12 UTC (rev 276691)
@@ -26,8 +26,6 @@
#include "config.h"
#include <wtf/CheckedLock.h>
-#include <wtf/StdLibExtras.h>
-
namespace TestWebKitAPI {
namespace {