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

306 Коммитов

Автор SHA1 Сообщение Дата
Gerald Squelart 5bea7c3a56 Bug 1410252 - MakeNotNull<PointerType, OptionalPointeeType>(Args...) - r=njn
MakeNotNull is similar to UniquePtr, in that it combines the infallible
allocation and construction of an object on the heap and wraps the (raw or
smart) pointer into a NotNull.
It skips the unnecessary null check from WrapNotNull, and removes the usual
naked 'new' used in many WrapNotNull calls.

MozReview-Commit-ID: UwCrhDnkUg

--HG--
extra : rebase_source : 5a027165fc17ed748783c7ffda03eb421865ad6e
2017-10-20 14:56:01 +11:00
Lee Salzman 70cd2a8499 Bug 1404742 - add test for ThreadSafeWeakPtr. r=nfroyd
MozReview-Commit-ID: GkNXsTLcN7m
2017-10-18 14:21:27 -04:00
Mike Hommey 9f2dd4775e Bug 1407468 - Replace multiple !JS_STANDALONE with MOZ_WIDGET_TOOLKIT. r=mshal
--HG--
extra : rebase_source : 4f9f9f583c3422ed0f8d1d65ea8e7575bd9baf2c
2017-10-05 14:50:01 +09:00
Chris Peterson a48326552c Bug 1405582 - Span: delete implicit constructors for char* and char16_t*. r=froydnj,hsivonen
Delete Span's implicit constructors for char* and char16_t* pointers to avoid accidental construction in cases where a pointer does not point to a zero-terminated string. Use the MakeStringSpan() function instead.

I deleted both the const and non-const char* and char16_t* constructors, in the name of cross-compiler consistency. If we only delete the const char* and char16_t* constructors, for some reason, MSVC complains that `Span<char> s(charArray)` uses a deleted constructor while clang nor gcc permit it. I don't know if this is a compiler bug in MSVC or clang and gcc.

Also, do not permit MakeSpan() for string literals (const char and char16_t arrays) because the Span length would include the zero terminator, which may surprise callers. Use MakeStringSpan() to create a Span whose length that excludes the string literal's zero terminator or use the MakeSpan() overload that accepts a pointer and length and specify the string literal's full length.

The following Span usages are prevented:

  Span<const char> span("literal"); // error
  Span<char> span(charArray); // error

  Span<const char> span;
  span = "literal"; // error
  span = charArray; // error

  MakeSpan("literal"); // error

The following Span usages are still permitted:

  assert(MakeStringSpan("literal") == 8); // OK: span length is calculated with strlen() and excludes the zero terminator
  MakeStringSpan(charArray); // OK: span length is calculated with strlen() and excludes the zero terminator
  MakeSpan(charArray); // OK: span length is the char array size including any zero terminator

MozReview-Commit-ID: Et71CpjsiyI

--HG--
extra : rebase_source : f6f8bdb28726f0f2368fdfdd039fb1d7dcf2914e
extra : source : 0547d8924ffc7713d6cf32cc06eeeaf00e0d69a3
2017-09-20 00:38:07 -07:00
Luke Wagner bb375a16d4 Bug 1329019 - Allow specifying capacity to Vector::replaceRawBuffer (r=froydnj)
MozReview-Commit-ID: 9Eq6PR53n4i
2017-09-22 10:34:24 -05:00
Luke Wagner 231c33a9fe Bug 1329019 - Vector::podResizeToFit should update reserved (r=froydnj)
MozReview-Commit-ID: CkoNRjxmjom
2017-09-22 10:33:36 -05:00
Matt Woodrow a56e3551a2 Bug 1397056 - Add Contains and a return parameter to Remove for SmallPointerArray. r=froydnj
* * *
[mq]: fix

MozReview-Commit-ID: 5laM7PQLP7X
2017-09-12 14:11:47 -04:00
Wes Kocher b1233c7d04 Backed out changeset 371a03aa9b24 (bug 1397056) for build errors in SmallPointerArray.h a=backout CLOSED TREE
MozReview-Commit-ID: FNVPjKmVCWB

--HG--
extra : rebase_source : 41e380e59d9eead945ba515d85c1b9195329bc74
2017-09-12 12:39:09 -07:00
Matt Woodrow 5675f29866 Bug 1397056 - Add Contains and a return parameter to Remove for SmallPointerArray. r=froydnj
* * *
[mq]: fix

MozReview-Commit-ID: 5laM7PQLP7X

--HG--
extra : rebase_source : f1baa7c1581fcc864d2b548989e967f57e24b921
2017-09-12 14:11:47 -04:00
Mike Hommey 0d8ed2b1a5 Bug 1396723 - Simplify the trait users of DoublyLinkedList need to define. r=froydnj
While the flexibility of the current trait is nice, it's actually not
used to its fullest anywhere, and is boilerplate-y. While it is useful
to be able to put the links anywhere, there's not much usefulness from
being able to split mNext and mPrev.

