Commit Graph

49 Commits

Author SHA1 Message Date
Nathan Froyd
41ba39b3b0 Bug 1295197 - use non-null-checked operator new in xpcom/; r=erahm
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.
2016-08-22 18:40:10 -04:00
Wes Kocher
f378fa54b1 Backed out changeset f8d33a975228 (bug 1295197) for being a possible cause of crashtest assertions CLOSED TREE 2016-08-16 11:22:23 -07:00
Nathan Froyd
da3e07b555 Bug 1295197 - use non-null-checked operator new in xpcom/; r=erahm
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.
2016-08-16 17:05:39 -04:00
Igor
4878f6bf37 Bug 1289890 - Change nsCOMArray::ReplaceObjectAt() return type from "bool" to "void", since it always succeeds. r=froyndnj 2016-08-02 16:20:00 +02:00
Nathan Froyd
2be85aa542 Bug 1277890 - part 0 - add "append already_AddRefed element" API to nsCOMArray; r=erahm 2016-06-07 04:10:25 -04:00
Nicholas Nethercote
2abcf180f1 Bug 1249171 - Simplify nsCOMArray::SizeOfExcludingThis(). r=erahm.
Using explicit iteration at measurement sites is much simpler and nicer than
using callbacks.

--HG--
extra : rebase_source : 8b3f7aa702743b665383766b66a866a2c3d17240
2016-02-19 14:54:45 +11:00
Nicholas Nethercote
87b80f8c66 Bug 1188745 - Rename nsTArray::SizeOfExcludingThis() as ShallowSizeOfExcludingThis(). r=froydnj.
This makes it clearer that, unlike how SizeOf*() functions usually work, this
doesn't measure any children hanging off the array.

And do likewise for nsTObserverArray.

