Commit Graph

26 Commits

Author SHA1 Message Date
Nathan Froyd
9c5965b035 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
2015-10-18 01:24:48 -04:00
Nathan Froyd
e504437747 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
46d6f38e68 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
Mike Hommey
1267fa50ff Bug 1081034 part 1 - Move GetSymbolPtr, Contains and FindExidx from CustomElf to BaseElf. r=nfroyd 2014-10-16 09:19:46 +09:00
Mike Hommey
f1252281fe Bug 1078837 part 2 - Replace IsSystemElf/reinterpret_cast dance with better API. r=nfroyd 2014-10-16 09:19:45 +09:00
Mike Hommey
3118289632 Bug 1078837 part 1 - Move CustomElf::mappable to BaseElf. r=nfroyd 2014-10-16 09:19:45 +09:00
Mike Hommey
2a32154b74 Bug 1083020 - Add a (dummy) stats method to all LibHandles. r=nfroyd
While here, avoid doing anything if debug logging is disabled.
2014-10-16 09:19:40 +09:00
Mike Hommey
296a10bc98 Bug 1082524 - Initialize link_map. r=nfroyd
When a library fails to load with CustomElf before it's registered, the
unregistration that does happen in CustomElf's destructor uses link_map,
so it needs to be initialized.
2014-10-15 14:46:09 +09:00
Mike Hommey
c1730d5281 Bug 1077384 - Make libmozglue a pseudo-LD_PRELOAD on android. r=nfroyd
In order to avoid adding more dlsym overhead than there already is, resolve
symbols directly in the library containing the linker. (GetSymbolPtr is
essentially free ; dlsym makes the system linker compule a ElfHash itself,
and that's quite expensive to do on all symbols)

This also paves the way for direct symbol resolution in all system libraries.
2014-10-07 07:42:18 +09:00
Jim Chen
2253ecc621 Bug 1066760 - Add base address and fall back to system dladdr in __wrap_dladdr; r=froydnj 2014-09-24 14:12:54 -04:00
Mike Hommey
b0ff197fa9 Bug 956398 - Support text relocations in the custom linker. r=nfroyd 2014-01-16 09:13:42 +09:00
Jim Chen
a470a16c5b Bug 930627 - Implement __gnu_Unwind_Find_exidx in custom linker on ARM. r=glandium 2013-10-31 11:40:32 -04:00
Mike Hommey
8fd281dcec Bug 886722 - Rename log/debug to LOG/DEBUG_LOG in faulty.lib. r=nfroyd 2013-06-27 09:35:49 +09:00
Mike Hommey
a682d7fe75 Bug 885336 - Fix various issues with the dl_mmap interface. r=nfroyd 2013-06-27 09:35:48 +09:00
Mike Hommey
83a22e1678 Bug 802240 - Expose an API to mmap the underlying file for a library loaded by faulty.lib. r=nfroyd 2013-04-12 10:23:12 +02:00
Mike Hommey
91480beb18 Bug 747033 - Implement dl_iterate_phdr in the custom linker. r=froydnj
--HG--
rename : mozglue/linker/CustomElf.h => mozglue/linker/Elfxx.h
2012-04-25 09:05:02 +02:00
Mike Hommey
03875c9d65 Bug 734812 - Make the linker error out when text relocations are defined with DF_TEXTREL. r=nfroyd 2012-03-13 09:48:20 +01:00
Mike Hommey
ba812f1af5 Bug 727959 - Don't error out when missing symbol for PLT relocations is weak. r=nfroyd 2012-03-08 08:29:39 +01:00
Mike Hommey
11dbe5c7e5 Fixup for bug 733087. rs=dougt 2012-03-06 09:54:17 +01:00
Mike Hommey
bb2d9a7a21 Bug 729883 - Avoid linker warnings when starting up on Android. r=tglek 2012-02-27 08:19:20 +01:00
Mike Hommey
af3eac834f Bug 686805 part 6 - Add functions to display stats about seekable compressed streams. r=tglek 2012-02-22 08:12:15 +01:00
Mike Hommey
d8fa15fe94 Bug 686805 part 4 - Make the linker load libraries with on-demand decompression when they are seekable compressed streams. r=tglek,r=sewardj 2012-02-22 08:12:15 +01:00
Mike Hommey
8ec8693b3e Bug 686805 part 2 - Use a SIGSEGV signal handler to handle segmentation faults happening in loaded libraries address space. r=tglek,r=sewardj 2012-02-22 08:12:15 +01:00
Mike Hommey
aef323bb1b Bug 683127 part 10 - Allow debug symbols to be found under gdb without extracted libraries. r=tglek,r=mwu 2012-01-20 09:49:03 +01:00
Mike Hommey
c1f8abcc72 Bug 683127 part 8 - Allow to load Elf files from a Zip archive. r=tglek,r=sewardj 2012-01-20 09:48:44 +01:00
Mike Hommey
372473a08a Bug 683127 part 7 - Use a custom Elf linker for libraries given with an absolute path name. r=sewardj 2012-01-20 09:48:44 +01:00