Commit Graph

1749 Commits

Author SHA1 Message Date
Jeff Muizelaar
3cf4f88e68 Bug 1520559. Move DataMutex from EME to xpcom/threads. r=froydnj
This is a better place for it and is more appropriate given that it
already exports to mozilla/DataMutex.h. I'll fix the rvalue reference
problems in a follow up.

Differential Revision: https://phabricator.services.mozilla.com/D16723

--HG--
rename : dom/media/eme/DataMutex.h => xpcom/threads/DataMutex.h
extra : moz-landing-system : lando
2019-01-17 15:09:18 +00:00
Sylvestre Ledru
47a5dd1fb8 Bug 1519636 - Reformat everything to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D16388

--HG--
extra : moz-landing-system : lando
2019-01-16 08:50:07 +00:00
Eric Rahm
68491ea9df Bug 1437991 - Reduce scope of GetMainThread warning. r=froydnj
--HG--
extra : rebase_source : ec4e505fdefef42572e05a98348bef75473c8df2
2019-01-04 15:41:52 -08:00
Olli Pettay
7a31419242 Bug 1518038 - Add nsIThread.hasPendingHighPriorityEvents, r=froydnj
--HG--
extra : rebase_source : 47de7758f551bfe873426c8f92e27ac84ad4d260
2019-01-10 19:07:34 +02:00
Nathan Froyd
84a074ecfc Bug 1062533 - part 5 - add {Mutex,Monitor}::TryLock methods; r=mccr8
This plumbs the code from PlatformMutex up to the xpcom level.
2019-01-09 11:09:24 -04:00
Nathan Froyd
fc065671fb Bug 1513615 - part 3 - do more work in nsTimerEvent's constructor; r=glandium
nsTimerEvent goes through a multi-step initialization for reasons that
are lost to time.  We are also seeing peculiar crashes in
`nsTimerEvent::SetTimer()` that are only explainable by `SetTimer`
finding a non-null pointer where there should have been a null pointer.
The compiler ought to have been able to optimize those bits away, but no
matter: we can do the job ourselves and make the code clearer.

Since we only call `SetTimer` once, we should just move its work into
nsTimerEvent's constructor.
2019-01-08 19:31:40 -05:00
Nathan Froyd
7cb315f948 Bug 1513615 - part 2 - move some code around in PostTimerEvent; r=glandium
Doing this code movement separately will ideally make the next part of
this work easier to review.  The idea is that we want to extract all the
necessary information from `timer` before we pass ownership of it into
the newly-allocated nsTimerEvent.
2019-01-08 19:31:40 -05:00
Nathan Froyd
b9a6220890 Bug 1513615 - part 1 - tweak nsTimerEvent allocation; r=glandium
Unlike many of our uses of `new`, nsTimerEvent has its own definition of
`operator new`, to ensure instances are allocated through
TimerEventAllocator.  And allocating with TimerEventAllocator can fail.
Later changes, however, want to assume that constructing an nsTimerEvent
can't fail, which is difficult to guarantee with the current structure.

To make that guarantee, we need to make explicit what calling `new`
does: there's an "allocate memory" step and a "construct the object"
step.  The first part can fail, and that's what we care about here.
Once we have a chunk of memory, we can construct the object as normal,
secure in the knowledge that calling (placement) `new` is now guaranteed
to succeed.
2019-01-08 19:31:40 -05:00
Gabriele Svelto
cb1e8ac83e Bug 1386760 - Add a crash annotation containing the last executable we launched r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D12643

--HG--
extra : moz-landing-system : lando
2019-01-02 14:54:58 +00:00
Jean-Yves Avenard
cdec3ff52a Bug 1512456 - P9. Re-enable assertion. r=gerald
Depends on D14032

Differential Revision: https://phabricator.services.mozilla.com/D14138

--HG--
extra : moz-landing-system : lando
2018-12-11 17:43:19 +00:00
Jean-Yves Avenard
38ed72f936 Bug 1512456 - P2. Make GenericPromise exclusive. r=gerald
We introduce GenericNonExclusivePromise	that can be used to explicitly state than non-exclusive use is needed

We temporarily disable the assertion ensuring a promise is used exclusively when needed to allow for things to settle.

Differential Revision: https://phabricator.services.mozilla.com/D14025

--HG--
extra : moz-landing-system : lando
2018-12-11 10:46:17 +00:00
Jean-Yves Avenard
44594dd77a Bug 1510265 - P1. Enforce template-parameter classes restrictions in MozPromise. r=gerald
And some required fixes to make things compile.

