Bug 1877242 - Use a FunctionRef in CanonicalBrowsingContext::CallOnAllTopDescendants. r=nika

This should be marginally more efficient, in theory, so do it drive-by.

Differential Revision: https://phabricator.services.mozilla.com/D199902
This commit is contained in:
Emilio Cobos Álvarez 2024-01-30 23:24:44 +00:00
Родитель cce5bdd802
Коммит f26fefccfa
2 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -818,8 +818,7 @@ RefPtr<PrintPromise> CanonicalBrowsingContext::Print(
}
void CanonicalBrowsingContext::CallOnAllTopDescendants(
const std::function<mozilla::CallState(CanonicalBrowsingContext*)>&
aCallback) {
const FunctionRef<CallState(CanonicalBrowsingContext*)>& aCallback) {
MOZ_ASSERT(IsChrome(), "Should only call in chrome BC");
MOZ_ASSERT(!GetParentCrossChromeBoundary(),
"Should only call on top chrome BC");

Просмотреть файл

@ -140,11 +140,9 @@ class CanonicalBrowsingContext final : public BrowsingContext {
ErrorResult&);
// Call the given callback on all top-level descendant BrowsingContexts.
// Return Callstate::Stop from the callback to stop calling
// further children.
// Return Callstate::Stop from the callback to stop calling further children.
void CallOnAllTopDescendants(
const std::function<mozilla::CallState(CanonicalBrowsingContext*)>&
aCallback);
const FunctionRef<CallState(CanonicalBrowsingContext*)>& aCallback);
void SessionHistoryCommit(uint64_t aLoadId, const nsID& aChangeID,
uint32_t aLoadType, bool aPersist,