Граф коммитов

117 Коммитов

Автор SHA1 Сообщение Дата
André Bargull 14ca007916 Bug 1625138 - Part 41: Remove no longer needed includes for mozilla/TypeTraits. r=froydnj
Also adds missing includes in some files, these were previously only transivitely
included through mozilla/TypeTraits.h.

Differential Revision: https://phabricator.services.mozilla.com/D68561

--HG--
extra : moz-landing-system : lando
2020-03-28 16:00:09 +00:00
André Bargull f70fd1c1bd Bug 1625138 - Part 37: Replace mozilla::IsSame with std::is_same in xpcom/. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68556

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:21 +00:00
André Bargull 42d4ebbda9 Bug 1625138 - Part 27: Replace mozilla::DeclVal with std::declval. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68545

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:18 +00:00
André Bargull d53798e749 Bug 1625138 - Part 23: Replace mozilla::RemovePointer with std::remove_pointer. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68378

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:17 +00:00
Simon Giesecke b50347f917 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-13 14:38:48 +00:00
Simon Giesecke 66fbc01dac Bug 1611415 - Make nsCOMPtr, StaticRefPtr and OwningNonNull constructible/assignable from RefPtr<U>&& without needing to go through already_AddRefed. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D60979

--HG--
extra : moz-landing-system : lando
2020-02-03 07:29:10 +00:00
Emilio Cobos Álvarez 256c124f94 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
This was done by:

This was done by applying:

```
diff --git a/python/mozbuild/mozbuild/code-analysis/mach_commands.py b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
index 789affde7bbf..fe33c4c7d4d1 100644
--- a/python/mozbuild/mozbuild/code-analysis/mach_commands.py
+++ b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
@@ -2007,7 +2007,7 @@ class StaticAnalysis(MachCommandBase):
         from subprocess import Popen, PIPE, check_output, CalledProcessError

         diff_process = Popen(self._get_clang_format_diff_command(commit), stdout=PIPE)
-        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format]
+        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format, '-sort-includes']

         if not output_file:
             args.append("-i")
```

Then running `./mach clang-format -c <commit-hash>`

Then undoing that patch.

Then running check_spidermonkey_style.py --fixup

Then running `./mach clang-format`

I had to fix four things:

 * I needed to move <utility> back down in GuardObjects.h because I was hitting
   obscure problems with our system include wrappers like this:

0:03.94 /usr/include/stdlib.h:550:14: error: exception specification in declaration does not match previous declaration
0:03.94 extern void *realloc (void *__ptr, size_t __size)
0:03.94              ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/malloc_decls.h:53:1: note: previous declaration is here
0:03.94 MALLOC_DECL(realloc, void*, void*, size_t)
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozilla/mozalloc.h:22:32: note: expanded from macro 'MALLOC_DECL'
0:03.94     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
0:03.94                                ^
0:03.94 <scratch space>:178:1: note: expanded from here
0:03.94 realloc_impl
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozmemory_wrap.h:142:41: note: expanded from macro 'realloc_impl'
0:03.94 #define realloc_impl mozmem_malloc_impl(realloc)

   Which I really didn't feel like digging into.

 * I had to restore the order of TrustOverrideUtils.h and related files in nss
   because the .inc files depend on TrustOverrideUtils.h being included earlier.

 * I had to add a missing include to RollingNumber.h

 * Also had to partially restore include order in JsepSessionImpl.cpp to avoid
   some -WError issues due to some static inline functions being defined in a
   header but not used in the rest of the compilation unit.

Differential Revision: https://phabricator.services.mozilla.com/D60327

--HG--
extra : moz-landing-system : lando
2020-01-20 16:19:48 +00:00
Emilio Cobos Álvarez aa3a695712 Bug 1609996 - Remove mozilla/Move.h. r=froydnj
rg -l 'mozilla/Move.h' | xargs sed -i 's/#include "mozilla\/Move.h"/#include <utility>/g'

Further manual fixups and cleanups to the include order incoming.

Differential Revision: https://phabricator.services.mozilla.com/D60323

--HG--
extra : moz-landing-system : lando
2020-01-20 16:18:20 +00:00
Emilio Cobos Álvarez e363a41bd4 Bug 1607595 - Remove uses of mozilla::IsBaseOf. r=froydnj
Automatically generated by:

$ rg 'IsBaseOf<' | cut -d : -f 1 | xargs sed -i 's/mozilla::IsBaseOf</std::is_base_of</g'
$ rg 'IsBaseOf<' | cut -d : -f 1 | xargs sed -i 's/IsBaseOf</std::is_base_of</g