Differential Revision: https://phabricator.services.mozilla.com/D13868

--HG--
extra : moz-landing-system : lando
2018-12-06 16:26:01 +00:00
Sylvestre Ledru
265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Ehsan Akhgari
490e611801 Bug 1508472 - Part 5: Fifth batch of comment fix-ups in preparation for the tree reformat r=sylvestre
This is a best effort attempt at ensuring that the adverse impact of
reformatting the entire tree over the comments would be minimal. I've used a
combination of strategies including disabling of formatting, some manual
formatting and some changes to formatting to work around some clang-format
limitations.

Differential Revision: https://phabricator.services.mozilla.com/D13371

--HG--
extra : moz-landing-system : lando
2018-11-29 10:30:46 +00:00
Andrew McCreight
68a1d4dad7 Bug 1508818, part 3 - Shrink comments so they don't get poorly reflowed by clang-format. r=froydnj
Clang format does not always reflow comments correctly to get them
within 80 columns.

The major categories of failures I have noticed in xpcom/ are:

- Comments that are lists. I fixed these by manually getting them so
  they'll be within 80 columns after clang-format runs.

- Comments intermixed with lists of things like enums, initializers,
  or even fields in a class. It doesn't seem to associate the comment
  with the item in the list correctly. The worst cases of these happen
  when it changes initializer lists from having commas at the start of
  each item to having them at the end. In the initializer comma cases,
  I fixed them by making the commas at the end, so clang-format won't
  mix things up. For other cases, I often moved the comment for an
  item onto its own line, because it was not possible to have both the
  comment and the item on the same line and stay within 80 columns.

- One odd case is nsEnumeratorUtils.cpp, where the end of line comment
  after a NS_DECL macro confused clang-format and made it stop
  realizing that the NS_DECL thing was a complete statement. I also
  added a blank line to that file before a declaration because I think
  that is better.

Depends on D13183

Differential Revision: https://phabricator.services.mozilla.com/D13184

--HG--
extra : moz-landing-system : lando
2018-11-28 21:06:09 +00:00
Gabriele Svelto
19e52bebd4 Bug 1510582 - Remove useless inclusions of Services.h r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D13240

--HG--
extra : moz-landing-system : lando
2018-11-28 17:25:23 +00:00
Gerald Squelart
1bd6a1fd4e Bug 1435091 - p4. Use profiler_thread_is_being_profiled() instead of profiler_is_active() around profiler_add_marker()s - r=mstange
(Unless there were other profiler actions, as I'm not sure yet whether it would
be safe to skip them when the profiler is paused; another bug should
investigate that.)

Differential Revision: https://phabricator.services.mozilla.com/D11308

--HG--
extra : moz-landing-system : lando
2018-11-19 06:29:15 +00:00
Jean-Yves Avenard
6561f5d257 Bug 1507093 - P1. Ensure we never leak OwnerType object. r=gerald
Potentially, if the watcher notification task failed to dispatch, we would have a cycle left between the WatchManager and the OwnerType

Differential Revision: https://phabricator.services.mozilla.com/D11857

--HG--
extra : moz-landing-system : lando
2018-11-15 12:47:59 +00:00
Coroiu Cristina
d850d799a0 Merge inbound to mozilla-central a=merge 2018-11-14 11:51:31 +02:00
Yaron Tausky
4db19652d1 Bug 1504638 - Put some of WorkerPrivate's members behind thread access guards r=asuth,baku,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D10368

--HG--
extra : moz-landing-system : lando
2018-11-13 20:22:40 +00:00
Jean-Yves Avenard
62bd78954f Bug 1505910 - P3. Remove now unused AsTaskQueue(). r=gerald
Depends on D11492

Differential Revision: https://phabricator.services.mozilla.com/D11493

--HG--
extra : moz-landing-system : lando
2018-11-09 21:38:38 +00:00
Jean-Yves Avenard
6ba9a04554 Bug 1505910 - P2. Remove use of AsTaskQueue(). r=cpearce
Make IsCurrentThreadIn() const.

Depends on D11491

Differential Revision: https://phabricator.services.mozilla.com/D11492

--HG--
extra : moz-landing-system : lando
2018-11-12 01:09:03 +00:00
Jean-Yves Avenard
31ed9de297 Bug 1504643 - Enforce template-parameter classes restrictions in MozPromise. r=gerald
Make thorough use of move semantic for MozPromise using nsTArray

Differential Revision: https://phabricator.services.mozilla.com/D11346

