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

67 Коммитов

Автор SHA1 Сообщение Дата
James Cheng 4d3ad00b0e Bug 1269968 - Remove unnecessary deduction on RefPtr.h. r=froydnj
MozReview-Commit-ID: HoLyJD6oh

--HG--
extra : rebase_source : ac10cf1b3fae96ae91e7b5dd9b5a54797cec6e6d
2016-05-03 20:45:00 +02:00
Bobby Holley 5790b832fa Bug 1261452 - do_AddRef shouldn't require an rvalue-reference. r=froydnj 2016-04-01 19:14:42 -07:00
Bobby Holley efe3a336f3 Bug 1248784 - Followup to add requested comment. r=froydnj DONTBUILD 2016-02-17 10:16:47 -08:00
Bobby Holley d7835725e4 Bug 1248784 - Extract the AddRef/Release calls into a non-inner helper trait. r=froydnj 2016-02-17 10:15:19 -08:00
Bobby Holley 75abd802d9 Bug 1248784 - Rename the existing AddRefTraits to ConstRemovingRefPtrTraits. r=froydnj 2016-02-17 10:15:17 -08:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Nathan Froyd 483783681e Bug 1207245 - part 4 - remove RefPtr.h; r=ehsan
It has been superseded by the availability of nsRefPtr.h.
2015-10-18 00:40:16 -04:00
Nathan Froyd 583afa0965 Bug 1207245 - part 3 - switch all uses of mozilla::RefPtr<T> to nsRefPtr<T>; r=ehsan
This commit was generated using the following script, executed at the
top level of a typical source code checkout.

 # Don't modify select files in mfbt/ because it's not worth trying to
 # tease out the dependencies currently.
 #
 # Don't modify anything in media/gmp-clearkey/0.1/ because those files
 # use their own RefPtr, defined in their own RefCounted.h.
find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    grep -v 'mfbt/RefPtr.h' | \
    grep -v 'mfbt/nsRefPtr.h' | \
    grep -v 'mfbt/RefCounted.h' | \
    grep -v 'media/gmp-clearkey/0.1/' | \
    xargs perl -p -i -e '
 s/mozilla::RefPtr/nsRefPtr/g; # handle declarations in headers
 s/\bRefPtr</nsRefPtr</g; # handle local variables in functions
 s#mozilla/RefPtr.h#mozilla/nsRefPtr.h#; # handle #includes
 s#mfbt/RefPtr.h#mfbt/nsRefPtr.h#;       # handle strange #includes
'

 # |using mozilla::RefPtr;| is OK; |using nsRefPtr;| is invalid syntax.
find . -name '*.cpp' -o -name '*.mm' | xargs sed -i -e '/using nsRefPtr/d'

 # RefPtr.h used |byRef| for dealing with COM-style outparams.
 # nsRefPtr.h uses |getter_AddRefs|.
 # Fixup that mismatch.
find . -name '*.cpp' -o -name '*.h'| \
    xargs perl -p -i -e 's/byRef/getter_AddRefs/g'