Differential Revision: https://phabricator.services.mozilla.com/D59013

--HG--
extra : moz-landing-system : lando
2020-01-08 14:52:10 +00:00
Dave Townsend 3dc26d41d2 Bug 1540854: Add MOZ_DBG support for nsIURI and nsIFile. r=froydnj
I am 90% sure that this is wrong but this is the only way I can get it to
compile and work. Unlike other examples of supporting MOZ_DBG it only declares
an operator for `nsIURI* not` `const nsIURI`. I had to drop the const because
then I couldn't call GetSpec as it isn't marked const. I had to switch to a
pointer since otherwise it would complain about virtual methods.

Still in practice this works, I think it is rare that we hold an nsIURI in
anything other than a pointer and same for the constness.

Differential Revision: https://phabricator.services.mozilla.com/D25669

--HG--
extra : rebase_source : 9760674375563ec312568caf4a5ad46facfb6f68
2019-04-01 15:05:37 -07:00
Cameron McCormack eedb6aebd4 Bug 1538081 - Part 3: Add operator<<(ostream&) definitions for a few common types. r=froydnj,gerald
Depends on D25023

Differential Revision: https://phabricator.services.mozilla.com/D25024

--HG--
extra : moz-landing-system : lando
2019-03-30 04:26:26 +00:00
Ciure Andrei 615006146b Backed out 4 changesets (bug 1538081) for causing BaseElf.cpp bustages CLOSED TREE
Backed out changeset ced61a86c74c (bug 1538081)
Backed out changeset d6d331abbf0e (bug 1538081)
Backed out changeset 26df801e44db (bug 1538081)
Backed out changeset 113ac188a69e (bug 1538081)
2019-03-30 03:02:15 +02:00
Cameron McCormack 91e3ec9952 Bug 1538081 - Part 3: Add operator<<(ostream&) definitions for a few common types. r=froydnj,gerald
Depends on D25023

Differential Revision: https://phabricator.services.mozilla.com/D25024

--HG--
extra : moz-landing-system : lando
2019-03-30 00:21:24 +00:00
Boris Zbarsky 358e378b63 Bug 1505029. Teach our static analysis about nsCOMPtr<nsISupports> being a strong ref. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D23021

--HG--
extra : moz-landing-system : lando
2019-03-12 21:04:07 +00:00
Ehsan Akhgari e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Emilio Cobos Álvarez 4fd57b7de3 Bug 1516366 - Sprinkle some ToSupports around xpcom. r=froydnj
This will be needed for the next patches since the cast from nsIDocument* to
nsISupports* will become ambiguous, and I don't really want to replace all users
of nsCOMPtr<nsIDocument> with RefPtr.

We have ToSupports to handle this, so use it.

Differential Revision: https://phabricator.services.mozilla.com/D15350
2018-12-29 20:37:35 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Yaron Tausky 103bf1caae Bug 1508627: Remove dangerous assertion from nsCOMPtr r=froydnj
Move constructors and assignment operators are expected to be safe and
infallible. In debug mode, nsCOMPtr's move functions called a test function
that modified the pointee's refcount -- a potentially thread unsafe operation
that also opened the door to assertion failures if the pointee implemented
some access checks in AddRef() or Release(). This commit removes this function
call in those two functions.

Differential Revision: https://phabricator.services.mozilla.com/D12422

--HG--
extra : moz-landing-system : lando
2018-11-21 14:50:58 +00:00
Andrew McCreight 045d2cf847 Bug 1493226, part 2 - Statically prevent trivial calls to do_QueryInterface that returns an nsresult r=froydnj
This is the same as the other patch, except that it is applied to the
case where the QI returns an nsresult.

In addition, I marked the WithError helper class as being stack-only.

Depends on D7553

Differential Revision: https://phabricator.services.mozilla.com/D7554

--HG--
extra : moz-landing-system : lando
2018-10-04 19:16:30 +00:00
Andrew McCreight 8ed5b13669 Bug 1493226, part 1 - Statically prevent trivial calls to do_QueryInterface r=froydnj
This patch adds a static assert to enforce that do_QueryInterface is
not used to go from a class to a base class, because that can be done
more efficiently via a static_cast. This is done by putting the type
of the source into the nsQueryInterface type. Once that is done, it is
easy to check the source and destination type. This has to be done
carefully so that in non-DEBUG builds, where NSCAP_FEATURE_USE_BASE is
defined, we don't generate any additional code.