So instead of a trait that allows to get/set mNext and mPrev
independently, we just use a trait that tells how to get a reference to
a DoublyLinkedListElement from a list element itself.

--HG--
extra : rebase_source : 674277bac4fc979f2e483a77b5ef1495baccc7fe
2017-09-02 08:09:58 +09:00
Chris Manchester c0a229d4c3 Bug 1386876 - Replace all uses of DISABLE_STL_WRAPPING with a template, remove DISABLE_STL_WRAPPING. r=glandium
MozReview-Commit-ID: FMEtb5PY7iP

--HG--
extra : rebase_source : 3cdee7528846462c758e623d6bcd2e6e17dbabff
2017-09-11 11:33:26 -07:00
Phil Ringnalda bc78097d88 Backed out 2 changesets (bug 1396723) for !ElementAccess::Get(mHead).mPrev assertion failures
Backed out changeset 4f17343164b6 (bug 1396723)
Backed out changeset b744eba9ca78 (bug 1396723)

MozReview-Commit-ID: JbvM6oMxEFl
2017-09-06 21:39:20 -07:00
Mike Hommey b16f4035ba Bug 1396723 - Simplify the trait users of DoublyLinkedList need to define. r=froydnj
While the flexibility of the current trait is nice, it's actually not
used to its fullest anywhere, and is boilerplate-y. While it is useful
to be able to put the links anywhere, there's not much usefulness from
being able to split mNext and mPrev.

So instead of a trait that allows to get/set mNext and mPrev
independently, we just use a trait that tells how to get a reference to
a DoublyLinkedListElement from a list element itself.

--HG--
extra : rebase_source : f84c5799c305a4a3b7dc5deb727a05d4d537bb15
2017-09-02 08:09:58 +09:00
Wes Kocher f66c96f2c8 Backed out 2 changesets (bug 1396723) for build failures in TestDoublyLinkedList.cpp a=backout
Backed out changeset 1c0f9d069ade (bug 1396723)
Backed out changeset 6ca94a450b81 (bug 1396723)

MozReview-Commit-ID: 2w3WTvhpg6J
2017-09-06 14:30:41 -07:00
Mike Hommey 9a3dd41f50 Bug 1396723 - Simplify the trait users of DoublyLinkedList need to define. r=froydnj
While the flexibility of the current trait is nice, it's actually not
used to its fullest anywhere, and is boilerplate-y. While it is useful
to be able to put the links anywhere, there's not much usefulness from
being able to split mNext and mPrev.

So instead of a trait that allows to get/set mNext and mPrev
independently, we just use a trait that tells how to get a reference to
a DoublyLinkedListElement from a list element itself.

--HG--
extra : rebase_source : b7d502754a764670e291acdd56726948db935497
2017-09-02 08:09:58 +09:00
Botond Ballo 2c2d3ded79 Bug 1371771 - Add a MOZ_DEFINE_ENUM macro and variants to MFBT. r=froydnj
The macro simultaneously declares an enumeration and a count of its
enumerators.

A few variants of the macro are also provided to handle things like
enum classes, underlying types, and enumerations declared at class
scope.

MozReview-Commit-ID: 3z6yHnfXbLj

--HG--
extra : rebase_source : 92c333693e4bbf85b89cd3d7ac5b31f4b5434367
2017-06-30 19:58:11 -04:00
Chris Peterson 0a377e9314 Bug 1373525 - mfbt: Use unused GetPrev() member function in DoublyLinkedList test. r=froydnj
mfbt/tests/TestDoublyLinkedList.cpp:138:24 [-Wunused-member-function] unused member function 'GetPrev'

MozReview-Commit-ID: HQuTw0vXRKV

--HG--
extra : source : 0db3bd8a40d67a81b2f224dc9e63012cb832d0b9
extra : intermediate-source : 948c43ff15b4ca1a3db335544494562ec28e67cc
2017-06-11 14:39:42 -07:00
Petr Sumbera 80944c40d8 Bug 1158445 - posix_madvise() should be used instead of madvise on Solaris. r=froydnj, r=jandem 2017-06-09 00:59:32 -07:00
Henri Sivonen 854d241f4f Bug 1359874 - Make Span::Elements() always return a non-null pointer. r=froydnj.
MozReview-Commit-ID: AGvNlHmonpi
2017-06-13 13:22:34 +03:00
Gerald Squelart f5f8abf86a Bug 1338389 - Tests for Variant's detail::Nth and detail::SelectVariantType - r=froydnj
MozReview-Commit-ID: 4QXdctmhNze

