mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
LibWeb/IndexedDB: Remove spin_until from waiting for connection closure
This commit is contained in:
committed by
Andreas Kling
parent
e6dc52a52b
commit
52b53e52fb
Notes:
github-actions[bot]
2025-10-08 15:26:38 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/52b53e52fb9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6182
42
Libraries/LibWeb/IndexedDB/Internal/IDBDatabaseObserver.h
Normal file
42
Libraries/LibWeb/IndexedDB/Internal/IDBDatabaseObserver.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <LibWeb/IndexedDB/ConnectionState.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
class IDBDatabaseObserver final : public GC::Cell {
|
||||
GC_CELL(IDBDatabaseObserver, GC::Cell);
|
||||
GC_DECLARE_ALLOCATOR(IDBDatabaseObserver);
|
||||
|
||||
public:
|
||||
virtual ~IDBDatabaseObserver();
|
||||
|
||||
[[nodiscard]] GC::Ptr<GC::Function<void()>> connection_state_changed_observer() const { return m_connection_state_changed_observer; }
|
||||
void set_connection_state_changed_observer(GC::Ptr<GC::Function<void()>> callback) { m_connection_state_changed_observer = callback; }
|
||||
|
||||
GC::Ref<IDBDatabase> database() const { return m_database; }
|
||||
|
||||
void unobserve();
|
||||
|
||||
private:
|
||||
explicit IDBDatabaseObserver(IDBDatabase&);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual void finalize() override;
|
||||
|
||||
bool m_observing { false };
|
||||
|
||||
GC::Ref<IDBDatabase> m_database;
|
||||
GC::Ptr<GC::Function<void()>> m_connection_state_changed_observer;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user