Commit Graph

925 Commits

Author SHA1 Message Date
Lee Salzman
9f646e6e6c Bug 1245979 - make mfbt Function reference-counted so that it can be cheaply copied for compatibility with Skia. r=froydnj 2016-02-04 16:43:42 -05:00
Thomas Zimmermann
fda4ea0ba7 Bug 1194721: Add |Saturate| template for saturation arithmetics, r=nfroyd
|Saturate<T>| implements saturation arithmetics for arbitrary basic
types. Operations on its value won't over- or underflow the type's
range.
2016-02-04 12:35:12 +01:00
Carsten "Tomcat" Book
0d206890d6 Backed out changeset 8d6c228ef008 (bug 1194721) on developers request 2016-02-03 16:25:00 +01:00
Thomas Zimmermann
9aaab24d3a Bug 1194721: Add |Saturate| template for saturation arithmetics, r=nfroyd
|Saturate<T>| implements saturation arithmetics for arbitrary basic
types. Operations on its value won't over- or underflow the type's
range.
2016-02-03 15:16:00 +01:00
Lee Salzman
41c61715b2 Bug 1243876 - fix ConvertibleTester to not cause incomplete type errors with UniquePtr and Skia. r=nfroyd 2016-01-28 16:08:27 -05:00
Xidorn Quan
137556e781 Bug 1241901 part 3 - Add IsMemberPointer and IsScalar type traits. r=froydnj 2016-01-30 10:33:41 +11:00
Morgan Phillips
8ac1cfe7d9 Bug 1238582 - Skip simulated OOM check in the case where we're growing within reserved space; r=Waldo 2016-01-28 10:07:14 -06:00
Ehsan Akhgari
eb68974351 Bug 1080968 - Don't use constexpr on clang-cl when emulating MSVC 2013
constexpr-ness of things can change the ABI requirements, and MSVC 2013
doesn't support constexpr, so choosing it for clang-cl when emulating
MSVC 2013 will cause ABI incomap issues between object files compiled
with the two compilers.

This reverts part of the commit for the original bug.
2016-01-27 21:10:03 -05:00
Tom Tromey
c35c86d248 Bug 757969 - use __thread in ThreadLocal; r=froydnj 2016-01-22 10:33:44 -07:00
Jan de Mooij
1ad69c0f15 Bug 1237201 part 8 - Make fallible Vector methods MOZ_WARN_UNUSED_RESULT. r=jwalden 2016-01-14 22:04:36 +01:00
Jim Blandy
2f3348f96d Bug 1239479: Add comments to mfbt/XorShift128PlusRNG.h from the RNG's designer. DONTBUILD r=Waldo 2016-01-13 12:46:40 -08:00
Chris Peterson
df63dbef87 Bug 1236413 - Suppress -Wimplicit-fallthrough warning in third-party code mfbt/decimal/. r=Waldo
mfbt/decimal/Decimal.cpp:762:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
2015-11-24 23:12:44 -08:00
Brian Birtles
e4284550c0 Bug 1228641 - Rename begin/size to aBegin/aSize to avoid shadow warnings; r=botond
On B2G/Android we get warnings if the begin/size parameters to the constructor
match the method names begin()/size(): declaration of 'size/begin' shadows
a member of 'this'.
2016-01-13 07:54:53 +09:00
Andrea Marchesini
a2094fbf55 Bug 1231378 - part 3 - Fix uninitialized members of classes in modules/libjar and mfbt, r=smaug 2016-01-12 18:16:59 +00:00
Carsten "Tomcat" Book
1b6f65f586 Backed out changeset 138c4e6a9b45 (bug 1231378) 2016-01-12 15:48:55 +01:00
Andrea Marchesini
2f2a80d82c Bug 1231378 - part 3 - Fix uninitialized members of classes in modules/libjar and mfbt, r=smaug 2016-01-12 13:57:34 +00:00
Michael Layzell
66ff47de76 Bug 1226376 - Part 1: Allow non-trivial constexpr constructors in MOZ_TRIVIAL_CTOR_DTOR classes, r=ehsan 2016-01-08 15:34:24 -05:00
Jeff Muizelaar
af079e4ea0 Bug 1228641. Add a polyfill of std::initializer_list. r=froydnj 2016-01-06 22:06:35 -05:00
Jan de Mooij
148517976d Bug 1231224 part 10 - Make various Vector calls check for OOM. r=terrence 2016-01-06 21:06:25 +01:00
Chris Peterson
82e23fb949 Bug 1235277 - Define MOZ_FALLTHROUGH_ASSERT to workaround -Wunreachable-code warnings about MOZ_FALLTHROUGH in debug builds. r=botond 2015-12-27 13:27:17 -07:00
Nathan Froyd
e11ccf6ab5 Bug 1232694 - fix typo in Compiler.h; r=botond 2015-12-15 11:14:53 -05:00
Nick Fitzgerald
4c67f636ce Bug 1170325 - Convert js::Vector into a template alias to mozilla::Vector with a single customized default argument. Also get rid of the CRTP support in mozilla::Vector (through mozilla::VectorBase) now that template aliasing is good enough, and make mozilla::Vector final so that people will use composition and not inheritance with it. (Inheritance plays poorly with movability and a few other things, in addition to messing up template argument deduction matching.) r=Waldo, patch sort of a tag-team between him and me 2015-07-13 12:42:52 -07:00
Chris Peterson
7f4c4d76a4 Bug 1228947 - Replace mfbt/Constants.h with math.h. r=roc 2015-11-27 20:49:55 -08:00
Xidorn Quan
f1c2e28909 Bug 1228182 - Use division directly for generating double in XorShift128PlusRNG. r=Waldo 2015-12-03 12:16:18 +11:00
Jan de Mooij
24e1c164eb Bug 322529 part 3 - Fix LRandom JIT code to use the new algorithm. r=arai,jwalden 2015-12-02 13:56:00 +01:00
Mike Hommey
547d572dd9 Bug 1229293 - Enforce order when setting a HierarchicalStringList, and forbid reassignment. r=gps
The current implementation of HierarchicalStringList allows the following:

   FOO.bar = [
       'foo',
       'bar',
   ]

