Hi chromium-dev,
I'm investigating a
crash and the debugging so far points to my misunderstanding base::Bind behavior w.r.t. refcounting.
docs/callback.md gives a few examples implying that parameters are retained if caller and callee use scoped_refptrs and to use base::RetainedRef if the callee takes a raw ptr. However, the documentation doesn't say anything about when the callee expects a scoped_refptr and the caller provides a raw ptr.
Is the object retained in these cases? Is the behavior different if the parameter is allocated in place using operator new (because ref counted classes start with ref count 1)?
In the context of the bug, MediaGpuChannel passes a raw MediaGpuChannelMessageFilter ptr to GpuChannel::AddChannel which posts a task to GpuChannelMessageFilter::AddChannelFilter which expects a scoped_refptr. The crash started happening after a
change I made, before that the call was AddChannel(new MediaGpuChannelMessageFilter...).
More details are in the linked bug. Thanks for any help!
- Sunny