Commit Graph

1047 Commits

Author SHA1 Message Date
Kan-Ru Chen
b6d880aca1 Bug 1297276 - Rename mfbt/unused.h to mfbt/Unused.h for consistency. r=froydnj
The patch is generated from following command:

  rgrep -l unused.h|xargs sed -i -e s,mozilla/unused.h,mozilla/Unused.h,

MozReview-Commit-ID: AtLcWApZfES


--HG--
rename : mfbt/unused.h => mfbt/Unused.h
2016-08-24 14:47:04 +08:00
Kan-Ru Chen
506dfe6ea3 Bug 1264642 - Part 4. Use BufferList to replace raw buffers in StructuredClone. r=baku r=billm r=jorendorff
In JS StructuredClone BufferList<SystemAllocPolicy> is typedef'd to
JSStructuredCloneData and use everywhere in gecko that stores structured
clone data.

This patch changed some raw pointers to UniquePtr<JSStructuredCloneData>
and some to stack allocated JSStructuredCloneData for better life time
management. Some parameters or methods are deleted because of changing
to the new data structure.

MessagePortMessage now has the exactly same structure with
ClonedMessageData. Maybe in the future they can be consolidated.

MozReview-Commit-ID: 1IY9p5eKLgv
2016-08-23 00:40:46 +08:00
Kan-Ru Chen
3dcef6a932 Bug 1264642 - Part 3. Add BufferList::MoveFallible. r=billm
It works like a move constructor but it's fallible. It can also move
data to different but compatible AllocPolicy.

MozReview-Commit-ID: LAbPWCwnrr6
2016-08-23 00:40:46 +08:00
Kan-Ru Chen
6f3e6b1234 Bug 1264642 - Part 2. Add BufferList::Extract and Pickle::ExtractBuffers. r=billm
These methods allow us to move some buffers out of a pickle with minimum
copying. It's useful when the IPC deserialized type uses BufferList to
store data and we want to take the buffers from IPC directly.

Borrowing is not suitable to use for IPC to hand out data because we
often want to store the data somewhere for processing after IPC has
released the underlying buffers.

MozReview-Commit-ID: F1K2ZMkACqq
2016-08-23 00:40:45 +08:00
Michael Layzell
e1fc3b1773 Bug 1159244 - Add release mode bounds checking with custom annotations to nsTArray, r=froydnj
MozReview-Commit-ID: Ljx9PwBCyTT
2016-08-15 13:29:45 -04:00
Igor
175543fda8 Bug 1293384 - Part 2: Rename Snprintf.h header to Sprintf.h. r=froydnj 2016-08-14 23:43:21 -07:00
Igor
a57972337d Bug 1293384 - Part 1: Rename snprintf_literal to SprintfLiteral. r=froydnj 2016-08-14 23:44:00 -07:00
Jeff Walden
0c5ac6c90f Bug 1294537 - Don't tag |void* p| in the don't-nullcheck placement operator new overload as MOZ_NONNULL, because that makes a double-checking assertion of non-nullness into a compiler warning. r=froydnj
--HG--
extra : rebase_source : b53a1c5dce924ea030f54bb41e13baf27cd3d823
2016-08-12 18:02:03 -07:00
Nathan Froyd
0a6a801dc2 Bug 1294537 - introduce a non-null-checking placement operator new; r=sunfish,nbp
The default placement operator new is defined to always require that its
result be null-checked.  A sufficiently smart compiler can remove this
check, but not all compilers are sufficiently smart.  Better to have a
custom placement operator new that will remove null checks in a way
defined by the standard.
2016-08-12 22:43:49 -04:00
Tom Schuster
42824df666 Bug 1197324 - add format-string checking attribute to snprintf_literal. r=froydnj 2016-08-03 14:37:31 +02:00
Benjamin Bouvier
23575fdec5 Bug 1248555: Introduce variants of SpecificNaN / BitwiseCast that preserve the signaling NaN bit; r=froydnj
MozReview-Commit-ID: 5A8p06nBqyI