while

   FOO.bar += [
       'foo',
       'bar',
   ]

would be invalid because of the StrictOrderingOnAppendList enforcement.

It also allows to overwrite the entire list with a subsequent

   FOO.bar = [
	'baz',
   ]

while we've explicitly forbidden such things for every other list.

While in the vicinity, fix HierarchicalStringList._get_export_variable to not
call the HierarchicalStringList constructor uselessly.
2015-12-02 11:04:37 +09:00
Mike Hommey
6dddb4e6f8 Bug 1178266 - Link against libatomic when necessary. r=froydnj 2015-12-02 11:04:37 +09:00
Botond Ballo
b1b05dcd90 Bug 1221680 - Avoid hard errors when testing convertibility using the IsConvertible type trait. r=froydnj 2015-11-06 17:47:36 -05:00
Bill McCloskey
086141208f Bug 1221368 - Change MakeTuple to decay the types of its arguments (r=froydnj) 2015-11-09 10:21:11 -08:00
Nathan Froyd
2258a5261d Bug 1216611 - add mozilla::MakeUniqueFallible and convert uses throughout the tree; r=Waldo 2015-11-05 16:24:24 -05:00
Sean Stangl
24e061fa5a Bug 939157 - RotateLeft with shift of zero gives undefined behavior. r=Waldo 2015-11-03 14:25:48 -08:00
Jeff Walden
5000852e29 Bug 1220693 - Make mozilla::Atomic<enum class> work even on compilers that don't have <atomic>. r=froydnj 2015-11-03 13:03:26 -08:00
Markus Stange
4fefc7082b Bug 1201330 - Keep scroll handler induced layer activity active until the scroll frame becomes inactive. r=roc 2015-10-30 16:28:53 +01:00
Birunthan Mohanathas
94998cf5fe Bug 1219392 - Capitalize mozilla::unused to avoid conflicts. r=froydnj 2015-11-02 07:53:26 +02:00
Mike Hommey
e99b640fef Backout changeset 3ced6f84960c (bug 1178266) because it was not reviewed by a peer and isn't a complete fix. 2015-10-31 07:36:49 +09:00
Carsten "Tomcat" Book
4bfbe87ad2 Backed out changeset d5d68c0258f3 (bug 1201330) 2015-10-30 14:44:06 +01:00
Markus Stange
c38bf4f8c7 Bug 1201330 - Keep scroll handler induced layer activity active until the scroll frame becomes inactive. r=roc 2015-10-27 17:18:03 +01:00
Mike Hommey
70a44929a9 Bug 1178266 - Link against libatomic when necessary r=huangwenjun06
---
 build/autoconf/toolchain.m4 | 26 ++++++++++++++++++++++++++
 mfbt/moz.build              |  3 +++
 2 files changed, 29 insertions(+)
2015-10-29 22:19:35 +08:00
L. David Baron
0d9a430784 Bug 1214958 - Add operators &=, |=, and ^= to mozilla::DebugOnly. r=froydnj 2015-10-19 20:42:28 -07:00
Cameron McCormack
e55561d84e Bug 1216041 - Add ranged iterator support to mozilla::{Array,RangedArray,EnumerationArray}. r=froydnj 2015-10-20 10:16:20 +11:00
Cameron McCormack
c0513349d0 Bug 1216040 - Make ArrayLength support mozilla::EnumeratedArray. r=froydnj 2015-10-20 10:16:20 +11:00
Cameron McCormack
0046a1f79e Bug 1216038 - Deduce underlying integer type for MakeEnumeratedRange starting at 0. r=froydnj 2015-10-20 10:16:19 +11:00
Chris Peterson
321b846872 Bug 1215411 - Define MOZ_FALLTHROUGH annotation to suppress clang's -Wimplicit-fallthrough warnings. r=botond 2015-10-04 21:03:26 -07:00
Nathan Froyd
e4e2da55c9 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
97a03d0a23 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
5254890206 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
Jim Blandy
53ca999364 No bug: Fix comment in mfbt/FastBernoulliTrial.h. DONTBUILD r=me 2015-10-16 12:21:39 -07:00
Steve Fink
c5e207327f Bug 1212624 - Tests for LinkedList, r=Waldo 2015-10-07 12:36:00 -07:00
Steve Fink
7b9dad56af Bug 1212624 - Implement range-based iteration for LinkedList, r=Waldo 2015-10-07 14:19:42 -07:00
Nathan Froyd
9543e0e93e Bug 1207245 - part 6a - call AddRef/Release from nsRefPtr itself, rather than a helper; r=botond
The problematic class is AtomicRefCountedWithFinalize, from gfx/layers/;
I don't know all the details for why that class is written the way it
is, but it is simpler to make nsRefPtr work the same way as
mozilla::RefPtr in this case.
2015-10-12 22:29:51 -04:00