The first step is to rename nsQueryInterface to
nsQueryInterfaceISupports. In DEBUG builds, I then add a new subtype
nsQueryInterface<T>, where T is the type of the object we are going to
QI. This class is a thin wrapper around nsQueryInterfaceISupports that
only forwards operations to the base class.

The main bit of trickery here is PointedToType<T>, which is needed to
get the type parameter for nsQueryInterface. This dereferences the
type, gets the address of it, then does RemovePointer. This is needed
because a wide variety of pointer types are passed in to
do_QueryInterface, including RefPtr<>, nsCOMPtr<>, raw pointers, and
OwningNonNull<>. PointedToType<RefPtr<T>> is equal to T,
PointedToType<T*> is equal to T, and so on.

In NSCAP_FEATURE_USE_BASE builds (opt), we only use
nsQueryInterfaceISupports, but in debug builds we use
nsQueryInterface<> where possible. The latter is also used for the
nsCOMPtr<nsISupports> overload, because we can always QI to
nsISupports, because that is sometimes used for canonicalization.

Another gross bit is that Assert_NoQueryNeeded can no longer use
nsCOMPtr<>, because it works by QIing T to T, which is banned by the
static analysis. Instead I had to reimplement it by hand.

Depends on D7527

Differential Revision: https://phabricator.services.mozilla.com/D7553

--HG--
extra : moz-landing-system : lando
2018-10-04 19:16:28 +00:00
Andrew McCreight 3a3b45aaa6 Bug 1494765 - Allow assignment from an nsCOMPtr of a related type r=froydnj
This adds support for conversion from nsCOMPtr<A> to nsCOMPtr<B> when
A is a subclass of B. There's no reason to not allow this, and RefPtr
already supports this.

Differential Revision: https://phabricator.services.mozilla.com/D7226

--HG--
extra : moz-landing-system : lando
2018-10-02 00:54:16 +00:00
Narcis Beleuzu 9bf578bdbd Backed out changeset cb01170872de (bug 1494765) for bustages on nsCOMPtr.h. CLOSED TREE 2018-10-02 00:37:46 +03:00
Andrew McCreight 1f66326aad Bug 1494765 - Allow assignment from an nsCOMPtr of a related type r=froydnj
This adds support for conversion from nsCOMPtr<A> to nsCOMPtr<B> when
A is a subclass of B. There's no reason to not allow this, and RefPtr
already supports this.

Differential Revision: https://phabricator.services.mozilla.com/D7226

--HG--
extra : moz-landing-system : lando
2018-10-01 20:50:32 +00:00
Emilio Cobos Álvarez fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Nathan Froyd 075adc9ec6 Bug 1445584 - add a move assignment operator for nsCOMPtr; r=gerald
Somehow we didn't have this before.  The lack thereof was causing us to
do unnecessary things during event dispatch.
2018-03-14 08:22:30 -04:00
Kris Maglione b46bd8b6b0 Bug 1411817: Add do_AddRef overloads for nsCOMPtr<T> and nsRevocableEventPtr<T>. r=froydnj
MozReview-Commit-ID: gEU7whtNHc

--HG--
extra : rebase_source : 6763e6b31be8a3341f968eef057b756fbfe3cbbe
extra : amend_source : da6140fb0559d78b46e80e72e8b6768bf2364fb1
2017-10-25 19:46:50 -07:00
Nathan Froyd c5fa35746e Bug 1390568 - manually de-virtualize do_QueryReferent; r=ehsan
nsQueryReferent is defined as an nsCOMPtr_helper, which implies that
calling its operator() method requires a virtual call.  While
nsQueryReferent is marked `final`, compiler inlining decisions make it
impossible to de-virtualize the call to operator().  However, we have
many other classes returned by do_* functions that nsCOMPtr handles
directly, requiring no extra virtual calls, and we can give
nsQueryReferent the same treatment.
2017-08-24 20:04:31 -04:00
Tristan Bourvon ba0998ae31 Bug 1380423 - Add static-analysis to enforce strict rules on functions which can run scripts. r=mystor
MozReview-Commit-ID: GGSyq0z5msB
2017-08-08 19:48:53 +03:00
Michael Layzell 46ade67ada Bug 1331434 - Part 2: Add MOZ_MAY_CALL_AFTER_MUST_RETURN and MOZ_MUST_RETURN_FROM_CALLER annotations, r=ehsan
MozReview-Commit-ID: 1o2egvdhkqT
2017-03-07 19:06:48 -05:00
Benjamin Smedberg d478e7c99f Bug 1332631 part B - file moves from xpcom/glue to xpcom/base, r=froydnj
MozReview-Commit-ID: ARS1aTugYjl