--HG--
extra : rebase_source : 87ebcc9792d42c6b2e6164a639340da37b4b602c
extra : histedit_source : b4ab7c6b9f4bb7fe2cc88a3208d6fa8e6fefce08
2016-08-01 20:02:05 +02:00
Daniel Holbert
489e357178 Bug 1291423: Explicitly qualify the destructor call that we invoke in Maybe::reset. r=Waldo
MozReview-Commit-ID: 6vQouBSxnsZ
2016-08-02 21:19:08 -07:00
Chris Peterson
9fc9590608 Bug 1289990 - Remove VS2013 workaround for TestTuple.cpp crash. r=froydnj
--HG--
extra : rebase_source : c5138bb0ea6a77b04030074ecebd85ba0808afa3
2016-07-27 23:13:08 -07:00
Cameron McCormack
fdb4542277 Bug 1290035 - Remove the explicit Type parameter to MakeEnumeratedRange. r=Waldo
MozReview-Commit-ID: BtFVn9pTQpU

--HG--
extra : rebase_source : be83c74953e2fbc7ace2ce49ceebb060da394c50
2016-07-28 17:48:50 +08:00
Andi-Bogdan Postelnicu
79a0735001 Bug 1283395 - add markup functions for static analysis builds. r=froydnj
MozReview-Commit-ID: 6dFygYzTYfN
2016-07-25 16:57:30 +03:00
Wes Kocher
1feda59958 Backed out changeset 9c839b1d1397 (bug 1283395) for static build bustage CLOSED TREE 2016-07-25 08:54:47 -07:00
Andi-Bogdan Postelnicu
440264fed8 Bug 1283395 - add markup functions for static analysis builds. r=froydnj
MozReview-Commit-ID: 6dFygYzTYfN
2016-07-25 17:43:14 +03:00
Nathan Froyd
6dad001d7f Bug 1238661 - fix mozilla::SignalTrampoline to work properly with clang; r=darchons
mozilla::SignalTrampoline is designed to work around a bug in older ARM
kernels; it constructs a trampoline function with a NOP slide and then
calls a specified function.  This feat is accomplished using inline
assembly and naked functions, which is a GCC extension where you get to
write the entire body of your function using GCC inline assembly.

Unfortunately, the particular implementation that it uses requires the
specified function's address to be loaded into a register.  GCC permits
this and we use input arguments to the assembly statement to ensure that
GCC knows it shouldn't clobber the incoming argument registers when
trying to load the function's address.

clang, however, complains about the use of input parameters in naked
functions.  So we need to find something that will work on both GCC and
clang.

The trick is to realize that we're a) tail-calling the specified
function and b) we don't have to worry about calling a fully-general
function.  We just have to worry about calling a function inside libxul,
and we can therefore "assume" that the offset between the branch and the
called function fits into the immediate field of a Thumb (or ARM) branch
instruction.  (This assumption is not strictly true; the branch range is
+/-16MB or so and libxul is actually quite a bit bigger than that.  But
it works in practice, and the linker will insert branch stubs if
necessary to make things work out OK.)

The upshot is that we can use a "b" instruction instead of a "bx"
instruction, and this makes clang much happier.  As a small bonus, the
stub gets ever-so-much-more efficient, which is probably the
least-significant micro-optimization ever.
2016-07-25 18:16:06 -04:00
Chris Peterson
b0efbe0ef8 Bug 1288603 - Remove NumericLimits.h because all platforms have numeric_limits<char16_t>. r=froydnj 2016-07-22 22:05:45 -07:00
Carsten "Tomcat" Book
336105a0de merge mozilla-inbound to mozilla-central a=merge 2016-07-22 11:58:02 +02:00
Tom Tromey
5538d692d3 Bug 1286877 - do not set c-basic-offset for python-mode; r=gps
This removes the unnecessary setting of c-basic-offset from all
python-mode files.

This was automatically generated using

    perl -pi -e 's/; *c-basic-offset: *[0-9]+//'

... on the affected files.

The bulk of these files are moz.build files but there a few others as
well.

MozReview-Commit-ID: 2pPf3DEiZqx

