Skip to content

Commit

Permalink
Update ScriptExecutionContext::forEachActiveDOMObject() to ref the Ac…
Browse files Browse the repository at this point in the history
…tiveDOMObjects

https://bugs.webkit.org/show_bug.cgi?id=273462

Reviewed by Ryosuke Niwa.

Update ScriptExecutionContext::forEachActiveDOMObject() to ref the ActiveDOMObjects,
to avoid bugs like Bug 273451.

Also fix an issue with AudioNode where the node could get deleted if ref'd after the
node has been marked for deletion. When an AudioNode's ref-count reaches 0, we mark it for
deletion, so that the BaseAudioContext will eventually destroy it. During this time, the
AudioNode is still registered as an ActiveDOMObject with the ScriptExecutionContext, which
may thus ref it. When a Node gets ref'd we now unmark it for deletion until its ref-count
reaches 0 again.

* Source/WebCore/Modules/WebGPU/GPUDevice.h:
* Source/WebCore/Modules/applepay/ApplePaySession.h:
* Source/WebCore/Modules/applepay/ApplePaySetupWebCore.h:
* Source/WebCore/Modules/audiosession/DOMAudioSession.h:
* Source/WebCore/Modules/cache/DOMCache.h:
* Source/WebCore/Modules/cache/DOMCacheStorage.h:
* Source/WebCore/Modules/cookie-store/CookieStore.h:
* Source/WebCore/Modules/encryptedmedia/MediaKeySession.h:
* Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.h:
* Source/WebCore/Modules/encryptedmedia/MediaKeySystemRequest.h:
* Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
* Source/WebCore/Modules/entriesapi/FileSystemDirectoryReader.h:
* Source/WebCore/Modules/entriesapi/FileSystemEntry.h:
* Source/WebCore/Modules/fetch/FetchBodyOwner.h:
* Source/WebCore/Modules/filesystemaccess/FileSystemHandle.h:
* Source/WebCore/Modules/filesystemaccess/FileSystemSyncAccessHandle.h:
* Source/WebCore/Modules/gamepad/GamepadHapticActuator.h:
* Source/WebCore/Modules/geolocation/Geolocation.h:
* Source/WebCore/Modules/indexeddb/IDBActiveDOMObject.h:
* Source/WebCore/Modules/indexeddb/IDBIndex.h:
* Source/WebCore/Modules/indexeddb/IDBObjectStore.h:
* Source/WebCore/Modules/mediarecorder/MediaRecorder.h:
* Source/WebCore/Modules/mediasession/MediaSession.h:
* Source/WebCore/Modules/mediasession/MediaSessionCoordinator.h:
* Source/WebCore/Modules/mediasource/MediaSource.h:
* Source/WebCore/Modules/mediasource/SourceBuffer.h:
* Source/WebCore/Modules/mediasource/SourceBufferList.h:
* Source/WebCore/Modules/mediastream/ImageCapture.h:
* Source/WebCore/Modules/mediastream/MediaDevices.h:
* Source/WebCore/Modules/mediastream/MediaStream.h:
* Source/WebCore/Modules/mediastream/MediaStreamTrack.h:
* Source/WebCore/Modules/mediastream/RTCDTMFSender.h:
* Source/WebCore/Modules/mediastream/RTCDataChannel.h:
* Source/WebCore/Modules/mediastream/RTCDtlsTransport.h:
* Source/WebCore/Modules/mediastream/RTCIceTransport.h:
* Source/WebCore/Modules/mediastream/RTCPeerConnection.h:
* Source/WebCore/Modules/mediastream/RTCRtpSFrameTransform.h:
* Source/WebCore/Modules/mediastream/RTCRtpScriptTransform.h:
* Source/WebCore/Modules/mediastream/RTCRtpScriptTransformer.h:
* Source/WebCore/Modules/mediastream/RTCSctpTransport.h:
* Source/WebCore/Modules/mediastream/UserMediaRequest.h:
* Source/WebCore/Modules/model-element/HTMLModelElement.h:
* Source/WebCore/Modules/notifications/Notification.h:
* Source/WebCore/Modules/paymentrequest/PaymentRequest.h:
* Source/WebCore/Modules/paymentrequest/PaymentResponse.h:
* Source/WebCore/Modules/permissions/PermissionStatus.h:
* Source/WebCore/Modules/pictureinpicture/PictureInPictureWindow.h:
* Source/WebCore/Modules/remoteplayback/RemotePlayback.h:
* Source/WebCore/Modules/screen-wake-lock/WakeLockSentinel.h:
* Source/WebCore/Modules/speech/SpeechRecognition.h:
* Source/WebCore/Modules/speech/SpeechSynthesis.h:
* Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h:
* Source/WebCore/Modules/web-locks/WebLockManager.h:
* Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h:
* Source/WebCore/Modules/webaudio/AudioWorkletNode.h:
* Source/WebCore/Modules/webaudio/BaseAudioContext.h:
* Source/WebCore/Modules/webaudio/ScriptProcessorNode.h:
* Source/WebCore/Modules/webcodecs/WebCodecsAudioDecoder.h:
* Source/WebCore/Modules/webcodecs/WebCodecsAudioEncoder.h:
* Source/WebCore/Modules/webcodecs/WebCodecsVideoDecoder.h:
* Source/WebCore/Modules/webcodecs/WebCodecsVideoEncoder.h:
* Source/WebCore/Modules/webdatabase/DatabaseContext.h:
* Source/WebCore/Modules/websockets/WebSocket.h:
* Source/WebCore/Modules/webtransport/WebTransport.h:
* Source/WebCore/Modules/webxr/WebXRSession.h:
* Source/WebCore/Modules/webxr/WebXRSystem.h:
* Source/WebCore/animation/WebAnimation.h:
* Source/WebCore/css/CSSFontSelector.h:
* Source/WebCore/css/FontFace.h:
* Source/WebCore/css/FontFaceSet.h:
* Source/WebCore/css/MediaQueryList.h:
* Source/WebCore/dom/ActiveDOMObject.h:
* Source/WebCore/dom/BroadcastChannel.h:
* Source/WebCore/dom/MessagePort.h:
* Source/WebCore/dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::forEachActiveDOMObject const):
* Source/WebCore/dom/ScriptExecutionContext.h:
* Source/WebCore/dom/ViewTransition.h:
* Source/WebCore/fileapi/Blob.h:
* Source/WebCore/fileapi/FileReader.h:
* Source/WebCore/html/CanvasBase.h:
(WebCore::CanvasBase::ref const):
(WebCore::CanvasBase::deref const):
(WebCore::CanvasBase::ref): Deleted.
(WebCore::CanvasBase::deref): Deleted.
* Source/WebCore/html/CustomPaintCanvas.h:
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/html/HTMLImageElement.h:
* Source/WebCore/html/HTMLMarqueeElement.h:
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/HTMLSourceElement.h:
* Source/WebCore/html/HTMLTrackElement.h:
* Source/WebCore/html/ImageBitmap.cpp:
* Source/WebCore/html/OffscreenCanvas.h:
* Source/WebCore/html/PublicURLManager.cpp:
(WebCore::PublicURLManager::create):
* Source/WebCore/html/PublicURLManager.h:
* Source/WebCore/html/canvas/CanvasRenderingContext.cpp:
(WebCore::CanvasRenderingContext::ref const):
(WebCore::CanvasRenderingContext::deref const):
(WebCore::CanvasRenderingContext::ref): Deleted.
(WebCore::CanvasRenderingContext::deref): Deleted.
* Source/WebCore/html/canvas/CanvasRenderingContext.h:
* Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h:
* Source/WebCore/html/track/TextTrack.h:
* Source/WebCore/html/track/TextTrackCue.h:
* Source/WebCore/html/track/TrackListBase.h:
* Source/WebCore/page/DOMTimer.h:
* Source/WebCore/page/EventSource.h:
* Source/WebCore/page/ScreenOrientation.h:
* Source/WebCore/workers/Worker.h:
* Source/WebCore/workers/WorkerAnimationController.h:
* Source/WebCore/workers/service/ServiceWorker.h:
* Source/WebCore/workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::refActiveDOMObject):
(WebCore::ServiceWorkerContainer::derefActiveDOMObject):
* Source/WebCore/workers/service/ServiceWorkerContainer.h:
* Source/WebCore/workers/service/ServiceWorkerRegistration.h:
* Source/WebCore/workers/service/background-fetch/BackgroundFetchRegistration.h:
* Source/WebCore/workers/shared/SharedWorker.h:
* Source/WebCore/worklets/Worklet.h:
* Source/WebCore/xml/XMLHttpRequest.h:

