refactor: KeyWeakMap cleanup (#41242)

* refactor: make KeyWeakMap::KeyObject private

* perf: avoid redundant map lookup

* refactor: remove unused KeyWeakMap::Has()

* refactor: make KeyWeakMap dtor nonvirtual

no inheritance used, so no need for virtual dtor?

* chore: fix KeyWeakMap code comment

* refactor: use if statement in KeyWeakMap::Get()

* refactor: use better variable names in KeyWeakMap::Values()
This commit is contained in:
Charles Kerr 2024-02-06 09:18:05 -06:00 committed by GitHub
parent 768ece6b54
commit 5686f88bd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 21 deletions

View file

@ -107,7 +107,7 @@ class TrackableObject : public TrackableObjectBase, public EventEmitter<T> {
// Removes this instance from the weak map.
void RemoveFromWeakMap() {
if (weak_map_ && weak_map_->Has(weak_map_id()))
if (weak_map_)
weak_map_->Remove(weak_map_id());
}