Commit 8bc2746e authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Chromium LUCI CQ

Migrate might_have_observer to empty in net and blink

Bug: 1155308
Change-Id: Ida2d8011c7a7d1ac14aff806d084e524e46d2bd8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628930Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843974}
parent fb7bbce6
......@@ -377,7 +377,7 @@ void MDnsClientImpl::Core::RemoveListener(MDnsListenerImpl* listener) {
observer_list_iterator->second->RemoveObserver(listener);
// Remove the observer list from the map if it is empty
if (!observer_list_iterator->second->might_have_observers()) {
if (observer_list_iterator->second->empty()) {
// Schedule the actual removal for later in case the listener removal
// happens while iterating over the observer list.
base::ThreadTaskRunnerHandle::Get()->PostTask(
......@@ -388,7 +388,7 @@ void MDnsClientImpl::Core::RemoveListener(MDnsListenerImpl* listener) {
void MDnsClientImpl::Core::CleanupObserverList(const ListenerKey& key) {
auto found = listeners_.find(key);
if (found != listeners_.end() && !found->second->might_have_observers()) {
if (found != listeners_.end() && found->second->empty()) {
listeners_.erase(found);
}
}
......
......@@ -79,7 +79,7 @@ void MemoryUsageMonitor::TimerFired() {
MemoryUsage usage = GetCurrentMemoryUsage();
for (auto& observer : observers_)
observer.OnMemoryPing(usage);
if (!observers_.might_have_observers())
if (observers_.empty())
StopMonitoring();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment