Commit Graph

87 Commits

Author SHA1 Message Date
Tom Bannister
9257bacc72 Bug 1434710 - Replaced all instances of mozilla::IndexSequence, mozilla::MakeIndexSequence and mozilla::IndexSequenceFor with std::index_sequence, std::make_index_sequence and std::index_sequence_for and removed mfbt/IndexSequence.h. r=botond
MozReview-Commit-ID: 1Ema7TUNr5v
2018-04-09 21:12:13 +10:00
Sebastian Hengst
d91e9954eb Backed out 4 changesets (bug 525063) on request from Andi. a=backout
Backed out changeset 516c4fb1e4b8 (bug 525063)
Backed out changeset 6ff8aaef2866 (bug 525063)
Backed out changeset bf13e4103150 (bug 525063)
Backed out changeset d7d2f08e051c (bug 525063)
2018-04-13 16:01:28 +03:00
Tristan Bourvon
6095241db8 Bug 525063 - Initialize uninitialized class attributes in m-c. r=ehsan 2018-04-10 21:11:02 +02:00
Jan-Ivar Bruaroey
eed866f96a Bug 1445533 - Use for(:) in MozPromise code. r=gerald
MozReview-Commit-ID: BsKR2o25hIQ
2018-03-13 19:13:18 -04:00
Jan-Ivar Bruaroey
68d54801f0 Bug 1445533 - Remove a refcount in MozPromise::Steal(), and use MakeRefPtr a few places. r=gerald
MozReview-Commit-ID: 2jFzxiqBVpc
2018-03-13 09:55:01 -04:00
Jean-Yves Avenard
c99ce8a313 Bug 1424647: Prevent race on AllPromiseHolder::mPromise. r=jwwang
If any of the promises gets resolved/rejected prior MozPromise::All completing, it would return nullptr

MozReview-Commit-ID: Lqhv2t2upvF
2017-12-10 23:31:04 +01:00
Chris Pearce
5f60cd2ec7 Bug 1390406 - Remove unnecessary includes in dom/media/mediasource. r=jya
MozReview-Commit-ID: 1aTncGfBicu
2017-08-15 16:13:00 +12:00
JW Wang
0ef5ff9675 Bug 1371982 - Use a RefPtr<> to hold the MozPromise. r=gerald 2017-06-26 20:13:27 -04:00
Bill McCloskey
ce42826bdf Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Carsten "Tomcat" Book
238bf154d5 Backed out changeset 4f6302a98ae4 (bug 1372405) 2017-06-21 13:59:26 +02:00
Bill McCloskey
67e8af4720 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-20 21:44:11 -07:00
Carsten "Tomcat" Book
bbe9441993 Backed out changeset 9846de3bd954 (bug 1372405) 2017-06-20 08:27:02 +02:00
Bill McCloskey
f69608368b Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-19 22:25:47 -07:00
Bill McCloskey
366b1553cc Bug 1366072 - Change promises to take nsISerialEventTarget instead of AbstractThread (r=jwwang)
MozReview-Commit-ID: 4azUhSB6whu
2017-06-13 14:51:01 -07:00
Bill McCloskey
646957c563 Bug 1366072 - Remove useless ThenCommand::mResponseThread field (r=jwwang)
MozReview-Commit-ID: F9shMirkSiu
2017-06-13 14:50:56 -07:00
Gerald Squelart
04350ed235 Bug 1371880 - Use Variant with indexed access in MozPromise::ResolveOrRejectValue - r=jwwang
MozReview-Commit-ID: 4vobU19ebaX
2017-06-12 11:19:58 +12:00
JW Wang
f389fe40b2 Bug 1370453 - fix potential race condition in ThenCommand<>::Track(). r=gerald
http://searchfox.org/mozilla-central/rev/d441cb24482c2e5448accaf07379445059937080/xpcom/threads/MozPromise.h#953-958

MozPromiseRequestHolder is not thread-safe and it is possible for
mReceiver->ThenInternal() to trigger resolve/reject callbacks before
aRequestHolder.Track() is run. We should call aRequestHolder.Track()
before mReceiver->ThenInternal() to avoid the race condition.

MozReview-Commit-ID: K2R09m9UFBF
2017-06-06 14:19:59 +08:00
Sylvestre Ledru
2b6b73b3e9 Bug 1370369 - Use the new MOZ_DIAGNOSTIC_ASSERT_ENABLED instead of several defines - follow up patch r=froydnj
MozReview-Commit-ID: I4ffmvKClc6
2017-06-05 23:43:34 +02:00
JW Wang
d6e6a93530 Bug 1367679. P4 - specialize the type of mCompletionPromise according to whether chaining is supported. r=gerald
MozReview-Commit-ID: 8dPXiGl5njE
2017-06-02 10:16:31 +08:00
JW Wang
843f53a1b6 Bug 1367679. P3 - pass mCompletionPromise to InvokeCallbackMethod(). r=gerald
This reduces duplicate code by handling promise chaining in one place.

