mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 00:02:37 +00:00

This patch adds smart pointers to be used for initializing objects as C++11 "magic statics" -- that is, they are able to take advantage of C++11's guarantee of thread safety during initialization by atomically constructing both the smart pointer itself as well as the object being pointed to. Unlike Static{Auto,Ref}Ptr, they have non-trivial constructors, though they must still have trivial destructors to prevent emission of atexit calls. The new classes use the new `MOZ_STATIC_LOCAL_CLASS` annotation which ensures their instantiations are static locals and prevents non-trivial destructors. Differential Revision: https://phabricator.services.mozilla.com/D40092 --HG-- rename : xpcom/base/StaticPtr.h => xpcom/base/StaticLocalPtr.h extra : moz-landing-system : lando