mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +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
45
Libraries/LibWeb/IndexedDB/Internal/IDBDatabaseObserver.cpp
Normal file
45
Libraries/LibWeb/IndexedDB/Internal/IDBDatabaseObserver.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/IndexedDB/IDBDatabase.h>
|
||||
#include <LibWeb/IndexedDB/Internal/IDBDatabaseObserver.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(IDBDatabaseObserver);
|
||||
|
||||
IDBDatabaseObserver::IDBDatabaseObserver(IDBDatabase& database)
|
||||
: m_database(database)
|
||||
{
|
||||
m_database->register_database_observer({}, *this);
|
||||
m_observing = true;
|
||||
}
|
||||
|
||||
IDBDatabaseObserver::~IDBDatabaseObserver() = default;
|
||||
|
||||
void IDBDatabaseObserver::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_database);
|
||||
visitor.visit(m_connection_state_changed_observer);
|
||||
}
|
||||
|
||||
void IDBDatabaseObserver::finalize()
|
||||
{
|
||||
Base::finalize();
|
||||
unobserve();
|
||||
}
|
||||
|
||||
void IDBDatabaseObserver::unobserve()
|
||||
{
|
||||
if (!m_observing)
|
||||
return;
|
||||
|
||||
m_database->unregister_database_observer({}, *this);
|
||||
m_observing = false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user