Canonical link: https://commits.webkit.org/278273@main
  • Loading branch information
cdumez committed May 2, 2024
1 parent 38d5868 commit 838fda3
Show file tree
Hide file tree
Showing 124 changed files with 515 additions and 230 deletions.
8 changes: 4 additions & 4 deletions Source/WebCore/Modules/WebGPU/GPUDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ class GPUDevice : public RefCounted<GPUDevice>, public ActiveDOMObject, public E

virtual ~GPUDevice();

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

String label() const;
void setLabel(String&&);

Expand Down Expand Up @@ -136,15 +140,11 @@ class GPUDevice : public RefCounted<GPUDevice>, public ActiveDOMObject, public E
void removeBufferToUnmap(GPUBuffer&);
void addBufferToUnmap(GPUBuffer&);

using RefCounted::ref;
using RefCounted::deref;

WeakPtr<GPUExternalTexture> takeExternalTextureForVideoElement(const HTMLVideoElement&);

private:
GPUDevice(ScriptExecutionContext*, Ref<WebGPU::Device>&&);

// ActiveDOMObject.
// FIXME: We probably need to override more methods to make this work properly.
RefPtr<GPUPipelineLayout> createAutoPipelineLayout();

Expand Down
7 changes: 4 additions & 3 deletions Source/WebCore/Modules/applepay/ApplePaySession.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class ApplePaySession final : public PaymentSession, public ActiveDOMObject, pub
static ExceptionOr<Ref<ApplePaySession>> create(Document&, unsigned version, ApplePayPaymentRequest&&);
virtual ~ApplePaySession();