MozReview-Commit-ID: 474T5hvf9oM
2017-05-31 17:28:09 +08:00
JW Wang
d5ae40c7ac Bug 1367679. P2 - overload InvokeCallbackMethod() according to whether promise-chaining is supported. r=gerald
This patch fixes InvokeCallbackMethod() which should return null
if promise-chaining is not supported.

Before this patch, it could return non-null if one of the resolve/reject callbacks
returns a MozPromise while the other not.

MozReview-Commit-ID: 7YKNvRKEHQx
2017-05-31 17:08:08 +08:00
JW Wang
ca72f88059 Bug 1367679. P1 - refactor InvokeCallbackMethod() to deal with one concern at a time. r=gerald
InvokeMethod() handles optional arguments.
InvokeCallbackMethod() handles optional return value.

MozReview-Commit-ID: AyT6TEKRqbs
2017-05-26 00:12:29 +08:00
JW Wang
04fc61e797 Bug 1370005. P1 - backout bug 1367679. r=gerald
MozReview-Commit-ID: 4SUCinaz3Cj
2017-06-05 14:03:34 +08:00
JW Wang
7547d537ee Bug 1367679. P4 - specialize the type of mCompletionPromise according to whether chaining is supported. r=gerald
MozReview-Commit-ID: 8dPXiGl5njE
2017-06-02 10:16:31 +08:00
JW Wang
b18776bbfd Bug 1367679. P3 - pass mCompletionPromise to InvokeCallbackMethod(). r=gerald
This reduces duplicate code by handling promise chaining in one place.

MozReview-Commit-ID: 474T5hvf9oM
2017-05-31 17:28:09 +08:00
JW Wang
34f23dcc14 Bug 1367679. P2 - overload InvokeCallbackMethod() according to whether promise-chaining is supported. r=gerald
This patch fixes InvokeCallbackMethod() which should return null
if promise-chaining is not supported.

Before this patch, it could return non-null if one of the resolve/reject callbacks
returns a MozPromise while the other not.

MozReview-Commit-ID: 7YKNvRKEHQx
2017-05-31 17:08:08 +08:00
JW Wang
618acca962 Bug 1367679. P1 - refactor InvokeCallbackMethod() to deal with one concern at a time. r=gerald
InvokeMethod() handles optional arguments.
InvokeCallbackMethod() handles optional return value.

MozReview-Commit-ID: AyT6TEKRqbs
2017-05-26 00:12:29 +08:00
JW Wang
79cc609f82 Bug 1368382. P4 - move mCompletionPromise down the class hierarchy so it can store a different promise type. r=gerald
MozReview-Commit-ID: 4beSwBzN8b3
2017-05-25 17:35:47 +08:00
JW Wang
dd774f4f8f Bug 1368382. P3 - remove 2 overloads of Then() using variadic template. r=gerald
MozReview-Commit-ID: 9KzYGnrFoQN
2017-05-31 16:10:17 +08:00
JW Wang
eb6721b690 Bug 1368382. P2 - let ThenCommand reference the sub-type of ThenValueBase. r=gerald
Since we will store mCompletionPromise in the sub-class of ThenValueBase,
ThenCommand needs to reference the sub-type in order to access mCompletionPromise.

MozReview-Commit-ID: BUi7jElOhP7
2017-05-31 15:23:43 +08:00
JW Wang
8bf44b29ab Bug 1368382. P1 - rename and make MethodThenValue/FunctionValue specializations of ThenValue<>. r=gerald
This allows us to remove 2 overloads of MozPromise::Then() using variadic template.

MozReview-Commit-ID: 5LHwDhIhh8e
2017-05-31 07:44:53 +08:00
JW Wang
43ca0428a3 Bug 1367674. P2 - remove unused code. r=gerald
MozReview-Commit-ID: 5OHWP5rpiff
2017-05-25 15:42:35 +08:00
JW Wang
dd5e50c0d2 Bug 1367674. P1 - add templates to deal with CV and argument number correctly. r=gerald
MozReview-Commit-ID: 5qeSBDny6uc
2017-05-25 15:41:01 +08:00
Kan-Ru Chen
9477907ae1 Bug 1365827 - Make MozPromise::Private::{Resolve,Reject} no-op when it's not pending. r=jwwang
MozReview-Commit-ID: 5HbUS9yA29K
2017-05-24 13:46:19 -04:00
JW Wang
06ced1b283 Bug 1362910. P1 - enable move when IsExclusive is true. r=gerald
When IsExclusive is true, there is at most only one consumer.
So it is safe to move the ResolveOrRejectValue stored in the promise.

