Commit Graph

57 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
Nathan Froyd
f61c010661 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
c39128bbad Bug 1116905 - part 1 - remove dependence on implicit conversion from T* to TemporaryRef<T>, non-gfx changes; r=ehsan 2015-04-30 15:17:08 -04:00
travis
0df4f10497 Bug 1154803 - Put our sigaction diversion in __sigaction if it exists r=glandium 2015-04-21 09:32:45 -05:00
James Willcox
156a79ed55 Bug 1127464 - Assert when we unexpectedly unload libraries on Android r=glandium 2015-03-09 08:33:22 -05:00
Mike Hommey
a6593e4218 Bug 1082524 - Do not deref null pointers in link_map. r=nfroyd 2014-10-18 09:27:55 +09:00
Mike Hommey
7ec4ce1032 Fixup for bug 1081034 - Add missing #ifdef to avoid build failure on desktop linux. r=me,npotb,DONTBUILD 2014-10-17 14:09:17 +09:00
Mike Hommey
0aa2b6cf3c Bug 1081034 part 3 - Resolve libc symbols with our linker. r=nfroyd
This allows to resolve weak symbols from some Android device's libc that
dlsym() won't. This is effectively an alternative fix to bug 791419, without
requiring wrapping symbols.
2014-10-16 09:20:14 +09:00
Mike Hommey
49c12e0023 Bug 1081034 part 2 - Move initialization of self_elf to its own separate class. r=nfroyd
The new class is kind of like SystemElf, but using our linker's own symbol
resolution. This also adds some initialization from ELF program headers that
weren't done previously for self_elf, as well as registration as for CustomElf
instances.
2014-10-16 09:20:06 +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
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
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
Mike Hommey
0a5d532c0f Bug 1077135 - Ensure logging initialization for early log messages in the linker. r=nfroyd 2014-10-04 10:31:49 +09:00
Mike Hommey
7eef0ed2ac Bug 1077135 - Initialize ElfLoader::DebuggerHelper::firstAdded. r=nfroyd 2014-10-04 10:31:38 +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
206ea469fa Bug 1036286 - Ensure faulty.lib diverts libc's sigaction instead of a LD_PRELOADed one. r=nfroyd
and force-send calls to sigaction from faulty.lib-loaded libraries to the libc.
2014-08-07 02:51:20 +09:00
Mike Hommey
21f643ea4a Bug 1036286 - Delay registration of the faulty.lib signal handler until when it's necessary. r=nfroyd
It's necessary to delay it because for the second part, we need to call dlopen,
and until recently bionic's linker dead-locked when using dlopen from a static
initializer.
2014-08-07 02:51:03 +09:00
Mike Hommey
4fb678a58c Backout changeset 34235900c3a0 (bug 1036286) because it wasn't the right fix. 2014-08-05 16:07:06 +09:00
Mike Hommey
95e40852cb Bug 1036286 - Make sure libraries loaded by faulty.lib use its own sigaction. r=nfroyd
Android L added a libsigchain library it LD_PRELOADs. That library exposes
a different sigaction than libc's. It's used for ART.

faulty.lib gets its sigaction from libsigchain, but after bug 874708, the
libraries it loads simply use libc's sigaction, assuming it would be the
hooked one. In turn, this means libraries loaded by faulty.lib may
override faulty.lib's handler, which is definitely not the intent.

This essentially restores some of the code that bug 874708 removed.

An alternative fix would be to add support for LD_PRELOAD, but that has more
implications and feels more risky. This could be done, if necessary, as a
followup.
2014-07-24 13:43:56 +09:00
Robert O'Callahan
949537330f Bug 1006248. Part 1: Add MOZ_EXPORT in various places. r=glandium
--HG--
extra : rebase_source : cfe209a412cae28d405eae413415cebb6959072a
2014-05-06 17:26:46 +12:00
Douglas Crosher
a2f5f71531 Bug 944612 - Guard the ElfLoader sigaction wrapper against the SIGSEGV handler not being installed. r=glandium 2014-03-20 12:35:15 +11:00
Birunthan Mohanathas
866c961b74 Bug 784739 - Switch from NULL to nullptr in mozglue/linker/; r=ehsan 2013-11-11 14:15:46 -05: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
e9d9adfd0d Bug 886736 - Disable on-demand decompression when latency to get into segfault handlers is too high. r=nfroyd 2013-10-01 15:30:45 +09:00
Mike Hommey
9400bbf7a7 Bug 907957 - Detect if a segfault signal handler is useless. If it is, disable on-demand decompression. r=nfroyd 2013-08-30 11:14:17 +09:00
Jim Chen
0bc2b5c5ea Bug 904646 - Skip NULLs when traversing envp/auxv pointers to let GDB work on Android 4.3; r=glandium 2013-08-14 12:54:33 -04:00
Mike Hommey
11a3618083 Bug 891266 - Allow to enable faulty.lib debug log at runtime. r=nfroyd 2013-07-10 14:12:35 +09:00
Mike Hommey
a6b496bb8d Bug 886730 - Add and use a MemoryRange class and helper functions for page alignment in faulty.lib. r=nfroyd 2013-06-27 09:35:49 +09: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
Julian Seward
08b09fb3cc Bug 882903 - SPS breadkpad unwinder segfaults with on-demand decompression on. r=glandium. 2013-06-14 14:03:25 +02:00
Mike Hommey
835bd7384a Bug 874708 - Hook libc's sigaction to avoid system libraries replacing our segfault handler temporarily and restoring it wrongly. r=nfroyd 2013-06-09 09:23:03 +02:00
Mike Hommey
d06212fc0b Bug 861796 - Fix crash in LibHandle::~LibHandle. r=nfroyd 2013-04-15 18:36:13 +02: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
Vicamo Yang
57bd116b87 Bug 859830: determine Android API level through android/api-leve.h instead. r=glandium 2013-04-12 13:39:42 +08:00
Mike Hommey
c55320bda8 Bug 842681 - Refactor the linker Zip code and allow to use an existing memory buffer as a Zip file. r=mwu 2013-03-08 09:24:46 +01:00
Mike Hommey
39e56e008a Bug 830326 - Get rid of warnings in the custom linker code. r=nfroyd 2013-01-15 10:12:56 +01:00
Mike Hommey
c405bd3d02 Bug 830295 - Avoid RefPtr<LibHandle> triggering recursive calls to ~CustomElf, and use it in the linker segfault handler. r=nfroyd 2013-01-15 10:12:36 +01:00
Mike Hommey
0fb348e03d Bug 826178 - Prefix all hexadecimal values with 0x in linker logs. r=nfroyd 2013-01-03 16:45:57 +01:00
Mike Hommey
e14946ab94 Fixup for dl_iterate_phdr after bug 808121. r=me 2012-11-07 16:45:48 +01:00
Mike Hommey
31305e4e03 Bug 808121 - Ensure the pointers we change in the r_debug data are writable, which they aren't with upcoming Android system linker. r=nfroyd 2012-11-07 08:02:53 +01:00
Mike Hommey
47d4a8624f Bug 783331 - Add Phdr pointer and count to dl_iterate_phdr implementation. r=nfroyd 2012-08-29 08:55:57 +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
821a1ccc7c Bug 727960 - When extracting libraries, reuse cached library if it is newer than the apk. r=tglek 2012-02-22 08:12:15 +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
7d1eec64ac Bug 725230 - Enable and fix assertions in linker code. r=tglek 2012-02-13 15:49:45 +01:00