2015-10-18 00:40:10 -04:00
Nathan Froyd 50eb249b57 Bug 1207245 - part 2 - move MakeAndAddRef to nsRefPtr.h
A number of places depend on RefPtr.h providing this function.  When we
s/RefPtr/nsRefPtr/, such places still need to be able to see this
function.  Moving it to nsRefPtr.h makes it still visible before we
switch (since RefPtr.h includes nsRefPtr.h), and after we switch (since
every place that #includes RefPtr.h will now be #including nsRefPtr.h).
2015-09-22 22:23:10 -04:00
Nathan Froyd 5761751aa3 Bug 1207245 - part 1 - move RefCounted<T> to its own file
Various bits depend on RefPtr.h to provide RefCounted<T> and RefPtr<T>.
It will be easier to manage an automatic conversion from RefPtr<T> to
nsRefPtr<T> if we split out the dependency on RefCounted<T> first.
2015-09-22 21:27:34 -04:00
Aryeh Gregor 328b8f083b Bug 1193298 - Part 3: Delete RefPtr<T>::operator T*()&&. r=froydnj
I put MOZ_HAVE_REF_QUALIFIERS in Attributes.h for lack of a better
place.  I didn't especially want to make a whole new file for it.

To make the tree compile, support for moving RefPtr to nsRefPtr was
needed.  I chose to put the definitions in RefPtr.h instead of
nsRefPtr.h because RefPtr.h looks to be included in fewer files, so I
preferred to bloat fewer files with the extra include.

For some reason operator!() wasn't necessary here, although it seems it
is for nsRefPtr.
2015-08-11 06:45:00 -04:00
Ehsan Akhgari 91324a3c5a Bug 1188204 - Fix more constructors in MFBT; r=froydnj 2015-07-28 12:24:39 -04:00
Jeff Gilbert d44d3d56e2 Bug 1177887 - Deref *after* changing the value held by RefPtr. - r=waldo 2015-07-16 17:15:44 -07:00
Nathan Froyd a2f2f68970 Bug 1161627 - part 3 - remove TemporaryRef<T> from RefPtr.h; r=ehsan 2015-05-05 13:22:12 -04:00
Nathan Froyd 974d8120f2 Bug 1161627 - part 2 - machine-convert TemporaryRef<T> to already_AddRefed<T>; r=ehsan
This conversion was done with the script:

  find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl' | \
    egrep -v 'cairo-win32-refptr.h|RefPtr.h|TestRefPtr.cpp' | \
    xargs sed -i -e 's/mozilla::TemporaryRef</already_AddRefed</g' \
                 -e 's/TemporaryRef</already_AddRefed</g'

Manual fixups were performed in the following instances:

- We handled mfbt/RefPtr.h manually so as to not convert TemporaryRef itself
  into already_AddRefed.

- The following files had explicit Move() calls added to make up for the lack
  of a copy constructor on already_AddRefed:

  dom/base/ImageEncoder.cpp
  dom/media/MediaTaskQueue.{h,cpp}
  dom/media/webaudio/PannerNode.cpp

- A redundant overload for MediaTaskQueue::Dispatch was deleted.

- A few manual fixups were required in mfbt/tests/TestRefPtr.cpp.

- Comments, using declarations, and forward declarations relating to
  TemporaryRef in dom/canvas/ and gfx/layers/ were changed to refer to
  already_AddRefed.
2015-06-17 10:00:52 -04:00
Nathan Froyd 123e1631f7 Bug 1161627 - part 1 - add move constructor and assignment operator for already_AddRefed&& to RefPtr; r=ehsan
This change is prep work for future mass rewriting.
2015-05-05 13:02:21 -04:00
Milan Sreckovic b05ff05c6a Bug 1131463 - Report AtomicRefCounterWithFinalize doing the wrong thing with AddRef and Release in release build as well. r=sotaro 2015-05-29 16:41:28 -04:00
Nathan Froyd db188ea282 Bug 1160485 - remove implicit conversion from RefPtr<T> to TemporaryRef<T>; r=ehsan
Having this implicit conversion means that we can silently do extra
refcounting when it's completely unnecessary.  It's also an obstacle to
making RefPtr more nsRefPtr-like, so let's get rid of it.
2015-05-01 09:14:16 -04:00
Nathan Froyd 2e9c6d19f2 Bug 1116905 - part 4 - remove implicit conversion from non-nullptr T* to TemporaryRef<T>; r=ehsan 2015-04-30 15:21:05 -04:00
Nathan Froyd 334eeef68e Bug 1116905 - part 2 - add MakeAndAddRef helper function to facilitate constructing TemporaryRef; r=Ms2ger
With implicit conversion to TemporaryRef going away, one can no longer write:

  return new T(...);

in a function returning TemporaryRef<T>.  Instead, provide MakeAndAddRef
to prevent people from having to construct boilerplate RefPtrs or
similar.  It also makes converting from TemporaryRef to already_AddRefed
somewhat easier.
2015-04-30 15:19:49 -04:00
Randall Barker c236b48231 Bug 1093934 - Create a XPCOM library that can be used to support standalone WebRTC. r=nfroyd
--HG--
extra : rebase_source : 93f11457b16b344e148a6fcb924b286ef8a48051
2015-04-03 15:52:00 +02:00
Wes Kocher e226c762ee Backed out changeset 0f5799df920b (bug 1093934) for various test failures CLOSED TREE
--HG--
extra : amend_source : 047ed43008cea68775c544cdf0df2819cfb24589
2015-04-02 13:42:34 -07:00
Randall Barker 683155c363 Bug 1093934 - Create a XPCOM library that can be used to support standalone WebRTC r=froydnj 2015-04-02 12:12:37 -07:00
Ehsan Akhgari 883849ee32 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -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 MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Ehsan Akhgari 0da19b297b Bug 1121489 follow-up: Addresss the review comment 2015-01-19 09:07:57 -05:00
Ehsan Akhgari 5e8e593966 Bug 1121489 - Make it possible to construct a RefPtr from an already_AddRefed; r=froydnj
This will pave the way towards having a MakeAndAddRef function
that returns an already_AddRefed and can be used in graphics code.
2015-01-19 09:00:01 -05:00
Masatoshi Kimura bf312ad056 Bug 1120062 - Part 1: Remove most Nullptr.h includes. r=waldo 2015-01-11 11:34:52 +09:00
Ehsan Akhgari 4354953b4f Bug 1118486 - Part 1: Use `= delete` instead of MOZ_DELETE directly; r=Waldo
Most of this patch (with the exception of dom/bindings/Codegen.py) was
generated by the following bash script:

#!/bin/bash

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "*/.git*" \
       ! -wholename "obj-*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -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 MOZ_DELETE '= delete'
2015-01-08 23:19:05 -05:00
Ehsan Akhgari 860da94550 Bug 1114999 - Part 2: Apply MOZ_NO_ADDREF_RELEASE_ON_RETURN to all smart pointer arrow operators that can return refcounted objects; r=jrmuizel 2015-01-06 16:30:03 -05:00
Ehsan Akhgari a41280816e Bug 1116622 - Give TemporaryRef a take() method semantically equivalent to already_AddRefed::take(); r=froydnj
This is in preparation of removing TemporaryRef.  It should help make
already_AddRefed a drop-in replacement for it.
2015-01-05 11:32:37 -05:00
Ehsan Akhgari 339c337cc5 Bug 1117036 - Make it possible to optionally mark functions defined by MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME as MOZ_OVERRIDE; r=froydnj 2015-01-05 11:28:55 -05:00
Ehsan Akhgari 9297631e0b Bug 1114880 follow-up: Rename MOZ_{STRONG,WEAK}_REF to MOZ_{OWNING,NON_OWNING}_REF
--HG--
extra : rebase_source : 51fff0785d112b5b87be3c6ff723c8986b37effe
2014-12-23 21:17:50 -05:00
Ehsan Akhgari cef42d50e5 Bug 1114979 - Annotate some strong and weak references in MFBT; r=froydnj
--HG--
extra : rebase_source : 63d9ca59f8f6be06efd087600c8fd5c5f52e5cd1
2014-12-23 17:26:28 -05:00
Nicholas Nethercote 6548e9518e Bug 1045920 (part 2) - Add mfbt/tests/TestRefPtr.cpp. r=froydnj. 2014-07-30 06:59:52 -07:00
Nicholas Nethercote 2a0942be41 Bug 1036789 - Convert the third quarter of MFBT to Gecko style. r=Ms2ger.
--HG--
extra : rebase_source : 668cd394806203ddfa34bd4f226335ff26c846b5
2014-07-10 19:10:17 -07:00
Ehsan Akhgari 29433bf8d1 Bug 1026718 - Expand MOZ_DECLARE_REFCOUNTED_TYPENAME unconditioanlly in order to make it available outside of libxul as well; r=Waldo 2014-06-18 20:11:21 -04:00
Ehsan Akhgari 8b30e40485 Bug 1013662 - Fix bad implicit conversion constructors in MFBT; r=froydnj,Waldo 2014-06-06 23:17:06 -04:00
Ehsan Akhgari 7257ee5010 Bug 1004564 - Move AtomicRefCounted to mozilla::external and outlaw it in Gecko code; r=froydnj 2014-05-01 14:33:20 -04:00
Ehsan Akhgari fceee9b5aa Bug 985878 - Make AtomicRefCounted thread safe; r=khuey 2014-03-25 09:02:26 -04:00
Ehsan Akhgari 8cd0c0f21d Bug 935778 - Part 3: Add trace-refcount logging for AddRef and Release in RefCounted objects; r=dbaron 2014-03-09 14:36:36 -04:00
Ehsan Akhgari 9c823473c2 Bug 935778 - Part 0.7: Emit the correct type name from FilterNodeLightingSoftware; r=jrmuizel, parts r=dbaron 2014-02-26 10:13:48 -05:00
Ehsan Akhgari 677b8c872c Bug 976247 - Remove a useless static keyword from mozilla::detail::DEAD; r=froydnj 2014-02-24 21:08:51 -05:00
Ehsan Akhgari 0db909c03c Backed out changeset f74c9326b89c (bug 976247) because I landed the wrong patch :( 2014-02-24 21:07:37 -05:00
Ehsan Akhgari c102d49715 Bug 976247 - Remove a useless static keyword from mozilla::detail::DEAD; r=froydnj
--HG--
extra : rebase_source : e73444ec000f1e867651d39cf2aa6beaf88bf4f3
2014-02-24 19:37:34 -05:00
Ehsan Akhgari e1b60f2947 Bug 935778 - Part 0.6: Add support for MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME and use it in moz2d
X-Git-Commit-ID: bc256ac44cbba52b04f8f0390965632ec4507608
2014-02-24 08:23:37 -05:00
Ehsan Akhgari e4ed013f53 Bug 935778 - Part 1.1: Re-add the refcount assertions for AddRef(), and make the assertions for Release() use a signed integer 2014-02-22 11:23:03 -05:00
Ehsan Akhgari a8a0206da1 Bug 935778 - Part 1: Add RefCountType, a type compatible with nsrefcnt, to MFBT; r=dbaron,froydnj 2014-02-21 14:45:50 -05:00
Ehsan Akhgari 5704b555e2 Bug 935778 - Part 0.2: Spray some MOZ_DECLARE_REFCOUNTED_TYPENAME across the tree 2014-02-20 21:33:49 -05:00
Seth Fowler f9cdc752b1 Bug 912299 - Make RefCounted's refcount field mutable. r=waldo 2013-09-06 13:32:55 -07:00
Ehsan Akhgari 2824b29025 Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo
This patch was mostly generated by running the following scripts on the codebase, with some
manual changes made afterwards:

# static_assert.sh
#!/bin/bash
# Command to convert an NSPR integer type to the equivalent standard integer type

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 "*.cc" \
         -o -iname "*.mm" \) | \
    xargs -n 1 `dirname $0`/assert_replacer.py #sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_STATIC_ASSERT static_assert
hg rev --no-backup mfbt/Assertions.h \
                   media/webrtc/signaling/src/sipcc/core/includes/ccapi.h \
                   modules/libmar/src/mar_private.h \
                   modules/libmar/src/mar.h


# assert_replacer.py
#!/usr/bin/python

import sys
import re

pattern = re.compile(r"\bMOZ_STATIC_ASSERT\b")

def replaceInPlace(fname):
  print fname
  f = open(fname, "rw+")
  lines = f.readlines()
  for i in range(0, len(lines)):
    while True:
      index = re.search(pattern, lines[i])
      if index != None:
        index = index.start()
        lines[i] = lines[i][0:index] + "static_assert" + lines[i][index+len("MOZ_STATIC_ASSERT"):]
        for j in range(i + 1, len(lines)):
          if lines[j].find("                 ", index) == index:
            lines[j] = lines[j][0:index] + lines[j][index+4:]
          else:
            break
      else:
        break
  f.seek(0, 0)
  f.truncate()
  f.write("".join(lines))
  f.close()

argc = len(sys.argv)
for i in range(1, argc):
  replaceInPlace(sys.argv[i])

--HG--
extra : rebase_source : 4b4a4047d82f2c205b9fad8d56dfc3f1afc0b045
2013-07-18 13:59:53 -04:00