MozReview-Commit-ID: ED9fFr7TkvN
2017-05-11 01:30:12 +08:00
JW Wang
af151b8cf3 Bug 1363676. P1 - use Variant as the internal storage of ResolveOrRejectValue. r=gerald
MozReview-Commit-ID: 4B3M3hvfvyz
2017-05-09 18:24:18 +08:00
JW Wang
2e0cddf589 Bug 1362912. P1 - disallow promise chaining when any of the Then callbacks doesn't return a promise. r=gerald
A template won't be instatiated until used. We make it a compile error
to call Then() on ThenCommand<false> to disallow promise chaining.

MozReview-Commit-ID: BUCFgfX4FTJ
2017-05-09 23:11:42 +08:00
JW Wang
6dbc497c9e Bug 1361942 - Store ActualArgTypes instead of ArgTypes for we are sending data of ActualArgTypes types to another thread. r=gerald
This allows more use of the implicit version of InvokeAsync() without specifying the storage types explicitly.

MozReview-Commit-ID: 40WisaVX8Jy
2017-05-03 12:34:50 +08:00
JW Wang
bed26355de Bug 1361263 - allow InvokeAsync() to accept a member function which is pass-by-reference. r=gerald
StoreCopyPassByRRef<> ensures a copy is stored in the runnable.
We don't have to worry about the concern of bug 1300476.

MozReview-Commit-ID: DHqlzlVLBFV
2017-04-30 15:37:19 +08:00
Michael Layzell
7879c55e61 Bug 1355597 - Support passing empty arrays to MozPromise::All, r=jwwang
MozReview-Commit-ID: Knhm0N9huuo
2017-04-12 12:09:48 -04:00
JW Wang
77507128f8 Bug 1353618 - Optimize storage of MozPromise::mThenValues. r=gerald
1. Set the capacity to 1 when IsExclusive is true.
2. Set it to 3 because Try shows we never have more the 3 elements when IsExclusive is false.

MozReview-Commit-ID: dmIeE6ZTeh
2017-03-31 18:41:29 +08:00
Nathan Froyd
c3e1f810e7 Bug 1312087 - part 1 - move mozilla::{Mutex,CondVar} to use mozglue locking primitives; r=erahm
This change moves us away from NSPR primitives for our primary
synchronization primitives.  We're still using PRMonitor for
ReentrantMonitor, however.

The benefits of this change:

* Slightly faster, as we don't have to deal with some of NSPR's overhead;

* Smaller datatypes.  On POSIX platforms in particular, PRLock is
  enormous. PRCondVar also has some unnecessary overhead.

* Less dynamic memory allocation.  Out of necessity, Mutex and CondVar
  allocated the NSPR data structures they needed, which lead to
  unnecessary checks for failure.

  While sizeof(Mutex) and sizeof(CondVar) may get bigger, since they're
  embedding structures now, the total memory usage should be less.

* Less NSPR usage.  This shouldn't need any explanation.
2017-03-21 10:20:36 -05:00
Ben Kelly
9d3d01933a Bug 1345251 Make MozPromise usable on worker threads. r=gerald 2017-03-08 11:45:07 -05:00
Carsten "Tomcat" Book
f4f3d56e3d merge mozilla-inbound to mozilla-central a=merge 2017-03-01 11:40:59 +01:00
Kyle Machulis
098c8da606 Bug 1343337 - Remove IsDispatchReliable check from AbstractThread; r=bholley
MozReview-Commit-ID: JxnyAZpzIcV
2017-02-28 20:34:37 -08:00
Kyle Machulis
3eb378a2d4 Bug 1343335 - Add asserts to check for null AbstractThread targets in MozPromise; r=bholley
AbstractThread::GetCurrent() can return null if a thread isn't a
default AbstractThread (MainThread, etc). This doesn't get caught in
MozPromise until we try to check for reliability of dispatching on the
thread. Adding asserts to make things clearer on crashes.

MozReview-Commit-ID: AQJwpdTUiHZ
2017-02-28 20:34:37 -08:00
JW Wang
febe12b8a1 Bug 1342831 - devirtualize AssertIsDead(). r=gerald
MozReview-Commit-ID: 9dNDiTfwlLR
2017-02-25 22:56:49 +08:00
Iris Hsiao
759114f782 Backed out changeset e3df33f21fab (bug 1342831) for test leak 2017-02-27 17:13:25 +08:00
JW Wang
0ce00e5d6c Bug 1342831 - devirtualize AssertIsDead(). r=gerald
MozReview-Commit-ID: 9dNDiTfwlLR
2017-02-25 22:56:49 +08:00
JW Wang
f35d6647a3 Bug 1339677. Part 4 - check if mMutex.mLock is tampered. r=gerald
MozReview-Commit-ID: H37EnCF0V4w
2017-02-15 16:42:26 +08:00