Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "= default" for constructors and destructors in more places #25925

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 2 additions & 6 deletions Source/WTF/wtf/AutomaticThread.cpp
Expand Up @@ -38,13 +38,9 @@ Ref<AutomaticThreadCondition> AutomaticThreadCondition::create()
return adoptRef(*new AutomaticThreadCondition);
}

AutomaticThreadCondition::AutomaticThreadCondition()
{
}
AutomaticThreadCondition::AutomaticThreadCondition() = default;

AutomaticThreadCondition::~AutomaticThreadCondition()
{
}
AutomaticThreadCondition::~AutomaticThreadCondition() = default;

void AutomaticThreadCondition::notifyOne(const AbstractLocker& locker)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WTF/wtf/ConcurrentPtrHashSet.cpp
Expand Up @@ -33,9 +33,7 @@ ConcurrentPtrHashSet::ConcurrentPtrHashSet()
initialize();
}

ConcurrentPtrHashSet::~ConcurrentPtrHashSet()
{
}
ConcurrentPtrHashSet::~ConcurrentPtrHashSet() = default;

void ConcurrentPtrHashSet::deleteOldTables()
{
Expand Down
8 changes: 2 additions & 6 deletions Source/WTF/wtf/FunctionDispatcher.cpp
Expand Up @@ -28,12 +28,8 @@

namespace WTF {

FunctionDispatcher::FunctionDispatcher()
{
}
FunctionDispatcher::FunctionDispatcher() = default;

FunctionDispatcher::~FunctionDispatcher()
{
}
FunctionDispatcher::~FunctionDispatcher() = default;

} // namespace WTF
4 changes: 1 addition & 3 deletions Source/WTF/wtf/LockedPrintStream.cpp
Expand Up @@ -33,9 +33,7 @@ LockedPrintStream::LockedPrintStream(std::unique_ptr<PrintStream> target)
{
}

LockedPrintStream::~LockedPrintStream()
{
}
LockedPrintStream::~LockedPrintStream() = default;

void LockedPrintStream::vprintf(const char* format, va_list args)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/WTF/wtf/PrintStream.cpp
Expand Up @@ -32,8 +32,8 @@

namespace WTF {

PrintStream::PrintStream() { }
PrintStream::~PrintStream() { } // Force the vtable to be in this module
PrintStream::PrintStream() = default;
PrintStream::~PrintStream() = default; // Force the vtable to be in this module

void PrintStream::printf(const char* format, ...)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/WTF/wtf/RefCountedLeakCounter.cpp
Expand Up @@ -30,7 +30,7 @@ void RefCountedLeakCounter::suppressMessages(const char*) { }
void RefCountedLeakCounter::cancelMessageSuppression(const char*) { }

RefCountedLeakCounter::RefCountedLeakCounter(const char*) { }
RefCountedLeakCounter::~RefCountedLeakCounter() { }
RefCountedLeakCounter::~RefCountedLeakCounter() = default;

void RefCountedLeakCounter::increment() { }
void RefCountedLeakCounter::decrement() { }
Expand Down
4 changes: 1 addition & 3 deletions Source/WTF/wtf/glib/SocketConnection.cpp
Expand Up @@ -57,9 +57,7 @@ SocketConnection::SocketConnection(GRefPtr<GSocketConnection>&& connection, cons
});
}

SocketConnection::~SocketConnection()
{
}
SocketConnection::~SocketConnection() = default;

bool SocketConnection::read()
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WTF/wtf/persistence/PersistentDecoder.cpp
Expand Up @@ -36,9 +36,7 @@ Decoder::Decoder(std::span<const uint8_t> span)
{
}

Decoder::~Decoder()
{
}
Decoder::~Decoder() = default;