--HG--
extra : rebase_source : 6a8c8d8ffb53ad51b5773afea77126cdd767f149
2015-07-28 23:24:24 -07:00
Birunthan Mohanathas
c9fb2c0d48 Bug 1022456 - Fix modelines in xpcom/{base,glue,io,string,threads}/. r=froydnj 2014-06-30 08:39:45 -07:00
Birunthan Mohanathas
6b53f3d634 Bug 1022456 - Convert xpcom/glue/ to Gecko style. r=froydnj 2014-06-26 18:35:39 -07:00
Ehsan Akhgari
c1dc0a9245 Bug 969864 - Make nsTArray::SetLength return void; r=froydnj 2014-02-19 08:27:15 -05:00
Joshua Cranmer
33e4c4f0ca Bug 450881: Add helpers for XPIDL arrays to nsCOMArray, r=froydnj 2014-01-22 16:19:00 -06:00
Wes Kocher
e3dfa27d04 Backed out changeset 03bdec48d0ac (bug 450881) for Windows build bustage 2014-01-21 18:13:21 -08:00
Joshua Cranmer
9e4e7d3356 Bug 450881: Add helpers for XPIDL arrays to nsCOMArray, r=froydnj
--HG--
extra : rebase_source : d87f6cbdd2bab54f5923821409c9197f98b372f4
2014-01-21 18:01:36 -06:00
Benjamin Smedberg
8fd1bc7f20 Bug 672843 part C - convert most of XPCOM except for xpcom/tests, r=vdjeric 2013-11-19 16:27:37 -05:00
Catalin Iacob
8f3a2a0c69 Bug 798914 (part 6) - Followup: move MemoryReporting.h include after the cpp's own header include. r=njn. 2013-06-30 18:26:39 +02:00
Catalin Iacob
6f4758d23e Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn.
--HG--
extra : rebase_source : fc472490dd978d165f02f77ed37f07aed6e5bb61
2013-06-23 14:03:39 +02:00
Trevor Saunders
369e88fcc0 bug 856790 - make nsTArray::EnsureLengthAtleast() return void r=jlebar 2013-04-01 16:42:54 -04:00
Neil Rashbrook
72e7888f8b Bug 493711 Provide an nsTArray-like API for nsCOMArray r=sicking 2013-02-04 22:05:40 +00:00
Neil Rashbrook
6ced98692d Bug 493711 Part 1: switch nsCOMArray from nsVoidArray to nsTArray r=sicking 2012-12-19 21:33:54 +00:00
Ehsan Akhgari
e368dc9c85 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00
Aryeh Gregor
d0ad5a7d0c Bug 777292 part 2 - Change all nsnull to nullptr 2012-07-30 17:20:58 +03:00
Gervase Markham
82ff7027aa Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Ehsan Akhgari
92064e6d3f Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Landing on a CLOSED TREE
2011-10-17 10:59:28 -04:00
Michael Wu
d2b70213ac Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
--HG--
rename : tools/trace-malloc/bloatblame.c => tools/trace-malloc/bloatblame.cpp
2011-09-28 23:19:26 -07:00
Ehsan Akhgari
cb5cc4ef6b Bug 643885 - Part 1: Add the new RemoveObjectsAt API to nsCOMArray; r=bsmedberg 2011-04-14 10:18:02 -04:00
Ehsan Akhgari
6bfd4c53f7 Bug 570657 - Make the order of releasing objects and removing them in nsCOMArray's consistent; r=shaver
--HG--
extra : rebase_source : 16f05bbfbd31bc01e0545af111dc4e4adbac8e33
2010-06-09 14:13:16 -04:00
Jonathan Watt
b6427fd0a3 Bug 551299. Add a SetCount() method to nsCOMArray and nsVoidArray. r=bsmedberg.
--HG--
extra : rebase_source : 676b497a4fda08ec509c2ce9fdc7060af8be1663
2010-03-15 11:38:50 +00:00
Arpad Borsos
c72ef7d248 Bug 456388 - Remove PR_STATIC_CALLBACK and PR_CALLBACK(_DECL) from the tree; r+sr=brendan 2008-10-10 17:04:34 +02:00
jwalden@mit.edu
6d7584839a Bug 348748 - Replace all instances of NS_STATIC_CAST and friends with C++ casts (and simultaneously bitrot nearly every patch in existence). r=bsmedberg on the script that did this. Tune in next time for Macro Wars: Episode II: Attack on the LL_* Macros. 2007-07-08 00:08:04 -07:00
jst%mozilla.jstenback.com
95c7fd00f8 Fixing bug 348062. Making nsContentList hold strong references to the nodes in the list. r+sr=bzbarsky@mit.edu 2006-08-25 17:45:25 +00:00
cvshook%sicking.cc
6eb082c936 Bug 324918: Make nsHTMLSelectElement deal better with options in unknown children. r=bz sr=jst 2006-03-01 01:10:20 +00:00
bsmedberg%covad.net
d946f2be32 Try to fix brad bustage by backing out these declarations, which aren't on the equivalent nsVoidArray symbols 2005-11-08 20:55:30 +00:00
bsmedberg%covad.net
a7253270ad Bug 305949 Part 1 - Separate the frozen XPCOM exports with the XPCOM_API macro; add compatibility methods to the frozen string API; convert most of the tests/tools to use the xpcom glue when appropriate r=darin This checking does not actually stop exporting the nonfrozen methods yet, pending a bunch of test cleanup throughout the tree. 2005-11-08 18:17:49 +00:00
bzbarsky%mit.edu
647141294a nsCOMArray::RemoveObjectAt fails to remove nulls correctly. Bug 265772,
r=darin, sr=dbaron
2005-11-02 16:05:25 +00:00
bzbarsky%mit.edu
8a516c2bc7 Make ReplaceObjectAt a little safer. Bug 227780, r=timeless, sr=alecf 2005-11-02 16:05:18 +00:00
dbaron%dbaron.org
c2a2acec18 nsCOMArray should not use nsDerivedSafe. b=221525 r=bryner 2005-11-02 16:05:13 +00:00
neil%parkwaycc.co.uk
d4b748fded Bug 198685 need nsCOMArray function like IndexOf that checks COM object identity p=bsmedberg@covad.net r=alecf (no sr needed) 2005-11-02 16:05:09 +00:00
bzbarsky%mit.edu
2221342506 fix build bustage 2005-11-02 16:05:08 +00:00
alecf%netscape.com
61a735c9a9 fix an assertion from nsCOMArray where ReplaceElementAt() wouldn't property extend the array because we were just using ObjectAt()
residual stuff from bug 197827, which caused an assertion browsing frame
patch by keeda@hotpop.com, r/sr=alecf
2005-11-02 16:04:49 +00:00
sicking%bigfoot.com
c2e57a5529 Bug 162115: Make nsCOMArray return nsDeriviedSafes to avoid bad addrefs/releases
r=bz sr=alecf
2005-11-02 16:04:48 +00:00
bzbarsky%mit.edu
12aaff4a3f Make the nsCOMArray destructor release all the objects. Bug 178813,
r=bbaetz, sr=rpotts
2005-11-02 16:04:47 +00:00
bzbarsky%mit.edu
e6995a227c nsCOMArray_base copy constructor should not assert. Bug 178534,
r=dougt, sr=alecf
2005-11-02 16:04:46 +00:00
bzbarsky%mit.edu
eb48ce7821 Add AppendObjects/InsertObjectsAt to nsCOMArray. Bug 175137,
r=timeless, sr=alecf, a=dbaron
2005-11-02 16:04:44 +00:00
varga%netscape.com
e7a258a922 Fix for bug 174443. nsCOMArray::ApendObject() shouldn't addref
r=dougt, sr=alecf, a=asa
2005-11-02 16:04:42 +00:00
mkaply%us.ibm.com
a5c8ba5fad OS/2 bustage - need PR_CALLBACK 2005-11-02 16:04:41 +00:00
alecf%netscape.com
21d0af0504 - fix ReplaceObjectAt to properly account for existing null entries
- make nsCOMArray_base accessible from nsCOMArray<T> so that a nsCOMArray<T> can passed to NS_NewArray
for bug 162115, not part of build
2005-11-02 16:04:37 +00:00
alecf%netscape.com
03048eca48 not part of build, more for bug 162115:
- fix some spelling, add documentation
- add NS_NewArray(), including one that takes an existing nsCOMArray<T>
- implement copy constructor for nsCOMArray_base, so that NS_NewArray can work
not part of build
2005-11-02 16:04:36 +00:00
alecf%netscape.com
7e5a4b47eb match up some reviewers comments:
- tri-license with MPL, not NPL
- be consistent with policy on null in the array (it is allowed)
- move Clear() into implementation file, and hide static callback there too
- make sure to AddRef() on the way out of nsArray::IndexOf()
- handle failure of ReplaceElementAt more gracefully
bug 162115, not part of build yet
2005-11-02 16:04:35 +00:00
alecf%netscape.com
6f3992e110 continuing work in progress on nsCOMArray<T> - take darin's suggestion and move all nsISupports-related code into a non-template base class nsCOMArray_base. This allows the generated template to be paper thin (or really, non-existent!)
Then, we move some of the non-trivial methods of this class into a .cpp file
2005-11-02 16:04:34 +00:00