refactor: DebugCount (#6753)

Reviewed-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
Reviewed-by: Nerixyz <nerixdev@outlook.de>
This commit is contained in:
Mm2PL
2026-01-28 11:37:06 +01:00
committed by GitHub
parent b69ab9315f
commit 60ecf1a8d7
25 changed files with 198 additions and 129 deletions
@@ -105,7 +105,7 @@ protected:
}
qCDebug(chatterinoLiveupdates) << "Subscribing to" << subscription;
DebugCount::increase("LiveUpdates subscriptions");
DebugCount::increase(DebugObject::LiveUpdatesSubscription);
QByteArray encoded =
static_cast<Derived *>(this)->encodeSubscription(subscription);
@@ -126,7 +126,7 @@ protected:
}
qCDebug(chatterinoLiveupdates) << "Unsubscribing from" << subscription;
DebugCount::decrease("LiveUpdates subscriptions");
DebugCount::decrease(DebugObject::LiveUpdatesSubscription);
QByteArray encoded =
static_cast<Derived *>(this)->encodeUnsubscription(subscription);
@@ -129,7 +129,7 @@ protected:
this->addClient();
this->pendingSubscriptions_.emplace_back(subscription);
DebugCount::increase("LiveUpdates subscription backlog");
DebugCount::increase(DebugObject::LiveUpdatesSubscriptionBacklog);
}
const std::unordered_map<size_t, std::shared_ptr<Client>> &clients() const
@@ -147,7 +147,7 @@ private:
{
assertInGuiThread();
DebugCount::increase("LiveUpdates connections");
DebugCount::increase(DebugObject::LiveUpdatesConnection);
this->addingClient_ = false;
this->diag.connectionsOpened.fetch_add(1, std::memory_order_acq_rel);
@@ -173,7 +173,7 @@ private:
this->pendingSubscriptions_.emplace_back(std::move(last));
break;
}
DebugCount::decrease("LiveUpdates subscription backlog");
DebugCount::decrease(DebugObject::LiveUpdatesSubscriptionBacklog);
pendingSubsToTake--;
}
@@ -200,7 +200,7 @@ private:
return;
}
DebugCount::decrease("LiveUpdates connections");
DebugCount::decrease(DebugObject::LiveUpdatesConnection);
qCDebug(chatterinoLiveupdates) << "Connection" << id << "closed";
auto subs = std::move(it->second->subscriptions_);
@@ -228,7 +228,7 @@ private:
qCWarning(chatterinoLiveupdates)
<< "Retrying after" << id << "failed";
auto nSubs = subs.size();
DebugCount::increase("LiveUpdates subscription backlog",
DebugCount::increase(DebugObject::LiveUpdatesSubscriptionBacklog,
static_cast<int64_t>(nSubs));
this->pendingSubscriptions_.insert(
this->pendingSubscriptions_.end(),