--HG--
extra : rebase_source : 0a7dcac80b924174a2c429b093791148ea6ac204
2016-07-14 10:16:42 -06:00
Chris Peterson
d634a99cad Bug 1277106 - Part 4: Remove MOZ_UTF16() macro. r=Waldo 2016-07-19 21:07:53 -07:00
Chris Peterson
8949f73d27 Bug 1277106 - Part 1: Use VS2015's real char16_t instead of aliasing wchar_t. r=Waldo
and remove MOZ_CHAR16_IS_NOT_WCHAR #ifdefs.
2016-07-20 22:01:43 -07:00
Carsten "Tomcat" Book
718ce69fb7 Backed out changeset c8e5a0703821 (bug 1283395) for bustage on a CLOSED TREE 2016-07-21 08:13:06 +02:00
Andi-Bogdan Postelnicu
d2d46ad585 Bug 1283395 - add markup functions for static analysis builds. r=froydnj
MozReview-Commit-ID: 1F5GGpQtq4x
2016-07-20 15:45:34 +03:00
Wes Kocher
3bba9b339e Backed out 5 changesets (bug 1287623) for static build bustage CLOSED TREE
Backed out changeset a48daec87ec9 (bug 1287623)
Backed out changeset 248153344e15 (bug 1287623)
Backed out changeset 8aa409c9b1ce (bug 1287623)
Backed out changeset 602d4d88e806 (bug 1287623)
Backed out changeset 114da8bdc0b0 (bug 1287623)
2016-07-20 15:40:33 -07:00
Andrew McCreight
155e619376 Bug 1287623, part 3 - Add more methods involving StaticRefPtr. r=froydnj
This patch adds a number of standard conversions to and from RefPtr<>
and already_AddRefed<>.
2016-07-20 15:19:00 -07:00
Andrew McCreight
a5a3cca3f9 Bug 1287623, part 3 - Add more methods involving StaticRefPtr. r=froydnj
This patch adds a number of standard conversions to and from RefPtr<>
and already_AddRefed<>.
2016-07-21 09:54:17 -07:00
Jeff Walden
efea1b6545 Bug 1287243 - Optimize the type used to store Variant's tag. r=fitzgen
--HG--
extra : rebase_source : c7c6fd63ea50330958ef794dc28cc8890ef59bbe
2016-07-16 02:31:45 -07:00
Terrence Cole
1fe18b25cf Bug 1232686 - Use decltype to infer Variant::match return type; r=fitzgen
--HG--
extra : rebase_source : 38f280cc3014b2285a79e377f1fa8edf4c5f4661
2015-12-15 07:45:22 -08:00
Boris Chiou
c329f132b7 Bug 1276573 - Add a new constructor for Range<T>. r=Waldo
These new constructor accepts two RangedPtr<T> arguments.

MozReview-Commit-ID: 8a3bYserLMr

--HG--
extra : rebase_source : 216de17b7a51783fe48d604b432d4dc7df6ad6eb
2016-05-30 13:58:13 +08:00
Chris Peterson
43c2748f66 Bug 1277775 - Replace MOZ_CONSTEXPR{_VAR,_TMPL} with constexpr. r=froydnj 2016-07-08 14:39:53 -07:00
Chris Peterson
2b3b60f7b1 Bug 1277155 - Part 1: Remove snprintf() polyfills for VS2013 in Sprintf.h and #defines. r=froydnj r=mhowell 2016-06-27 20:45:03 -07:00
Chris Pearce
ab7252caa2 Bug 1267918 - Add do_AddRef(const RefPtr<T>& aObj). r=froydnj
This means we can return already_AddRefed<T> for any RefPtr<T>s
being held as instance variables easier.

MozReview-Commit-ID: HFHdkF8EUsK

--HG--
extra : rebase_source : df650d39c010386afcb8cb2dd48292c26fbc6501
2016-06-30 10:06:10 +12:00
Jeff Walden
e20f0f4551 Bug 1282795 - Silence warnings when MOZ_ALWAYS_{TRUE,FALSE} are passed expressions with embedded side effects, that would ordinarily trigger side effects but don't inside certain unevaluated contexts within MOZ_ASSERT, which then triggers compiler warnings with new-enough clang. You are not expected to understand this. r=froydnj
--HG--
extra : rebase_source : ffe6d35af74c50b04dbddc9cc3965292875c64a0
2016-06-28 17:12:14 +01:00
Andi-Bogdan Postelnicu
5e3fc1519f Bug 525063 - renamed MOZ_INITIALIZED_OUTSIDE_CONSTRUCTOR -> MOZ_INIT_OUTSIDE_CTOR. r=nfroyd
MozReview-Commit-ID: GPQY8b2OM2V
2016-06-28 16:30:49 +03:00
Seth Fowler
a2712d4b0e Bug 1255632 - Make Maybe::map and Maybe::apply support lambdas. r=waldo,njn 2016-06-22 16:32:40 -07:00
Carsten "Tomcat" Book
c46c20b362 Backed out changeset 7b03f23fdde5 (bug 1255632) for bustage on a CLOSED TREE 2016-06-22 08:48:25 +02:00
Seth Fowler
358b410aaa Bug 1255632 - Make Maybe::map and Maybe::apply support lambdas. r=waldo,njn 2016-06-21 22:15:27 -07:00
Luke Wagner
fa9fafb015 Bug 1277896 - add Vector::initLengthUninitialized (r=waldo)
MozReview-Commit-ID: He6Kzr0giLU
2016-06-10 13:28:04 -05:00
Luke Wagner
6b6f143161 Bug 1278391 - add move constructor to EnumeratedArray (r=njn)
MozReview-Commit-ID: AQjH3xx9TSq