--HG--
extra : rebase_source : ddbdf8c79f49ebb02c9e68dca0be4a6ee9ad11f4
2017-06-06 16:59:00 +12:00
Gerald Squelart a7c6eed190 Bug 1338389 - VariantType<T> and VariantIndex<N> permit unambiguous and variadic Variant construction - r=froydnj
MozReview-Commit-ID: 3rDya9ZBG6Y

--HG--
extra : rebase_source : d59375a7c805d6d470f5074669f3db5a609eb518
2017-05-08 11:26:07 +12:00
Gerald Squelart 78bc93af40 Bug 1338389 - Allow repeated Variant types, but prevent is/as/extract<T> for them - r=froydnj
MozReview-Commit-ID: 1yEUuGsht8k

--HG--
extra : rebase_source : fed56f264821e87cc474e6686e6dc203c147ac9b
2017-05-10 15:49:38 +12:00
Gerald Squelart 6015fbb5ac Bug 1338389 - Index-based Variant::is<N>, as<N>, and extract<N> - r=froydnj
MozReview-Commit-ID: C5iga0Eb1tH

--HG--
extra : rebase_source : d88cf614318cc8544d7ab52315e015a7ca4e5efd
2017-05-08 11:09:21 +12:00
Mike Hommey 38a6de0fe3 Bug 1369622 - Fix MOZ_FOR_EACH with an empty list. r=froydnj
I'm not sure how I tested MOZ_FOR_EACH in bug 1368932, but it turns out
it doesn't work with an empty list, despite
MOZ_PASTE_PREFIX_AND_ARG_COUNT now supporting 0 arguments.

Macros can be tricky, and it ends up being easier to make things work
cross-compiler with a separate macro that does the counting, and
(re)building MOZ_PASTE_PREFIX_AND_ARG_COUNT on top of that. Then
MOZ_FOR_EACH ends up working as expected with an empty list.

So this adds a MOZ_ARG_COUNT macro that counts the number of variadic
arguments it's given, and derives MOZ_PASTE_PREFIX_AND_ARG_COUNT from
it.

And this adds a testcase validating that MOZ_FOR_EACH works properly
with an empty list as a result.

--HG--
extra : rebase_source : 309371d87bd1561fbd2153f44fc1256185045d23
2017-06-02 14:53:54 +09:00
Mike Hommey c1becb4a54 Bug 1368932 - Allow MOZ_PASTE_PREFIX_AND_ARG_COUNT to work with 0 arguments. r=froydnj
At the same time, remove the MOZ_STATIC_ASSERT_VALID_ARG_COUNT, which
doesn't actually work for more than 50 arguments(*), and which is now not
useful to detect 0 arguments.

(*) the build fails, but not directly thanks to the static_assert it
expands to.

--HG--
extra : rebase_source : 8f0fe7b352c89b5a3ec87f42ef5464c370c362ef
2017-05-25 15:47:21 +09:00
Bas Schouten 5a025e5c1f Bug 1331718 - Part 2: Add unit tests for SmallPointerArray. r=froydnj
MozReview-Commit-ID: 7xdQfv7Dpph
2017-05-10 05:07:38 +02:00
Carsten "Tomcat" Book 157a9fcde2 Backed out changeset 4527bd35cc4e (bug 1331718) 2017-05-10 12:09:06 +02:00
Bas Schouten e8f8394b4e Bug 1331718 - Part 2: Add unit tests for SmallPointerArray. r=froydnj
MozReview-Commit-ID: 7xdQfv7Dpph
2017-05-10 05:07:38 +02:00
Olli Pettay a991315918 Bug 1358761 - dummy handling for return values in test, r=bustage 2017-05-05 10:43:37 +03:00
Olli Pettay 0096f25b51 Bug 1358761 - replace PurpleBlock with SegmentedVector to reduce indirect memory accesses when calling suspect, r=mccr8,nfroyd
--HG--
extra : rebase_source : e74be6bfb9efbba9361d2ce3c22518379a332200
2017-05-05 00:49:22 +03:00
Terrence Cole 4cd9f1b817 Bug 1277725 - Implement a list class that is both usable and efficient. r=waldo
MozReview-Commit-ID: JnhnomQwSja
2016-06-02 09:18:40 -07:00
Henri Sivonen 4064812605 Bug 1353324 - Add const char16_t variant of MakeCStringSpan() and rename both to MakeStringSpan(). r=froydnj.
MozReview-Commit-ID: E6LEZpe5H4w

--HG--
extra : rebase_source : dd6fe66be289e94751ecdf34113d79a091c9c8f8
2017-04-04 14:04:14 +03:00
Henri Sivonen c514501f1a Bug 1295611 - Add mozilla::Span. r=froydnj,gerv.
MozReview-Commit-ID: HGNDClVctbE
2017-03-31 13:32:18 +03:00
Benjamin Bouvier 1397cfaed9 Bug 1352073: Follow-up: don't use reserved() in opt builds; r=bustage
Also fix style to make it match local style.

