Open Bug 1028264 Opened 10 years ago Updated 8 months ago

Add MOZ_INLINE_DECL_REFCOUNTING and MOZ_INLINE_DECL_THREADSAFE_REFCOUNTING to RefPtr.h and replace the usages of RefCounted with those

Categories

(Core :: MFBT, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: ehsan.akhgari, Unassigned)

References

Details

I'm thinking of making those macros fall back to the NS_ versions inside libxul and provide an identical version outside of it, and try to remove RefCounted by replacing the remaining usages with those macros.

I think I'm going to focus on the mozglue/mozalloc consumers first, and then try to figure out the mozglue ones.

What do you all think about this plan?
Blocks: 991812
After bug 1097740 lands, it looks like we have RefCounted<> usage fairly well contained:

- gfx/2d/ contains a few uses, along with a lone use in gfx/gl/SharedSurface.h;
- mozglue/linker/ uses it, and even specializes RefCounted<>, which sounds hard to do with macros;
- memory/mozalloc/VolatileBuffer.h;
- and the few references to it in MFBT itself, notably WeakPtr.

I would like to understand the uses in gfx/ better; does the standalone Moz2D build pull in the MFBT headers, too?  Or does it do something different?

If we can figure out how to make the usages in gfx/ more-or-less self-contained, I think sticking RefCounted<> in mozilla::detail:: is sufficient for the few remaining consumers, and will ideally serve as enough of a deterrent for future would-be refcounters.
Flags: needinfo?(jmuizelaar)
(In reply to Nathan Froyd (:froydnj) from comment #1)
> 
> I would like to understand the uses in gfx/ better; does the standalone
> Moz2D build pull in the MFBT headers, too?  Or does it do something
> different?

Yes it pulls in MFBT headers.
Flags: needinfo?(jmuizelaar)
Blocks: 1148204
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.