Can we add a presubmit that prevents new usage of the macro?
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.
I see removal of GetNext() as the highest priority work item here, and it actually looks relatively easy. Codesearch sees fewer than 70 references to it as of now, and I doubt there are that many more in platform-specific code.Once we do get rid of GetNext(), we can remove FOR_EACH_OBSERVER instances more gradually (sharding this work out would probably help expedite it; each individual instance is pretty easy to fix up, but fixing 2000 instances by yourself probably isn't so fun).
On Wed, Oct 12, 2016 at 9:19 AM Anatoly Pilikov <zve...@yandex-team.ru> wrote:Hello guys!The suggestion to replace old macro with plain for-loop seems weird to me because:1. someone has to compact list after notification is finished (doesn't matter how many nested notifications we have) because there could be observers that have left the list as the result of a notification.
The compaction still happens during the destruction of the outermost ObserverList::Iter.
2. someone has to check if an observer is null in the list. It can be null because a notification can result in removing some of the observers out of the list while it is being looped.
ObserverList::Iter::operator++ knows to skip nulled out elements when advancing: it's no different from GetNext() in this respect.
Plain for-loop does none of these. Am I missing something?
Under the hood, a range-based for loop generates code that is equivalent to using ObserverList::Iter, so we get the correct behaviors.Daniel
Hello guys!The suggestion to replace old macro with plain for-loop seems weird to me because:1. someone has to compact list after notification is finished (doesn't matter how many nested notifications we have) because there could be observers that have left the list as the result of a notification.
2. someone has to check if an observer is null in the list. It can be null because a notification can result in removing some of the observers out of the list while it is being looped.
Plain for-loop does none of these. Am I missing something?