MozReview-Commit-ID: D2HTik6HwxJ

--HG--
extra : rebase_source : 73d5a6d63597764d904f2d254ced08192871fdc0
2017-03-31 11:01:35 +02:00
Benjamin Bouvier 0eeedcfb9c Bug 1352073: Fix off-by-one in Vector::insert; r=luke
MozReview-Commit-ID: HY0DYSAbi6M

--HG--
extra : rebase_source : 15aaf8576c6c78e1dd097685947507445808ee0c
extra : histedit_source : 9ece90f05a7666784a381be085a82231aef5ef29
2017-03-30 16:20:30 +02:00
Tom Ritter da72de1e2e Bug 1349957 Change reference (in disabled code) to new/correct member r=froydnj
MozReview-Commit-ID: IwA2Kro40e2

--HG--
extra : rebase_source : 0bd5f3e85ba36d068f0b23984a1faa5dcd4ccd78
2017-03-23 10:27:25 -05:00
Nicolas B. Pierron dccaffb213 Bug 1325073 - Rename mozilla::MakeGenericErrorResult to mozilla::Err. r=Waldo 2017-03-08 13:33:07 +00:00
Xidorn Quan b7ebe87cdc Bug 1345074 - Add MOZ_FOR_EACH_SEPARATED which adds separator between items. r=Waldo
MozReview-Commit-ID: IWqs17MLhHD

--HG--
extra : rebase_source : adc004b185501c9fe8109589fb671cd5a6551002
2017-03-07 22:28:49 +11:00
Jeff Walden fceda02d9b Bug 1287006 - Use |alignas(T) unsigned char mStorage[sizeof(T)]| instead of AlignedStorage2 inside Maybe. r=froydnj
--HG--
extra : rebase_source : 59e8039481b332decacd1acc7cf1cb73ec8b78cf
2017-01-30 15:56:04 -08:00
Jeff Walden 8529eb5317 Bug 1338374 - Shrink Vector from (usually) four pointers in size to three when no inline storage is used. r=froydnj
--HG--
extra : rebase_source : bc2c7f706305d04954162720b011029c8095229f
2017-01-30 15:56:05 -08:00
Nicolas B. Pierron 06bb70ebad Bug 1318677 part 3 - mozilla::Result: Add a new packing strategy to pack small enumerated values in a single word. r=Waldo 2017-02-07 18:57:43 +00:00
Jonathan Watt 33a6ca0109 Bug 1335780, part 2 - Tests for Maybe<const Type>. r=froydnj 2017-01-03 08:53:05 +00:00
John Paul Adrian Glaubitz ba58645c87 Bug 1329194 - mfbt:tests: Define RETURN_INSTR for SH in TestPoisonArea. r=glandium 2017-01-20 09:12:22 +09:00
David Major bbf01a2d5f Bug 1329236: Remove the DECLTYPE(expr) workaround in TestMaybe.cpp. r=ehsan
MozReview-Commit-ID: 5n5iRdJKn7M

--HG--
extra : rebase_source : 181165142b1f39c59c404b0b692383dd63a423b9
2017-01-06 12:53:20 -06:00
Nathan Froyd f6a73ed989 Bug 1315274 - rename mozilla::MakeRange to mozilla::IntegerRange; r=Waldo
MakeRange is just way too generic for this sort of thing.
2017-01-06 09:22:53 -05:00
Xidorn Quan b4ceaa3474 Bug 1325351 part 3 - Make Maybe accept value from different Maybe type when the inner type is convertible. r=froydnj
MozReview-Commit-ID: 2kYTncYh1Or

--HG--
extra : rebase_source : f3263ce10f3afae6e8ac734296dbb0e641c55c99
2016-12-23 11:49:33 +11:00
Sebastian Hengst 6c5fadc6f5 Backed out changeset 45f0755ff471 (bug 1325351) 2016-12-27 10:39:45 +01:00
Xidorn Quan 3cead98957 Bug 1325351 part 3 - Make Maybe accept value from different Maybe type when the inner type is convertible. r=froydnj
MozReview-Commit-ID: 2kYTncYh1Or

--HG--
extra : rebase_source : 2d15fb3c252f1c0505d739d9540079ceb9296b39
2016-12-23 11:49:33 +11:00
Nick Fitzgerald a19333ea56 Bug 1324829 - Add the `mozilla::Result::andThen` method; r=froydnj 2016-12-21 13:05:56 -08:00
Nick Fitzgerald f40c749727 Bug 1324828 - Add the `mozilla::Result::map` method; r=froydnj 2016-12-21 13:05:56 -08:00