--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/e438ba58-f551-43c8-93e3-18636383ca01n%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CACwGi-6YR2s9-caOjugw-dx2%2BkNCzuuY%3DWPpWEyyvvTxHhzGtQ%40mail.gmail.com.
--
There's a base::BarrierCallback that takes a configurable number of invocations before the "done" callback is invoked. Is that what you had in mind?
base::BarrierCallback is a bit different -- its purpose is to accumulate the vector of parameters for all callback invocations and then run the underlying OnceCallback passing this vector as an argument, so it's limited to void(T) signatures.
On Thursday, June 2, 2022 at 8:56:49 PM UTC+2 km...@chromium.org wrote:There's a base::BarrierCallback that takes a configurable number of invocations before the "done" callback is invoked. Is that what you had in mind?Moving to OnceCallback or using SplitOnceCallback is great (some of the existing cases can definitely be solved this way), but how would it work in case of an unknown amount of receivers? Say, something like this (there's one more BindRepeating down the call chain to make things even more complicated).
--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/587d929d-0296-48d9-b49a-b2b93d22a026n%40chromium.org.
BarrierClosure is also a bit different since it only works for void() signatures, or am I missing something? I'm basically looking for a BarrierClosure that is compatible with void(Args...).
The link is not about if/else -- I was trying to show an example of a function (CloseAllBrowsersWithProfile in this case) that takes a RepeatingCallback with base::Passed (line 1170) and broadcasts it to multiple receivers (only one of which is supposed to invoke it). This particular callback ends up here and cannot be replaced with a OnceCallback according to the description.
My idea was to have something like this (pretty much like you wrote, but with some syntax sugar).
I don't own the example that we're currently discussing -- it's something that I found on codesearch :) My point was that simply replacing base::RepeatingCallback + base::Passed with base::OnceCallback that gets split every time is dangerous (since there might be other scenarios/settings for the same function where the callback can be invoked multiple times, who knows?)
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/7d567b8d-4a04-4a94-a10a-df2641e52d31n%40chromium.org.