--HG--
extra : moz-landing-system : lando
2018-11-09 15:45:31 +00:00
Eric Rahm
a1f2e901e5 Bug 1504356 - Lock ThreadListMutex before accessing thread list. r=kmag
--HG--
extra : rebase_source : 728653b7568e8a602616522f38f1b6d68290fb55
2018-11-13 10:48:38 -08:00
Brian Hackett
579aa6d5df Bug 1503639 Part 7 - Remove instrumentation used to avoid taking locks after diverging from the recording, r=mccr8.
--HG--
extra : rebase_source : 4e08b46ebbe78ab175fd5a6b3e13da19b756f673
2018-10-31 10:23:23 -10:00
Jean-Yves Avenard
91dbdb0a68 Bug 1504531 - P2. Add MozPromiseHolder::ResolveOrReject methods. r=gerald
Depends on D10833

Differential Revision: https://phabricator.services.mozilla.com/D10834

--HG--
extra : moz-landing-system : lando
2018-11-04 22:36:43 +00:00
Jean-Yves Avenard
6f99745b62 Bug 1504531 - P1. Use forward references in MozPromiseHolder. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D10833

--HG--
extra : moz-landing-system : lando
2018-11-05 14:26:23 +00:00
shindli
7c0a5e2aef Merge inbound to mozilla-central. a=merge 2018-11-03 11:40:50 +02:00
Gerald Squelart
1d2a9c227e Bug 1503468 - Add more AUTO_PROFILER_THREAD_SLEEP's - r=mstange
These are around wait functions that already had an IDLE marker.

Differential Revision: https://phabricator.services.mozilla.com/D10671

--HG--
extra : moz-landing-system : lando
2018-11-02 16:26:50 +00:00
Valentin Gosu
84b31379ce Bug 1503725 - Do not deallocate nsThreadShutdownContext when leaking thread. r=erahm
Sometimes when we call ShutdownWithTimeout on a thread pool, the unresponsive
thread that we leak will actually complete before the main thread is done.
In that case, the thread will dereference the thread shutdown context, so
we must intentionally leak it too.

Differential Revision: https://phabricator.services.mozilla.com/D10645
2018-11-02 17:38:37 -04:00
Valentin Gosu
412446f4bc Bug 1500861 - Add shutdownWithTimeout method to nsIThreadPool r=froydnj,erahm
This method is necessary because some threads might be stuck making blocking
calls. This means the thread is not processing any events, and we're unable
to safely terminate it. Our solution here is to leak the stuck threads
instead of waiting for them and potentially causing a shutdown hang.

Differential Revision: https://phabricator.services.mozilla.com/D9601

--HG--
extra : moz-landing-system : lando
2018-10-26 18:46:00 +00:00
Jim Blandy
a78e7a516e Bug 1499534: Add Pause, Resume, and IsPaused methods to ThrottledEventQueue. r=froydnj
Depends on D8913

Differential Revision: https://phabricator.services.mozilla.com/D8914

--HG--
extra : moz-landing-system : lando
2018-10-23 06:21:10 +00:00
Nathan Froyd
6ac1ba1c91 Bug 1499723 - make IdleRunnableWrapper final; r=farre 2018-10-22 09:44:50 -04:00
Nathan Froyd
d81ba0426a Bug 1499725 - make IdleTaskRunner timers more efficient; r=farre
Instead of creating a timer and then setting the timer's target, we can
determine the timer's target and pass it in directly when the timer is
created.  This reordering of steps is slightly more efficient, since
SetTarget() is both a virtual call and requires locking, both of which
can be skipped if we know the target at timer creation time.  If we're
reusing the timer, we also don't need to repeatedly set the timer's
target: we can set the target once at timer creation, and then be done.

We can do this safely here because mTaskCategory doesn't change
throughout the life of the IdleTaskRunner; we make mTaskCategory `const`
to make this more explicit to the reader.
2018-10-22 09:44:50 -04:00
Brian Hackett
e1cc56fa0f Bug 1488808 Part 17 - Allow paints to happen at the normal time when recording/replaying, r=nical.
--HG--
extra : rebase_source : c9a5536a9eeff96937643fdf7bf68e56e437cef1
2018-10-17 10:16:30 -06:00
Brian Hackett
c1fc84be7c Bug 1488808 Part 16 - Avoid deadlocking in a few places after diverging from the recording, r=froydnj.
--HG--
extra : rebase_source : 2327cd9632cdc9ace793f9e9fea666d95f305201
2018-10-17 10:15:41 -06:00
Nathan Froyd
6d7cf47871 Bug 1498651 - make initial timer target setting more efficient; r=erahm
The NS_NewTimer* family of functions, when using a custom event target,
currently go through a path that looks something like:

  auto timer = createTimer()
  timer->SetTarget(target);
  // call the requisite Init* function
  return timer;