// ActiveDOMObject.
void ref() const final { PaymentSession::ref(); }
void deref() const final { PaymentSession::deref(); }

static constexpr auto STATUS_SUCCESS = ApplePayPaymentAuthorizationResult::Success;
static constexpr auto STATUS_FAILURE = ApplePayPaymentAuthorizationResult::Failure;
static constexpr auto STATUS_INVALID_BILLING_POSTAL_ADDRESS = ApplePayPaymentAuthorizationResult::InvalidBillingPostalAddress;
Expand Down Expand Up @@ -97,9 +101,6 @@ class ApplePaySession final : public PaymentSession, public ActiveDOMObject, pub

const ApplePaySessionPaymentRequest& paymentRequest() const { return m_paymentRequest; }

using PaymentSession::ref;
using PaymentSession::deref;

private:
ApplePaySession(Document&, unsigned version, ApplePaySessionPaymentRequest&&);

Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/Modules/applepay/ApplePaySetupWebCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class ApplePaySetup : public ActiveDOMObject, public RefCounted<ApplePaySetup> {
using BeginPromise = DOMPromiseDeferred<IDLBoolean>;
void begin(Document&, Vector<Ref<ApplePaySetupFeature>>&&, BeginPromise&&);

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

private:
ApplePaySetup(ScriptExecutionContext&, ApplePaySetupConfiguration&&);

Expand Down
5 changes: 3 additions & 2 deletions Source/WebCore/Modules/audiosession/DOMAudioSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ class DOMAudioSession final : public RefCounted<DOMAudioSession>, public ActiveD
Type type() const;
State state() const;

using RefCounted<DOMAudioSession>::ref;
using RefCounted<DOMAudioSession>::deref;
// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

private:
explicit DOMAudioSession(ScriptExecutionContext*);
Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/Modules/cache/DOMCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class DOMCache final : public RefCounted<DOMCache>, public ActiveDOMObject {
static Ref<DOMCache> create(ScriptExecutionContext&, String&&, DOMCacheIdentifier, Ref<CacheStorageConnection>&&);
~DOMCache();

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

using RequestInfo = FetchRequest::Info;

using KeysPromise = DOMPromiseDeferred<IDLSequence<IDLInterface<FetchRequest>>>;
Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/Modules/cache/DOMCacheStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ class DOMCacheStorage : public RefCounted<DOMCacheStorage>, public ActiveDOMObje
static Ref<DOMCacheStorage> create(ScriptExecutionContext&, Ref<CacheStorageConnection>&&);
~DOMCacheStorage();

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

using KeysPromise = DOMPromiseDeferred<IDLSequence<IDLDOMString>>;

void match(DOMCache::RequestInfo&&, MultiCacheQueryOptions&&, Ref<DeferredPromise>&&);
Expand Down
5 changes: 3 additions & 2 deletions Source/WebCore/Modules/cookie-store/CookieStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ class CookieStore final : public RefCounted<CookieStore>, public EventTarget, pu
void remove(String&& name, Ref<DeferredPromise>&&);
void remove(CookieStoreDeleteOptions&&, Ref<DeferredPromise>&&);

using RefCounted::ref;
using RefCounted::deref;
// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

using EventTarget::weakPtrFactory;
using EventTarget::WeakValueType;
Expand Down
6 changes: 4 additions & 2 deletions Source/WebCore/Modules/encryptedmedia/MediaKeySession.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ class MediaKeySession final : public RefCounted<MediaKeySession>, public EventTa
using CDMInstanceSessionClient::weakPtrFactory;
using CDMInstanceSessionClient::WeakValueType;
using CDMInstanceSessionClient::WeakPtrImplType;
using RefCounted<MediaKeySession>::ref;
using RefCounted<MediaKeySession>::deref;

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

bool isClosed() const { return m_closed; }

Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class MediaKeySystemAccess : public RefCounted<MediaKeySystemAccess>, public Can
static Ref<MediaKeySystemAccess> create(Document&, const String& keySystem, MediaKeySystemConfiguration&&, Ref<CDM>&&);
~MediaKeySystemAccess();

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

const String& keySystem() const { return m_keySystem; }
const MediaKeySystemConfiguration& getConfiguration() const { return *m_configuration; }
void createMediaKeys(Document&, Ref<DeferredPromise>&&);
Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/Modules/encryptedmedia/MediaKeySystemRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class MediaKeySystemRequest : public RefCounted<MediaKeySystemRequest>, public A
WEBCORE_EXPORT static Ref<MediaKeySystemRequest> create(Document&, const String& keySystem, Ref<DeferredPromise>&&);
virtual ~MediaKeySystemRequest();

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

void setAllowCallback(CompletionHandler<void(Ref<DeferredPromise>&&)>&& callback) { m_allowCompletionHandler = WTFMove(callback); }
WEBCORE_EXPORT void start();

Expand All @@ -62,6 +66,7 @@ class MediaKeySystemRequest : public RefCounted<MediaKeySystemRequest>, public A
private:
MediaKeySystemRequest(Document&, const String& keySystem, Ref<DeferredPromise>&&);

// ActiveDOMObject.
void stop() final;

String m_keySystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ class WebKitMediaKeySession final : public RefCounted<WebKitMediaKeySession>, pu
void generateKeyRequest(const String& mimeType, Ref<Uint8Array>&& initData);
RefPtr<ArrayBuffer> cachedKeyForKeyId(const String& keyId) const;

using RefCounted::ref;
using RefCounted::deref;
// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

private:
WebKitMediaKeySession(Document&, WebKitMediaKeys&, const String& keySystem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ class FileSystemDirectoryReader final : public ScriptWrappable, public ActiveDOM
WTF_MAKE_ISO_ALLOCATED(FileSystemDirectoryReader);
public:
static Ref<FileSystemDirectoryReader> create(ScriptExecutionContext&, FileSystemDirectoryEntry&);

~FileSystemDirectoryReader();

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

void readEntries(ScriptExecutionContext&, Ref<FileSystemEntriesCallback>&&, RefPtr<ErrorCallback>&&);

private:
Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/Modules/entriesapi/FileSystemEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class FileSystemEntry : public ScriptWrappable, public ActiveDOMObject, public R
public:
virtual ~FileSystemEntry();

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

virtual bool isFile() const { return false; }
virtual bool isDirectory() const { return false; }

Expand Down
6 changes: 5 additions & 1 deletion Source/WebCore/Modules/fetch/FetchBodyOwner.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ class FetchBodyOwner : public RefCounted<FetchBodyOwner>, public ActiveDOMObject

String contentType() const { return m_headers->fastGet(HTTPHeaderName::ContentType); }

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

protected:
FetchBodyOwner(ScriptExecutionContext*, std::optional<FetchBody>&&, Ref<FetchHeaders>&&);

Expand All @@ -92,7 +96,7 @@ class FetchBodyOwner : public RefCounted<FetchBodyOwner>, public ActiveDOMObject
void setBody(FetchBody&& body) { m_body = WTFMove(body); }
ExceptionOr<void> createReadableStream(JSC::JSGlobalObject&);

// ActiveDOMObject API
// ActiveDOMObject.
void stop() override;

void setDisturbed() { m_isDisturbed = true; }
Expand Down
5 changes: 4 additions & 1 deletion Source/WebCore/Modules/filesystemaccess/FileSystemHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class FileSystemHandle : public ActiveDOMObject, public ThreadSafeRefCountedAndC
public:
virtual ~FileSystemHandle();

void ref() const final { ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr::ref(); }
void deref() const final { ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr::deref(); }

enum class Kind : uint8_t {
File,
Directory
Expand All @@ -60,7 +63,7 @@ class FileSystemHandle : public ActiveDOMObject, public ThreadSafeRefCountedAndC
FileSystemStorageConnection& connection() { return m_connection.get(); }

private:
// ActiveDOMObject
// ActiveDOMObject.
void stop() final;

Kind m_kind { Kind::File };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class FileSystemSyncAccessHandle : public ActiveDOMObject, public RefCounted<Fil
static Ref<FileSystemSyncAccessHandle> create(ScriptExecutionContext&, FileSystemFileHandle&, FileSystemSyncAccessHandleIdentifier, FileHandle&&, uint64_t capacity);
~FileSystemSyncAccessHandle();

void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

ExceptionOr<void> truncate(unsigned long long size);
ExceptionOr<unsigned long long> getSize();
ExceptionOr<void> flush();
Expand All @@ -64,7 +67,7 @@ class FileSystemSyncAccessHandle : public ActiveDOMObject, public RefCounted<Fil
void closeInternal(ShouldNotifyBackend);
bool requestSpaceForWrite(uint64_t writeOffset, uint64_t writeLength);

// ActiveDOMObject
// ActiveDOMObject.
void stop() final;

Ref<FileSystemFileHandle> m_source;
Expand Down
3 changes: 3 additions & 0 deletions Source/WebCore/Modules/gamepad/GamepadHapticActuator.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class GamepadHapticActuator : public RefCounted<GamepadHapticActuator>, public A
static Ref<GamepadHapticActuator> create(Document*, Type, Gamepad&);
~GamepadHapticActuator();

void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

Type type() const { return m_type; }
bool canPlayEffectType(EffectType) const;
void playEffect(EffectType, GamepadEffectParameters&&, Ref<DeferredPromise>&&);
Expand Down
6 changes: 5 additions & 1 deletion Source/WebCore/Modules/geolocation/Geolocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class Geolocation final : public ScriptWrappable, public RefCounted<Geolocation>
static Ref<Geolocation> create(Navigator&);
WEBCORE_EXPORT ~Geolocation();

// ActiveDOMObject.
void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

WEBCORE_EXPORT void resetAllGeolocationPermission();
Document* document() const { return downcast<Document>(scriptExecutionContext()); }

Expand All @@ -83,7 +87,7 @@ class Geolocation final : public ScriptWrappable, public RefCounted<Geolocation>

GeolocationPosition* lastPosition();

// ActiveDOMObject
// ActiveDOMObject.
void stop() override;
void suspend(ReasonForSuspension) override;
void resume() override;
Expand Down
5 changes: 3 additions & 2 deletions Source/WebCore/Modules/indexeddb/IDBDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ class IDBDatabase final : public ThreadSafeRefCounted<IDBDatabase>, public Event
void refEventTarget() final { ThreadSafeRefCounted<IDBDatabase>::ref(); }
void derefEventTarget() final { ThreadSafeRefCounted<IDBDatabase>::deref(); }

using ThreadSafeRefCounted<IDBDatabase>::ref;
using ThreadSafeRefCounted<IDBDatabase>::deref;
// ActiveDOMObject.
void ref() const final { ThreadSafeRefCounted::ref(); }
void deref() const final { ThreadSafeRefCounted::deref(); }

IDBDatabaseInfo& info() { return m_info; }
IDBDatabaseConnectionIdentifier databaseConnectionIdentifier() const { return m_databaseConnectionIdentifier; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ class WEBCORE_EXPORT IDBDatabaseNameAndVersionRequest final : public ThreadSafeR

const IDBResourceIdentifier& resourceIdentifier() const;

using ThreadSafeRefCounted<IDBDatabaseNameAndVersionRequest>::ref;
using ThreadSafeRefCounted<IDBDatabaseNameAndVersionRequest>::deref;
// ActiveDOMObject.
void ref() const final { ThreadSafeRefCounted::ref(); }
void deref() const final { ThreadSafeRefCounted::deref(); }

void complete(std::optional<Vector<IDBDatabaseNameAndVersion>>&&);

Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/Modules/indexeddb/IDBIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,12 @@ void IDBIndex::markAsDeleted()
m_deleted = true;
}

void IDBIndex::ref()
void IDBIndex::ref() const
{
m_objectStore.ref();
}

void IDBIndex::deref()
void IDBIndex::deref() const
{
m_objectStore.deref();
}
Expand Down
5 changes: 3 additions & 2 deletions Source/WebCore/Modules/indexeddb/IDBIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ class IDBIndex final : public ActiveDOMObject {
void markAsDeleted();
bool isDeleted() const { return m_deleted; }

void ref();
void deref();
// ActiveDOMObject.
void ref() const final;
void deref() const final;

WebCoreOpaqueRoot opaqueRoot();

Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,12 +762,12 @@ void IDBObjectStore::renameReferencedIndex(IDBIndex& index, const String& newNam
m_referencedIndexes.set(newName, m_referencedIndexes.take(index.info().name()));
}

void IDBObjectStore::ref()
void IDBObjectStore::ref() const
{
m_transaction.ref();
}

void IDBObjectStore::deref()
void IDBObjectStore::deref() const
{
m_transaction.deref();
}
Expand Down
5 changes: 3 additions & 2 deletions Source/WebCore/Modules/indexeddb/IDBObjectStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ class IDBObjectStore final : public ActiveDOMObject {

void rollbackForVersionChangeAbort();

void ref();
void deref();
// ActiveDOMObject.
void ref() const final;
void deref() const final;

template<typename Visitor> void visitReferencedIndexes(Visitor&) const;
void renameReferencedIndex(IDBIndex&, const String& newName);
Expand Down
5 changes: 3 additions & 2 deletions Source/WebCore/Modules/indexeddb/IDBRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ class IDBRequest : public EventTarget, public IDBActiveDOMObject, public ThreadS

ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }

using ThreadSafeRefCounted::ref;
using ThreadSafeRefCounted::deref;
// ActiveDOMObject.
void ref() const final { ThreadSafeRefCounted::ref(); }
void deref() const final { ThreadSafeRefCounted::deref(); }

void completeRequestAndDispatchEvent(const IDBResultData&);

Expand Down
5 changes: 2 additions & 3 deletions Source/WebCore/Modules/indexeddb/IDBTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ class IDBTransaction final : public ThreadSafeRefCounted<IDBTransaction>, public
using EventTarget::dispatchEvent;
void dispatchEvent(Event&) final;

using ThreadSafeRefCounted<IDBTransaction>::ref;
using ThreadSafeRefCounted<IDBTransaction>::deref;

const IDBTransactionInfo& info() const { return m_info; }
IDBDatabase& database() { return m_database.get(); }
const IDBDatabase& database() const { return m_database.get(); }
Expand Down Expand Up @@ -156,6 +153,8 @@ class IDBTransaction final : public ThreadSafeRefCounted<IDBTransaction>, public

// ActiveDOMObject.
void stop() final;
void ref() const final { ThreadSafeRefCounted::ref(); }
void deref() const final { ThreadSafeRefCounted::deref(); }

private:
IDBTransaction(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest*);
Expand Down
Loading

0 comments on commit 838fda3

Please sign in to comment.