mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb/IndexedDB: Remove spin_until from checking finished transactions
This commit is contained in:
committed by
Andreas Kling
parent
52b53e52fb
commit
d87c2a55b0
Notes:
github-actions[bot]
2025-10-08 15:26:31 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/d87c2a55b00 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6182
41
Libraries/LibWeb/IndexedDB/Internal/IDBTransactionObserver.h
Normal file
41
Libraries/LibWeb/IndexedDB/Internal/IDBTransactionObserver.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGC/Cell.h>
|
||||
#include <LibGC/CellAllocator.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
class IDBTransactionObserver final : public GC::Cell {
|
||||
GC_CELL(IDBTransactionObserver, GC::Cell);
|
||||
GC_DECLARE_ALLOCATOR(IDBTransactionObserver);
|
||||
|
||||
public:
|
||||
virtual ~IDBTransactionObserver();
|
||||
|
||||
[[nodiscard]] GC::Ptr<GC::Function<void()>> transaction_finished_observer() const { return m_transaction_finished_observer; }
|
||||
void set_transaction_finished_observer(GC::Ptr<GC::Function<void()>> callback) { m_transaction_finished_observer = callback; }
|
||||
|
||||
GC::Ref<IDBTransaction> transaction() const { return m_transaction; }
|
||||
|
||||
void unobserve();
|
||||
|
||||
private:
|
||||
explicit IDBTransactionObserver(IDBTransaction&);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual void finalize() override;
|
||||
|
||||
bool m_observing { false };
|
||||
|
||||
GC::Ref<IDBTransaction> m_transaction;
|
||||
GC::Ptr<GC::Function<void()>> m_transaction_finished_observer;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user