This setup is inefficient, because SetTarget requires the timer mutex to
be acquired.  The mutex acquisition here is completely unnecessary,
because the timer hasn't yet been shared out to the wider world; we can
set the timer target without acquiring the mutex at all because we know
that no sharing is possible at this point.

This patch reworks things somewhat to make that possible.
2018-10-17 19:57:36 -04:00
Jim Blandy
21708e2918 Bug 1499462: Remove dead failure handling and comments from ThrottledEventQueue::Create. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D8890

--HG--
extra : moz-landing-system : lando
2018-10-16 21:24:48 +00:00
Randell Jesup
12d6bb7b1c Bug 1299118: Implement Long Tasks API internals (not DOM access to it) r=froyd,mstange 2018-10-11 13:22:55 -04:00
shindli
0f211616dc Backed out 3 changesets (bug 1299118) for ES lint failures
Backed out changeset 14451eb9a2b8 (bug 1299118)
Backed out changeset e5adc30bdf7f (bug 1299118)
Backed out changeset 8f7bb583fbb5 (bug 1299118)
2018-10-11 20:47:58 +03:00
Randell Jesup
65111c20e6 Bug 1299118: Implement Long Tasks API internals (not DOM access to it) r=froyd,mstange 2018-10-11 13:22:55 -04:00
Andrew McCreight
837f0af066 Bug 1493737 - Fix many trivial calls to do_QueryInterface r=smaug
If class A is derived from class B, then an instance of class A can be
converted to B via a static cast, so a slower QI is not needed.

Differential Revision: https://phabricator.services.mozilla.com/D6861

--HG--
extra : moz-landing-system : lando
2018-10-01 21:38:01 +00:00
Jonathan Kew
75159145f4 Bug 1495306 - When InitOtherFamilyNames is called during stylo traversal, ensure it posts its runnable back to the main thread. r=kmag 2018-10-01 23:38:55 +02:00
Gabriele Svelto
7089fe7369 Bug 1493955 - Store floating-point preferences in a locale-independent way r=njn
Differential Revision: https://phabricator.services.mozilla.com/D6796

--HG--
extra : moz-landing-system : lando
2018-09-28 20:54:09 +00:00
Bogdan Tara
8449b1c489 Backed out changeset ba1fef7b14eb (bug 1493955) for GTest failures CLOSED TREE 2018-09-28 02:42:20 +03:00
Coroiu Cristina
8f256026f1 Merge mozilla-central to autoland a=merge ona CLOSED TREE 2018-09-28 00:41:04 +03:00
Gabriele Svelto
4d700e555a Bug 1493955 - Store floating-point preferences in a locale-independent way r=njn
Differential Revision: https://phabricator.services.mozilla.com/D6796

--HG--
extra : moz-landing-system : lando
2018-09-27 20:41:39 +00:00
Kris Maglione
81cc9843d0 Bug 1479035: Follow-up: Fix invarient which is no longer true. r=me 2018-09-26 22:08:43 -07:00
Kris Maglione
763d15b1fe Bug 1494513: Only allow calling Shutdown() from an XPCOM thread. r=erahm
This doesn't fix the problem, but at least moves the resulting assertion
closer to the problematic caller, and makes it easier to diagnose.

Differential Revision: https://phabricator.services.mozilla.com/D7042

--HG--
extra : rebase_source : 4a016d1dce77a269b886467c9343dab125079a8f
extra : amend_source : 4e9133e70932f382e0b5df9e487978b95d05781b
2018-09-26 21:59:55 -07:00
Kris Maglione
bf2e2a90f0 Bug 1479035: Part 2 - Get rid of PRThread to nsThread map. r=erahm
These maps hold strong references which complicate nsThread lifetime handling
considerably, and only have a couple of fringe uses. We have a linked list of
active threads that the thread manager can use for its internal enumeration
purposes, and the external uses are easily done away with, so there doesn't
seem to be much reason to keep the map around.

MozReview-Commit-ID: x7dsj6C4x8

--HG--
extra : source : 5f870621361012ba459943212d8c68a9ff81cb16
extra : intermediate-source : 89a0c0874d400dd324df6fc3627c0c47d130df19
extra : histedit_source : bbd7900e3d754bde925a411c10aa30a1d6e22edd
2018-07-27 15:26:08 -07:00