--HG--
rename : xpcom/glue/AutoRestore.h => xpcom/base/AutoRestore.h
rename : xpcom/glue/EnumeratedArrayCycleCollection.h => xpcom/base/EnumeratedArrayCycleCollection.h
rename : xpcom/glue/IntentionalCrash.h => xpcom/base/IntentionalCrash.h
rename : xpcom/glue/nsCOMPtr.cpp => xpcom/base/nsCOMPtr.cpp
rename : xpcom/glue/nsCOMPtr.h => xpcom/base/nsCOMPtr.h
rename : xpcom/glue/nsCRTGlue.cpp => xpcom/base/nsCRTGlue.cpp
rename : xpcom/glue/nsCRTGlue.h => xpcom/base/nsCRTGlue.h
rename : xpcom/glue/nsClassInfoImpl.cpp => xpcom/base/nsClassInfoImpl.cpp
rename : xpcom/glue/nsCycleCollectionNoteChild.h => xpcom/base/nsCycleCollectionNoteChild.h
rename : xpcom/glue/nsCycleCollectionNoteRootCallback.h => xpcom/base/nsCycleCollectionNoteRootCallback.h
rename : xpcom/glue/nsCycleCollectionParticipant.cpp => xpcom/base/nsCycleCollectionParticipant.cpp
rename : xpcom/glue/nsCycleCollectionParticipant.h => xpcom/base/nsCycleCollectionParticipant.h
rename : xpcom/glue/nsCycleCollectionTraversalCallback.h => xpcom/base/nsCycleCollectionTraversalCallback.h
rename : xpcom/glue/nsDebug.h => xpcom/base/nsDebug.h
rename : xpcom/glue/nsIClassInfoImpl.h => xpcom/base/nsIClassInfoImpl.h
rename : xpcom/glue/nsID.cpp => xpcom/base/nsID.cpp
rename : xpcom/glue/nsID.h => xpcom/base/nsID.h
rename : xpcom/glue/nsIInterfaceRequestorUtils.cpp => xpcom/base/nsIInterfaceRequestorUtils.cpp
rename : xpcom/glue/nsIInterfaceRequestorUtils.h => xpcom/base/nsIInterfaceRequestorUtils.h
rename : xpcom/glue/nsINIParser.cpp => xpcom/base/nsINIParser.cpp
rename : xpcom/glue/nsINIParser.h => xpcom/base/nsINIParser.h
rename : xpcom/glue/nsISupportsImpl.cpp => xpcom/base/nsISupportsImpl.cpp
rename : xpcom/glue/nsISupportsImpl.h => xpcom/base/nsISupportsImpl.h
rename : xpcom/glue/nsISupportsUtils.h => xpcom/base/nsISupportsUtils.h
rename : xpcom/glue/nsIWeakReferenceUtils.h => xpcom/base/nsIWeakReferenceUtils.h
rename : xpcom/glue/nsMemory.cpp => xpcom/base/nsMemory.cpp
rename : xpcom/glue/nsMemory.h => xpcom/base/nsMemory.h
rename : xpcom/glue/nsTWeakRef.h => xpcom/base/nsTWeakRef.h
rename : xpcom/glue/nsVersionComparator.cpp => xpcom/base/nsVersionComparator.cpp
rename : xpcom/glue/nsVersionComparator.h => xpcom/base/nsVersionComparator.h
rename : xpcom/glue/nsWeakReference.cpp => xpcom/base/nsWeakReference.cpp
rename : xpcom/glue/nsWeakReference.h => xpcom/base/nsWeakReference.h
extra : rebase_source : df11b181f383b70ffe5051716d63ed11b98be53b
extra : histedit_source : 6d0743fac0562e4676e44a52f0e85375fb4a44ff
2017-01-23 09:24:01 -05:00
seawood%netscape.com 4008d44ab5 Removing nsCOMPtr.{h,cpp} from xpcom/base. They have been copied (in the cvs repo) and are built in xpcom/glue.
Bug #99698
2001-09-30 03:30:29 +00:00
gerv%gerv.net 4e12e44b2f Relicensing Round 1, Take 2. Most C-like NPL files -> NPL/GPL/LGPL. Bug 98089. 2001-09-28 20:14:13 +00:00
dougt%netscape.com 8d512061e8 Landing nsISupports changes. Freezes nsISupports.idl and nsrootidl.idl. r=valeski@netscape.com, sr=rpotts@netscape.com bug 98281 2001-09-27 03:43:00 +00:00
brendan%mozilla.org dbd7fed5b1 FASTLOAD_20010703_BRANCH landing, r=dbaron, sr=shaver. 2001-07-31 19:05:34 +00:00
scc%mozilla.org 6805c2745f bug #75504; sr=jband. making it impossible to misuse |getter_AddRefs| in the way jband discovered 2001-05-03 10:15:09 +00:00
brendan%mozilla.org 4f5aafa905 Checkin shaver's patch to allow debug Mozilla builds to dynamicly link with XPCOM-based, nsCOMPtr-using optimized plugins (77112, r=brendan, sr=scc, a=chofmann). 2001-04-24 21:13:15 +00:00
dbaron%fas.harvard.edu 1244386ebc Fix bustage on VC++ and gcc 2.7.2.x caused by incorrect overload resolution. 2001-04-07 17:25:16 +00:00
dbaron%fas.harvard.edu 780cb86a7a Replace my previous incorrect fix for |operator==| ambiguities with a correct one: provide additional |operator==| and |operator!=| for comparing nsCOMPtrs to raw pointers that take a non-const raw pointer argument so that builtin operators will not have a better conversion for one argument. b=65664 r=waterson@netscape.com sr=scc@mozilla.org 2001-04-07 15:29:39 +00:00
dbaron%fas.harvard.edu 59a4590389 Make |nsCOMPtr<T>::operator&| private so that it is not used by clients. Legitimate users should use |address_of| instead. b=59414 r=disttsc@bart.nl sr=scc@mozilla.org
Fix ambiguities relating to the various forms of |operator==| defined for nsCOMPtrs by avoiding |const| for parameters for compilers where it (incorrectly) confuses overload resolution.  r=scc@mozilla.org  sr=brendan@mozilla.org  b=65664
2001-02-04 19:57:29 +00:00
dbaron%fas.harvard.edu 3331dd382b Attempt to fix |address_of| bustage on IRIX. r=scc@mozilla.org b=59414 2000-12-10 03:13:53 +00:00
dbaron%fas.harvard.edu 81352c0825 Work in progress for bug 59414. Prepare to make |nsCOMPtr|'s |operator&| private to prevent many cases of accidental usage, and provide |address_of| for clients who really want a pointer to an nsCOMPtr. r=scc@mozilla.org sr=waterson@netcape.com 2000-12-09 04:45:43 +00:00
cls%seawood.org f9754b268f Workaround for long-standing AIX bustage 2000-07-28 08:11:51 +00:00
mkaply%us.ibm.com dc2e138a70 # 37239
r = valeski, a = brendan
OS/2 bring-up - Yes I know this is ugly.
We are getting a linker error on this delete.
We want to get our builds up by any means necessary,
so I need to comment this out for us for now.
2000-06-14 00:26:52 +00:00
scc%mozilla.org 5108fd1bbe further logging fixes; removed |explicit| to "nscore.h"; removed old-style logging definitions for |NSCAP_ADDREF| and |NSCAP_RELEASE|, define them externally if you want them (the new comment says how); fixed some comments... I'll be moving to doc-style comments soon to better support doxygen 2000-06-10 09:58:13 +00:00
scc%mozilla.org fbdb41c4de further fix for the defined case. r=dbaron 2000-06-08 05:08:14 +00:00
scc%mozilla.org 372c751346 Improved logging facilities on |nsCOMPtr| in cooperation with dbaron, for his new logging tools. r=dbaron 2000-06-08 04:52:39 +00:00
waterson%netscape.com 94bd261c1c Canonify HAVE_CPP_ACCESS_CHANGING_USING and HAVE_CPP_AMBIGUITY_RESOLVING_USING. 2000-06-05 00:46:37 +00:00
scc%mozilla.org ebc8903c87 Bug #39824. Checking in patch from dp. This patch fixes exports on some |nsCOMPtr_helper| classes so we can link appropriately. r=scc. 2000-05-20 18:31:45 +00:00
waterson%netscape.com 8e51bfbbef Remove #ifdef that is unnecessary when STL headers are not included. 2000-05-14 00:05:24 +00:00
waterson%netscape.com 2ecdf03c7c Add necessary code to get NEW_STRING_APIS to compile properly on gcc-2.7.2.3. r=scc 2000-05-13 00:05:29 +00:00