gecko-dev/xpcom/docs
Andrew McCreight ba8af7f4fa Bug 1792920, part 4 - Add special handling for MozExternalRefCountType to XPIDL. r=nika
In XPIDL, the return type of AddRef and Release are nsrefcnt, which
is defined as unsigned long. The first problem is that nsrefcnt is
defined in XPIDL as unsigned long, but in C++ as uintptr_t. The second
problem is that the actual return type of these methods in C++ is
MozExternalRefCountType.

This patch fixes the return type of these methods in XPIDL. However,
due to MSCOM compatibility requirements this type is not expressible
in XPIDL, so I added it as a new builtin type to XPIDL. In C++, it
defers to the typedef and for Rust it uses u32 directly. I tried
using the new Rust typedef I defined in refptr.rs, but it seemed like
it was being used in places that didn't have refptr.rs available.

I also deleted the incorrect definition of nsrefcnt in XPIDL. It is
not used anywhere else in XPIDL files, and my previous patches removed
all uses of this type definition from Rust.

Note that this patch does not really change nsISupports.h,
because this part of the file is ignored via an #if 0. However, this
patch does clear the way for further work to start using the auto
generated nsISupports.h instead of nsISupportsBase.h.

Differential Revision: https://phabricator.services.mozilla.com/D159323
2022-10-17 16:09:21 +00:00
..
collections.rst
hashtables_detailed.rst
hashtables.rst
huntingleaks.rst
index.rst
logging.rst
refptr.rst
stringguide.rst
thread-safety.rst
writing-xpcom-interface.rst
xpidl.rst Bug 1792920, part 4 - Add special handling for MozExternalRefCountType to XPIDL. r=nika 2022-10-17 16:09:21 +00:00