--HG--
extra : rebase_source : 599dc2bf76fa2921de6bf3b41c7d384db70a7ff9
2016-06-09 08:42:16 -05:00
Andi-Bogdan Postelnicu
12bac0f757 Bug 525063 - add attribute to mark member variables that should be skipped by clang plugin initialization checker. r=nfroyd
MozReview-Commit-ID: 4V1YcK2thiF
2016-06-09 09:32:11 +03:00
Andi-Bogdan Postelnicu
c735dfa442 Bug 1278201 - prevent writing |mRefCnt| after it's freed. r=Ms2ger
MozReview-Commit-ID: G7fZzrGWHmW

--HG--
extra : rebase_source : 6f311948a8d2222358aec860f2c6d6223862e814
2016-06-06 17:23:10 +03:00
L. David Baron
97c2e11d8c Bug 1273048 - Add MOZ_GCC_VERSION_AT_MOST macro. r=froydnj
MozReview-Commit-ID: 4VjAra5B6GM

--HG--
extra : transplant_source : %D3%C7C%05%7EB%24%90q%D3%22%C8%F5%8F%C7%C3%B4%00%A6%E2
2016-06-03 20:08:41 -07:00
Boris Chiou
acc84881a2 Bug 1277740 - Add const to RangedPtr<T>::operator+ and operator-. r=Waldo
MozReview-Commit-ID: FlHmq5eh5ph

--HG--
extra : rebase_source : 7e8939f0a9531426fa8fa742351d47f1d2351e72
2016-06-03 12:16:33 +08:00
Boris Chiou
4b68d2e1e4 Bug 1276550 - Support operator-> for RangedPtr. r=Waldo
MozReview-Commit-ID: EiOfo7ly34P

--HG--
extra : rebase_source : 6acbd9b3b6681f5c777e779713a21e8f808b89bf
2016-05-30 11:55:57 +08:00
Luke Wagner
e574e0eda0 Bug 1277377 - prevent unsafe C-style cast in Vector (r=waldo)
MozReview-Commit-ID: L0bTDSBHOeY
2016-06-02 14:38:02 -05:00
Nicholas Nethercote
b3d842431f Bug 1272203 (part 1) - Add mozilla::NotNull to MFBT. r=froydnj.
This patch implements mozilla::NotNull, which is similar but not identicial to
gsl::not_null.

The current draft(?) implementation of gsl::not_null is at
https://github.com/Microsoft/GSL/blob/master/include/gsl.h.

The main difference is that not_null allows implicit conversion from T to
not_null<T>. In contrast, NotNull only allows explicit conversion from T to
NotNull<T> via WrapNotNull().

The rationale for this is that when converting from a less-constrained type to
a more constrained type, implicit conversion is undesirable. For example, if I
changed a function f from this:

  f(int* aPtr);

to this:

  f(gsl::not_null<int*> aPtr);

no call sites would have to be modified. But if I changed it to this:

  f(mozilla::NotNull<int*> aPtr);

call sites *would* need to be modified. This is a good thing! It forces the
author to audit the call sites for non-nullness, and encourages them to
back-propagate NotNull throughout the code.

The other difference between not_null and NotNull is that not_null disables
pointer arithmetic, which means it cannot be used with array pointers. I have
not implemented this restriction for NotNull because it seems arbitrary and
unnecessary.
2016-05-12 14:21:16 +10:00
Chris Peterson
11ef78ae89 Bug 1275016 - Rename Endian.h to EndianUtils.h to avoid #include confusion with Android's endian.h stdlib header. r=froydnj
--HG--
rename : mfbt/Endian.h => mfbt/EndianUtils.h
2016-05-22 13:31:11 -07:00
Bill McCloskey
308608ab39 Bug 1262671 - Introduce MFBT BufferList class (r=froydnj) 2016-05-27 09:57:40 -07:00