bool Decoder::bufferIsLargeEnoughToContain(size_t size) const
{
Expand Down
8 changes: 2 additions & 6 deletions Source/WTF/wtf/persistence/PersistentEncoder.cpp
Expand Up @@ -30,13 +30,9 @@

namespace WTF::Persistence {

Encoder::Encoder()
{
}
Encoder::Encoder() = default;

Encoder::~Encoder()
{
}
Encoder::~Encoder() = default;

uint8_t* Encoder::grow(size_t size)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WTF/wtf/posix/ThreadingPOSIX.cpp
Expand Up @@ -83,9 +83,7 @@

namespace WTF {

Thread::~Thread()
{
}
Thread::~Thread() = default;

#if !OS(DARWIN)
class Semaphore final {
Expand Down
4 changes: 1 addition & 3 deletions Source/WTF/wtf/text/StringView.cpp
Expand Up @@ -244,9 +244,7 @@ StringView::GraphemeClusters::Iterator::Iterator(StringView stringView, unsigned
{
}

StringView::GraphemeClusters::Iterator::~Iterator()
{
}
StringView::GraphemeClusters::Iterator::~Iterator() = default;

StringView::GraphemeClusters::Iterator::Iterator(Iterator&& other)
: m_impl(WTFMove(other.m_impl))
Expand Down
8 changes: 2 additions & 6 deletions Source/WTF/wtf/win/ThreadingWin.cpp
Expand Up @@ -329,9 +329,7 @@ void Thread::SpecificStorage::destroySlots()
}
}

Mutex::~Mutex()
{
}
Mutex::~Mutex() = default;

void Mutex::lock()
{
Expand Down Expand Up @@ -370,9 +368,7 @@ static DWORD absoluteTimeToWaitTimeoutInterval(WallTime absoluteTime)
return static_cast<DWORD>((absoluteTime - currentTime).milliseconds());
}

ThreadCondition::~ThreadCondition()
{
}
ThreadCondition::~ThreadCondition() = default;

void ThreadCondition::wait(Mutex& mutex)
{
Expand Down
8 changes: 2 additions & 6 deletions Source/WebCore/Modules/audiosession/NavigatorAudioSession.cpp
Expand Up @@ -33,13 +33,9 @@

namespace WebCore {

NavigatorAudioSession::NavigatorAudioSession()
{
}
NavigatorAudioSession::NavigatorAudioSession() = default;

NavigatorAudioSession::~NavigatorAudioSession()
{
}
NavigatorAudioSession::~NavigatorAudioSession() = default;

RefPtr<DOMAudioSession> NavigatorAudioSession::audioSession(Navigator& navigator)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/fetch/FetchResponse.cpp
Expand Up @@ -351,9 +351,7 @@ FetchResponse::Loader::Loader(FetchResponse& response, NotificationCallback&& re
{
}

FetchResponse::Loader::~Loader()
{
}
FetchResponse::Loader::~Loader() = default;

void FetchResponse::Loader::didReceiveResponse(const ResourceResponse& resourceResponse)
{
Expand Down
Expand Up @@ -48,9 +48,7 @@ RTCDataChannelRemoteHandler::RTCDataChannelRemoteHandler(RTCDataChannelIdentifie
{
}

RTCDataChannelRemoteHandler::~RTCDataChannelRemoteHandler()
{
}
RTCDataChannelRemoteHandler::~RTCDataChannelRemoteHandler() = default;

void RTCDataChannelRemoteHandler::didChangeReadyState(RTCDataChannelState state)
{
Expand Down
Expand Up @@ -42,9 +42,7 @@ RTCDataChannelRemoteSource::RTCDataChannelRemoteSource(RTCDataChannelIdentifier
m_handler->setClient(*this, { });
}

RTCDataChannelRemoteSource::~RTCDataChannelRemoteSource()
{
}
RTCDataChannelRemoteSource::~RTCDataChannelRemoteSource() = default;

} // namespace WebCore

Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/mediastream/RTCRtpSFrameTransform.cpp
Expand Up @@ -68,9 +68,7 @@ RTCRtpSFrameTransform::RTCRtpSFrameTransform(ScriptExecutionContext& context, Op
m_transformer->setAuthenticationSize(options.authenticationSize);
}

RTCRtpSFrameTransform::~RTCRtpSFrameTransform()
{
}
RTCRtpSFrameTransform::~RTCRtpSFrameTransform() = default;

void RTCRtpSFrameTransform::setEncryptionKey(CryptoKey& key, std::optional<uint64_t> keyId, DOMPromiseDeferred<void>&& promise)
{
Expand Down
Expand Up @@ -153,9 +153,7 @@ RTCRtpSFrameTransformer::RTCRtpSFrameTransformer(CompatibilityMode mode)
{
}

RTCRtpSFrameTransformer::~RTCRtpSFrameTransformer()
{
}
RTCRtpSFrameTransformer::~RTCRtpSFrameTransformer() = default;

ExceptionOr<void> RTCRtpSFrameTransformer::setEncryptionKey(const Vector<uint8_t>& rawKey, std::optional<uint64_t> keyId)
{
Expand Down
Expand Up @@ -79,9 +79,7 @@ RTCRtpScriptTransformer::RTCRtpScriptTransformer(ScriptExecutionContext& context
{
}

RTCRtpScriptTransformer::~RTCRtpScriptTransformer()
{
}
RTCRtpScriptTransformer::~RTCRtpScriptTransformer() = default;

ReadableStream& RTCRtpScriptTransformer::readable()
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/mediastream/VideoTrackGenerator.cpp
Expand Up @@ -93,9 +93,7 @@ VideoTrackGenerator::VideoTrackGenerator(Ref<Sink>&& sink, Ref<WritableStream>&&
{
}

VideoTrackGenerator::~VideoTrackGenerator()
{
}
VideoTrackGenerator::~VideoTrackGenerator() = default;

void VideoTrackGenerator::setMuted(ScriptExecutionContext& context, bool muted)
{
Expand Down
Expand Up @@ -54,9 +54,7 @@ NotificationEvent::NotificationEvent(const AtomString& type, NotificationEventIn
{
}

NotificationEvent::~NotificationEvent()
{
}
NotificationEvent::~NotificationEvent() = default;

} // namespace WebCore

Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/push-api/PushEvent.cpp
Expand Up @@ -78,8 +78,6 @@ PushEvent::PushEvent(const AtomString& type, ExtendableEventInit&& eventInit, st
{
}

PushEvent::~PushEvent()
{
}
PushEvent::~PushEvent() = default;

} // namespace WebCore
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp
Expand Up @@ -62,9 +62,7 @@ RemotePlayback::RemotePlayback(HTMLMediaElement& element)
{
}

RemotePlayback::~RemotePlayback()
{
}
RemotePlayback::~RemotePlayback() = default;

WebCoreOpaqueRoot RemotePlayback::opaqueRootConcurrently() const
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/speech/SpeechRecognition.cpp
Expand Up @@ -212,9 +212,7 @@ void SpeechRecognition::didEnd()
queueTaskToDispatchEvent(*this, TaskSource::Speech, Event::create(eventNames().endEvent, Event::CanBubble::No, Event::IsCancelable::No));
}

SpeechRecognition::~SpeechRecognition()
{
}
SpeechRecognition::~SpeechRecognition() = default;

bool SpeechRecognition::virtualHasPendingActivity() const
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/streams/TransformStream.cpp
Expand Up @@ -73,9 +73,7 @@ TransformStream::TransformStream(JSC::JSValue internalTransformStream, Ref<Reada
{
}

TransformStream::~TransformStream()
{
}
TransformStream::~TransformStream() = default;

static ExceptionOr<JSC::JSValue> invokeTransformStreamFunction(JSC::JSGlobalObject& globalObject, const JSC::Identifier& identifier, const JSC::MarkedArgumentBuffer& arguments)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/webauthn/cbor/CBORWriter.cpp
Expand Up @@ -36,9 +36,7 @@

namespace cbor {

CBORWriter::~CBORWriter()
{
}
CBORWriter::~CBORWriter() = default;

// static
std::optional<Vector<uint8_t>> CBORWriter::write(const CBORValue& node, size_t maxNestingLevel)
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/webcodecs/WebCodecsAudioDecoder.cpp
Expand Up @@ -60,9 +60,7 @@ WebCodecsAudioDecoder::WebCodecsAudioDecoder(ScriptExecutionContext& context, In
{
}

WebCodecsAudioDecoder::~WebCodecsAudioDecoder()
{
}
WebCodecsAudioDecoder::~WebCodecsAudioDecoder() = default;

static bool isValidDecoderConfig(const WebCodecsAudioDecoderConfig& config)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/webcodecs/WebCodecsAudioEncoder.cpp
Expand Up @@ -68,9 +68,7 @@ WebCodecsAudioEncoder::WebCodecsAudioEncoder(ScriptExecutionContext& context, In
{
}

WebCodecsAudioEncoder::~WebCodecsAudioEncoder()
{
}
WebCodecsAudioEncoder::~WebCodecsAudioEncoder() = default;

static bool isSupportedEncoderCodec(const StringView& codec)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/webcodecs/WebCodecsVideoDecoder.cpp
Expand Up @@ -60,9 +60,7 @@ WebCodecsVideoDecoder::WebCodecsVideoDecoder(ScriptExecutionContext& context, In
{
}

WebCodecsVideoDecoder::~WebCodecsVideoDecoder()
{
}
WebCodecsVideoDecoder::~WebCodecsVideoDecoder() = default;

static bool isSupportedDecoderCodec(const String& codec, const Settings::Values& settings)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Modules/webcodecs/WebCodecsVideoEncoder.cpp
Expand Up @@ -64,9 +64,7 @@ WebCodecsVideoEncoder::WebCodecsVideoEncoder(ScriptExecutionContext& context, In
{
}

WebCodecsVideoEncoder::~WebCodecsVideoEncoder()
{
}
WebCodecsVideoEncoder::~WebCodecsVideoEncoder() = default;

static bool isSupportedEncoderCodec(const String& codec, const Settings::Values& settings)
{
Expand Down
8 changes: 2 additions & 6 deletions Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp
Expand Up @@ -103,13 +103,9 @@ struct CryptoDigestContextImpl : public CryptoDigestContext {
SHAContext m_context;
};

CryptoDigest::CryptoDigest()
{
}
CryptoDigest::CryptoDigest() = default;

CryptoDigest::~CryptoDigest()
{
}
CryptoDigest::~CryptoDigest() = default;

static std::unique_ptr<CryptoDigestContext> createCryptoDigest(CryptoDigest::Algorithm algorithm)
{
Expand Down
4 changes: 1 addition & 3 deletions Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb
Expand Up @@ -145,9 +145,7 @@ Settings::Values Settings::Values::isolatedCopy() const
};
}

Settings::~Settings()
{
}
Settings::~Settings() = default;

void Settings::disableUnstableFeaturesForModernWebKit()
{
Expand Down
8 changes: 2 additions & 6 deletions Source/WebCore/animation/AnimationEffect.cpp
Expand Up @@ -39,13 +39,9 @@ namespace WebCore {

WTF_MAKE_ISO_ALLOCATED_IMPL(AnimationEffect);

AnimationEffect::AnimationEffect()
{
}
AnimationEffect::AnimationEffect() = default;

AnimationEffect::~AnimationEffect()
{
}
AnimationEffect::~AnimationEffect() = default;

void AnimationEffect::setAnimation(WebAnimation* animation)
{
Expand Down