This is the same basic idea as NS_IMPL_RELEASE_WITH_DESTROY. I need
this because I am making XPCNativeInterface refcounted, and it uses
some weird placement new stuff requiring a special function to
deallocate the object. (It does this to store an array of arbitrary
length inline, presumably for some sort of time or space reason.)
MozReview-Commit-ID: 5I7BgY6YlLl
mozilla::function involves an allocation of the FunctionImpl type, that we can
avoid rather easily in this case.
This commit is completely optional, I guess, though the code we're using
RemoveElementsBy with the previous patch is sort of hot.
MozReview-Commit-ID: 2LoQs4cB28X
The standard placement new function is declared to not throw, which
means that, per spec, a null check on its result is required. There are
a number of places throughout xpcom/ where we know that we are passing
non-null pointers to placement new (and receiving them as a return
value), and we are therefore doing useless work performing these null
checks.
Therefore, we should be using an operator new overload that doesn't
require the null check. MFBT has just such an overload, so use that.
Slightly less than half (93 / 210) of the NS_METHOD instances in the codebase
are because of the use of NS_CALLBACK in
nsI{Input,Output,UnicharInput},Stream.idl. The use of __stdcall on Win32 isn't
important for these callbacks because they are only used as arguments to
[noscript] methods.
This patch converts them to vanilla |nsresult| functions. It increases the size
of xul.dll by about ~600 bytes, which is about 0.001%.
--HG--
extra : rebase_source : c15d85298e0975fd030cd8f8f8e54501f453959b
This patch adds an assertion that makes sure that the nsCategoryManager is
destroyed after the nsMemoryReporterManager, because bad things would happen
otherwise.
Also, nsCategoryManager uses manual memory management (it's AddRef/Release are
hardwired to always return 2 and 1 respectively) so it doesn't matter if we
register it as a strong or weak memory reporter. But it's more common to use
RegisterWeakMemoryReporter when the argument is |this|, so this patch does
that.
--HG--
extra : rebase_source : 4ca33404d4c6f2b271e1ad008ea1a9a79f3ef666
This patch makes the following changes on many in-class methods.
- NS_METHOD F() override; --> NS_IMETHOD F() override;
- NS_METHOD F() override {...} --> NS_IMETHOD F() override {...}
- NS_METHOD F() final; --> NS_IMETHOD F() final;
- NS_METHOD F() final {...} --> NS_IMETHOD F() final {...}
Using NS_IMETHOD is the preferred way of marking in-class virtual methods.
Although these transformations add an explicit |virtual|, they are safe --
there's an implicit |virtual| anyway because |override| and |final| only work
with virtual methods.
--HG--
extra : rebase_source : 3010fade82a170eab7f13d81bf61b02cd693f3cf
This patch makes the following changes on many in-class methods.
- NS_IMETHODIMP F() override; --> NS_IMETHOD F() override;
- NS_IMETHODIMP F() override {...} --> NS_IMETHOD F() override {...}
- NS_IMETHODIMP F() final; --> NS_IMETHOD F() final;
- NS_IMETHODIMP F() final {...} --> NS_IMETHOD F() final {...}
Using NS_IMETHOD is the preferred way of marking in-class virtual methods.
Although these transformations add an explicit |virtual|, they are safe --
there's an implicit |virtual| anyway because |override| and |final| only work
with virtual methods.
--HG--
extra : rebase_source : 386ee4e4ea2ecd8d5001efabc3ac87b4d6c0659f
This patch makes most Run() declarations in subclasses of nsIRunnable have the
same form: |NS_IMETHOD Run() override|.
As a result of these changes, I had to add |override| to a couple of other
functions to satisfy clang's -Winconsistent-missing-override warning.
--HG--
extra : rebase_source : 815d0018b0b13329bb5698c410f500dddcc3ee12
NS_OBJC_{BEGIN,END}_TRY_LOGONLY_BLOCK{,RETURN} are identical to
NS_OBJC_{BEGIN,END}_TRY_ABORT_BLOCK{,RETURN}. This patch removes the LOGONLY
versions in favour of the ABORT versions.
--HG--
extra : rebase_source : 4537de8986b87784d2a80ead24999310adbdece8