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

975 Коммитов

Автор SHA1 Сообщение Дата
Alessio Placitelli 756ef8e1ff Bug 1219751 - Change the the depth limit of the thread hangs stack to use the 99th percentile. r=gfritzsche 2015-10-29 08:05:00 +01:00
Alessio Placitelli 24467c91c6 Bug 1219216 - Fix a wrong comment in BackgroundHangMonitor.h. r=gfritzsche 2015-10-28 05:47:00 +01:00
Eric Rahm 5b38c55967 Bug 1174785 - Part 2: Convert xpcom over to LogModule. r=froydnj
--HG--
extra : rebase_source : 58d3b32bd0174f2540512cef810cafdd3556ef6b
2015-10-19 12:50:14 -07:00
Cervantes Yu 072315fb98 Bug 1213795, Part 1: Don't fire timers in the Nuwa process to fix test case test_NuwaProcessDeadlock.html. r=khuey 2015-10-19 14:32:12 +08:00
Nathan Froyd 01583602a9 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

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Nathan Froyd 583afa0965 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
Alessio Placitelli cf4ad8cd56 Bug 1211411 - Limit the number of thread hang stats reported to Telemetry. r=vladan 2015-10-16 07:04:00 +02:00
Xidorn Quan c5703449ed Bug 1186745 part 5 - Make nsThread::Dispatch() always leak the event if it fails. r=froydnj
--HG--
extra : source : 969aedd9d9b6ee25b679954228f26c043969a29e
2015-10-06 13:00:59 +11:00
Xidorn Quan e573430f7d Bug 1186745 part 4 - Make TracedRunnable accept an already_AddRefed instead of a raw pointer. r=froydnj
--HG--
extra : source : 0a748a541a5425602ed0af670ffdb031c11dd627
2015-10-06 13:00:59 +11:00
Xidorn Quan 0c51f5c14f Bug 1186745 part 3 - Make nsThreadSyncDispatch leak the sync task by default when Run() is not called. r=froydnj
--HG--
extra : source : 7eda5d8e2da47a0ff4f15e6a4d20f1ca108e5931
2015-10-06 13:00:59 +11:00
Xidorn Quan d98cc8899a Bug 1186745 part 2 - Move nsThreadSyncDispatch class to its own header file. r=froydnj
--HG--
extra : source : ec17a3b46e134cbf99a74d581a89d7dea10f0af0
2015-10-06 13:00:59 +11:00
Xidorn Quan 98d15627f8 Bug 1186745 part 1 - Add LeakRefPtr for pointer leaking by default. r=froydnj
This class can be used instead of raw pointer for a sound leaking-by-default
behavior. Also it could take advantage of move semantic check in the future.

--HG--
extra : source : 6bf72b4eaa92b13d42b547d8aeee677489a4d3e2
2015-10-06 13:00:59 +11:00
Wes Kocher 1d312920f4 Backed out 6 changesets (bug 1186745) for android Cpp failures
Backed out changeset 237a6acf0709 (bug 1186745)
Backed out changeset 7b530871783a (bug 1186745)
Backed out changeset 73f73b531fc8 (bug 1186745)
Backed out changeset e36909748ddf (bug 1186745)
Backed out changeset 3a31df8787f0 (bug 1186745)
Backed out changeset df9cb8f5f0a5 (bug 1186745)
2015-10-02 10:35:09 -07:00
Xidorn Quan e660a06960 Bug 1186745 part 5 - Make nsThread::Dispatch() always leak the event if it fails. r=froydnj
--HG--
extra : source : 5ae98bb877bc7be5f48f79c88c4b70340786dfee
2015-10-03 00:18:24 +10:00
Xidorn Quan d148f6ae66 Bug 1186745 part 4 - Make TracedRunnable accept an already_AddRefed instead of a raw pointer. r=froydnj
--HG--
extra : source : 343cc4075627fb4dc7c78e8cef590a82e8ef044c
2015-10-03 00:18:24 +10:00
Xidorn Quan 12865b3d6a Bug 1186745 part 3 - Make nsThreadSyncDispatch leak the sync task by default when Run() is not called. r=froydnj
--HG--
extra : source : 897260be14effa39b648fc4a07a9e727b527edab
2015-10-03 00:18:24 +10:00
Xidorn Quan 21fa30d414 Bug 1186745 part 2 - Move nsThreadSyncDispatch class to its own header file. r=froydnj
--HG--
extra : source : c92a7df2cc4043cb2795a0c4b085283165287973
2015-10-03 00:18:24 +10:00
Xidorn Quan 4dad63f727 Bug 1186745 part 1 - Add LeakRefPtr for pointer leaking by default. r=froydnj
This class can be used instead of raw pointer for a sound leaking-by-default
behavior. Also it could take advantage of move semantic check in the future.

--HG--
extra : source : 47cd2c22bafc8d4bb1c7e1dce3b45517aaec199f
2015-10-03 00:18:24 +10:00
Jean-Yves Avenard 181f3f61e0 Bug 1207312: P1. Prevent crash when more than one promise is rejected. r=bholley 2015-10-01 19:07:36 +10:00
Phil Ringnalda c096566a7e Back out 6 changesets (bug 1186745) for cpptest failure in runnable_utils_unittest, nrappkit_unittest, test_nr_socket_unittest
Backed out changeset c6142b815de0 (bug 1186745)
Backed out changeset d8f740ef2430 (bug 1186745)
Backed out changeset edc0b56d81fa (bug 1186745)
Backed out changeset 383f8ac033ea (bug 1186745)
Backed out changeset ce960a661987 (bug 1186745)
Backed out changeset 3e9783023fb2 (bug 1186745)

--HG--
extra : rebase_source : 4681d6abaaa927ddb863f944efc87e6c6f6c2e26
2015-09-28 19:05:02 -07:00
Xidorn Quan d6ed2bb25e Bug 1186745 part 5 - Make nsThread::Dispatch() always leak the event if it fails. r=froydnj
--HG--
extra : source : 9647b16628882dc9908e4a9cff084fc1d53c7df6
2015-09-29 09:28:22 +10:00
Xidorn Quan 33369f9d5f Bug 1186745 part 4 - Make TracedRunnable accept an already_AddRefed instead of a raw pointer. r=froydnj
--HG--
extra : source : 8ed5530cadd2199943b073f372d6568ee5d88267
2015-09-29 09:28:22 +10:00
Xidorn Quan 8de4cf8292 Bug 1186745 part 3 - Make nsThreadSyncDispatch leak the sync task by default when Run() is not called. r=froydnj
--HG--
extra : source : 3e192a3bcd8686bfc49c58012f4b17ed8fdc7c45
2015-09-29 09:28:22 +10:00
Xidorn Quan 5a61756f88 Bug 1186745 part 2 - Move nsThreadSyncDispatch class to its own header file. r=froydnj
--HG--
extra : source : ae110eaaa626064dd81188d4f587a2df1f439bd2
2015-09-29 09:28:22 +10:00
Xidorn Quan 661f0a0891 Bug 1186745 part 1 - Add LeakRefPtr for pointer leaking by default. r=froydnj
This class can be used instead of raw pointer for a sound leaking-by-default
behavior. Also it could take advantage of move semantic check in the future.

--HG--
extra : source : 3dbd000739dc0ea214a2292e3983469e41e99686
2015-09-29 09:28:22 +10:00
James Cheng a73837f641 Bug 1206598 - Use universal reference to reduce the redundant copy. r=nfroyd
--HG--
extra : rebase_source : b8feaad38dd7731f8a838b82324b3953af21ff78
2015-09-20 23:30:00 +02:00
Chris Peterson 9911646ce8 Bug 1207031 - Suppress -Wshadow warnings from google-breakpad headers in xpcom/threads. r=froydnj 2015-09-21 22:41:52 -07:00
Nathan Froyd 8bb05ee37e Bug 1202497 - follow-up - fix static analysis bustage; r=me 2015-09-22 19:25:37 -04:00
Nathan Froyd 3eae8069d0 Bug 1202497 - part 7 - make nsEventQueue use external locking; r=gerald
We want to ensure that nsThread's use of nsEventQueue uses locking done
in nsThread instead of nsEventQueue, for efficiency's sake: we only need
to lock once in nsThread, rather than the current situation of locking
in nsThread and additionally in nsEventQueue.  With the current
structure of nsEventQueue, that would mean that nsThread should be using
a Monitor internally, rather than a Mutex.

Which would be well and good, except that DOM workers use nsThread's
mutex to protect their own, internal CondVar.  Switching nsThread to use
a Monitor would mean that either:

- DOM workers drop their internal CondVar in favor of nsThread's
  Monitor-owned CondVar.  This change seems unlikely to work out well,
  because now the Monitor-owned CondVar is performing double duty:
  tracking availability of events in nsThread's event queue and
  additionally whatever DOM workers were using a CondVar for.  Having a
  single CondVar track two things in such a fashion is for Experts Only.

- DOM workers grow their own Mutex to protect their own CondVar.  Adding
  a mutex like this would change locking in subtle ways and seems
  unlikely to lead to success.

Using a Monitor in nsThread is therefore untenable, and we would like to
retain the current Mutex that lives in nsThread.  Therefore, we need to
have nsEventQueue manage its own condition variable and push the
required (Mutex) locking to the client of nsEventQueue.  This scheme
also seems more fitting: external clients merely need synchronized
access to the event queue; the details of managing notifications about
events in the event queue should be left up to the event queue itself.

Doing so also forces us to merge nsEventQueueBase and nsEventQueue:
there's no way to have nsEventQueueBase require an externally-defined
Mutex and then have nsEventQueue subclass nsEventQueueBase and provide
its own Mutex to the superclass.  C++ initialization rules (and the way
things like CondVar are constructed) simply forbid it.  But that's OK,
because we want a world where nsEventQueue is externally locked anyway,
so there's no reason to have separate classes here.

One casualty of this work is removing ChaosMode support from
nsEventQueue.  nsEventQueue had support to delay placing events into the
queue, theoretically giving other threads the chance to put events there
first.  Unfortunately, since the thread would have been holding a lock
(as is evident from the MutexAutoLock& parameter required), sleeping in
PutEvent accomplishes nothing but delaying the thread from getting
useful work done.  We should support this, but it's complicated to
figure out how to reasonably support this right now.

A wrinkle in this overall pleasant refactoring is that nsThreadPool's
threads wait for limited amounts of time for new events to be placed in
the event queue, so that they can shut themselves down if no new events
are appearing.  Setting limits on the number of threads also needs to be
able to wake up all threads, so threads can shut themselves down if
necessary.

Unfortunately, with the transition to nsEventQueue managing its own
condition variable, there's no way for nsThreadPool to perform these
functions, since there's no Monitor to wait on.  Therefore, we add a
private API for accessing the condition variable and performing the
tasks nsThreadPool needs.

Prior to all the previous patches, placing items in an nsThread's event
queue required three lock/unlock pairs: one for nsThread's Mutex, one to
enter nsEventQueue's ReentrantMonitor, and one to exit nsEventQueue's
ReentrantMonitor.  The upshot of all this work is that we now only
require one lock/unlock pair in nsThread itself, as things should be.
2015-09-20 05:13:09 -04:00
Nathan Froyd c6238d0d96 Bug 1202497 - part 6 - make the locking requirements of nsEventQueue explicit; r=gerald
Like the previous patch, this patch is a no-op change in terms of
functionality.  It does, however, pave part of the way for forcing
clients of nsEventQueue to provide their own locking.
2015-09-21 04:34:51 -04:00
Nathan Froyd 2c79a08dbd Bug 1202497 - part 5 - make the locking requirements of nsChainedEventQueue explicit; r=gerald
This patch is a no-op in terms of functionality.  It ensures that we're
always holding nsThread's mutex when we touch mEvents, as dictated by
the comments.  Putting this addition into its own patch will help make
the change to having nsEventQueue by guarded by a Mutex, rather than a
Monitor, somewhat clearer.
2015-09-20 04:59:56 -04:00
Nathan Froyd 2851bffa03 Bug 1202497 - part 4 - lock around call to nsChainedEventQueue::HasPendingEvent; r=gerald
This is another case of an access to mEvents not being protected by
mLock.  Future patches will make this locking requirement explicit in
nsChainedEventQueue, so we won't have problems like this.  (Since
nsEventQueue has its own locking at this point, this omission didn't
matter much, but the omission will most certainly matter later.)
2015-09-20 04:47:10 -04:00
Nathan Froyd 90bdddcda8 Bug 1202497 - part 3 - remove nsThread::GetEvent; r=gerald
GetEvent was only called from one place, so it wasn't terribly useful as
an abstraction.  It also broke the invariant that we protect accesses to
mEvents with mLock, as documented in nsThread.h.  While upcoming patches
could have just updated GetEvent to do the necessary locking on its own,
it seemed just as easy to make the locking requirements at the callsite,
as will be done for other accesses to mEvents.
2015-09-20 04:44:51 -04:00
Nathan Froyd 556c7604e5 Bug 1202497 - part 2 - remove ReentrantMonitor specializations for nsEventQueueBase; r=gerald
Now that nsEventQueue no longer depends on ReentrantMonitors, we can get
rid of these unused specializations.
2015-09-20 04:17:05 -04:00
Nathan Froyd 5593d06e9c Bug 1202497 - part 1 - switch nsEventQueue to use a non-reentrant Monitor; r=gerald
nsEventQueue's monitor does not require re-entrancy now that the monitor
is not externally visible.  Since ReentrantMonitors require two separate
mutex lock/unlock pairs (one on entry, and one on exit), this cuts the
amount of locking nsEventQueue's methods do by half.
2015-09-14 21:52:08 -04:00
Nicholas Nethercote cb3685d2fb Bug 1205941 - Make TimerFirings logging output post-processible with fix_linux_stack.py. r=glandium. 2015-09-21 17:13:51 -07:00
Nathan Froyd 8108bffcc3 Bug 1121216 - disable BackgroundHangMonitor for TSan builds; r=jchen 2015-08-04 00:27:59 -04:00
Jim Chen 5d85f6dea6 Bug 1196381 - Eliminate breakpad dependency in ThreadStackHelper; r=nfroyd r=snorp
The breakpad dependency in ThreadStackHelper is preventing us from
upgrading our in-tree copy to a newer version (bug 1069556). This patch
gets rid of that dependency. This makes native stack frames not work
for BHR, but because of the ftp.m.o decommissioning, native
symbolication was already broken and naive stack frames already don't
work, so we don't really lose anything from this patch.

Eventually we want to make ThreadStackHelper use other means of
unwinding, such as LUL for Linux

I added | #if 0 | around the code to fill the thread context, but left
the code in because I think we'll evenually want to reuse some of that
code.
2015-09-18 09:17:10 -04:00
Nicholas Nethercote 0d5b7b370d Bug 1203427 (part 6) - Add link to MDN docs about TimerFirings logging. r=me.
DONTBUILD because comment-only change.

--HG--
extra : rebase_source : 0f94403df66f19ad4382d89655fac0da6ccaf294
2015-09-16 21:49:24 -07:00
Nicholas Nethercote f429eae6a5 Bug 1203427 (part 5) - Add logging of timer firings. r=froydnj. 2015-09-10 00:50:51 -07:00
Nicholas Nethercote f2c0ec4c11 Bug 1203427 (part 4) - Remove trailing whitespace from nsITimer.idl. r=froydnj.
IGNORE IDL because whitespace only changes.
2015-09-14 15:57:17 -07:00
Nicholas Nethercote 886074f2e3 Bug 1203427 (part 3) - Change order of InitCommon() arguments. r=froydnj.
This makes the order of |aDelay| and |aType| match those of the InitWith*()
functions.

I've made this change because the inconsistency tripped me up during the
development of part 4.

--HG--
extra : rebase_source : 7d49f3f643e76955ea3de57e0954deb22cda3ddf
2015-09-14 15:57:17 -07:00
Kyle Huey 0efe211e55 Bug 1200922: Add the ability to shut down a thread asynchronously. r=froydnj 2015-09-14 18:24:43 -07:00
Nathan Froyd 85d7b073ac Bug 1202828 - use nsEventQueue::HasPendingEvent in nsThread.cpp; r=mccr8
nsEventQueue's HasPending event is defined to simply:

  return GetEvent(false, nullptr);

So we can substitute HasPendingEvent for this particular GetEvent call
to make the code clearer.
2015-09-04 20:39:10 -04:00
Randell Jesup 5e0e7e846c Bug 1197152: Alternative to remove all sleep/wake functionality from Timers r=froydnj
CLOSED TREE

--HG--
extra : amend_source : 8c363c570bea046904f2f9d7bf72b107012653d7
2015-09-08 11:34:09 -04:00
Nathan Froyd 444fb07360 Bug 1202667 - make TaskQueue task running slightly more efficient; r=mccr8
We can transfer the reference out of the queue of runnables instead of
taking a new reference right before we drop the old one.
2015-09-07 20:02:16 -04:00
Nathan Froyd fbb4e33fce Bug 1202667 - make TaskQueue dispatching slightly more efficient; r=mccr8
We're already holding a reference to the Runner prior to dispatching it
to the thread pool; we can pass that reference in rather than requiring
the thread pool to take a new reference to it.
2015-09-07 19:51:54 -04:00
Nathan Froyd 17c37f82b5 Bug 1195767 - part 5 - use signaling instead of broadcast when work items are placed in nsEventQueue; r=gerald
There's no reason to wake up all the threads in a thread pool when one
item gets placed in the queue.  Waking up one will serve the same
purpose and is significantly more efficient for thread pools with large
numbers of threads.
2015-09-03 16:38:18 -04:00
Nathan Froyd 8502eaeea7 Bug 1195767 - part 4 - remove nsEventQueue::GetReentrantMonitor; r=gerald
The last commit eliminated the only client of this method, so we can
remove it now.
2015-09-03 16:37:51 -04:00
Nathan Froyd aafe5d489a Bug 1195767 - part 3 - modify nsThreadPool to use a non-reentrant monitor; r=gerald
There's no reason nsThreadPool needs to use a reentrant monitor for
locking its event queue.  Having it use a non-reentrant one should be
slightly more efficient, both in the general operation of the monitor,
and that we're not performing redundant locking in methods like
nsThreadPool::Run.  This change also eliminates the only usage of
nsEventQueue::GetReentrantMonitor.
2015-09-03 15:38:28 -04:00
Nathan Froyd 92e6eccda2 Bug 1195767 - part 2 - create an nsEventQueueBase templated over the monitor type; r=gerald
Clients of nsEventQueue don't always need fully reentrant monitors.
Let's account for that by having a base class templated on the monitor
type.  This change also opens up the possibility of having the monitor
for the event queue not owned by the event queue itself, but by the
client class, which makes a lot more sense than the current design.
2015-08-28 13:26:17 -04:00
Nathan Froyd 1e05c1710d Bug 1195767 - part 1 - remove nsCOMPtr temporary from nsEventQueue::PutEvent; r=gerald
The comment here suggests that we might AddRef/Release, but we really do
no such thing.  Let's deal with the transfer of ownership directly,
rather than going through nsCOMPtr.  This change makes the code slightly
smaller, and it also makes later refactorings to pull the lock out of
this function easier to do, since we don't have to consider how to hold
the lock within the lifetime of the nsCOMPtr temporary.
2015-08-28 14:19:49 -04:00
Nicholas Nethercote f44287005f Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.

--HG--
extra : rebase_source : 82e3387abfbd5f1471e953961d301d3d97ed2973
2015-08-27 20:44:53 -07:00
Cervantes Yu 3c09a9761d Bug 1166207 - Load preload.js in the Nuwa process. r=khuey
--HG--
extra : rebase_source : 292c5e5dbee5fa49a78fd1997d97094ef2190143
2015-08-28 17:57:44 +08:00
Chris Peterson 6b261a1c9e Bug 1197563 - Polyfill __func__ for MSVC 2013 and earlier. r=froydnj 2015-08-20 23:39:18 -07:00
Miko Mynttinen ba173ae5e4 Bug 1197316 - Remove PR_snprintf calls in xpcom/. r=froydnj 2015-08-22 17:57:52 -07:00
Bobby Holley ef08c1794f Bug 1188976 - Improve MozPromise.h comment. r=me DONTBUILD 2015-08-19 17:13:45 -07:00
Bobby Holley 4ad57e8274 Bug 1195867 - Hoist StateWatching and StateMirroring into XPCOM. r=froydnj
--HG--
rename : dom/media/StateMirroring.h => xpcom/threads/StateMirroring.h
rename : dom/media/StateWatching.h => xpcom/threads/StateWatching.h
2015-08-18 15:37:06 -07:00
Bobby Holley a663591994 Bug 1188976 - Hoist MozPromise into xpcom. r=froydnj
--HG--
rename : dom/media/MozPromise.h => xpcom/threads/MozPromise.h
2015-08-17 14:54:45 -07:00
Kyle Huey 76e3009ab8 Bug 1179909: Refactor stable state handling. r=smaug
This is motivated by three separate but related problems:

1. Our concept of recursion depth is broken for things that run from AfterProcessNextEvent observers (e.g. Promises). We decrement the recursionDepth counter before firing observers, so a Promise callback running at the lowest event loop depth has a recursion depth of 0 (whereas a regular nsIRunnable would be 1). This is a problem because it's impossible to distinguish a Promise running after a sync XHR's onreadystatechange handler from a top-level event (since the former runs with depth 2 - 1 = 1, and the latter runs with just 1).

2. The nsIThreadObserver mechanism that is used by a lot of code to run "after" the current event is a poor fit for anything that runs script. First, the order the observers fire in is the order they were added, not anything fixed by spec. Additionally, running script can cause the event loop to spin, which is a big source of pain here (bholley has some nasty bug caused by this).

3. We run Promises from different points in the code for workers and main thread. The latter runs from XPConnect's nsIThreadObserver callbacks, while the former runs from a hardcoded call to run Promises in the worker event loop. What workers do is particularly problematic because it means we can't get the right recursion depth no matter what we do to nsThread.

The solve this, this patch does the following:

1. Consolidate some handling of microtasks and all handling of stable state from appshell and WorkerPrivate into CycleCollectedJSRuntime.
2. Make the recursionDepth counter only available to CycleCollectedJSRuntime (and its consumers) and remove it from the nsIThreadInternal and nsIThreadObserver APIs.
3. Adjust the recursionDepth counter so that microtasks run with the recursionDepth of the task they are associated with.
4. Introduce the concept of metastable state to replace appshell's RunBeforeNextEvent. Metastable state is reached after every microtask or task is completed. This provides the semantics that bent and I want for IndexedDB, where transactions autocommit at the end of a microtask and do not "spill" from one microtask into a subsequent microtask. This differs from appshell's RunBeforeNextEvent in two ways:
a) It fires between microtasks, which was the motivation for starting this.
b) It no longer ensures that we're at the same event loop depth in the native event queue. bent decided we don't care about this.
5. Reorder stable state to happen after microtasks such as Promises, per HTML. Right now we call the regular thread observers, including appshell, before the main thread observer (XPConnect), so stable state tasks happen before microtasks.
2015-08-11 06:10:46 -07:00
Bobby Holley f97159c6b7 Bug 1190495 - Hoist TaskQueue into xpcom. r=froydnj
--HG--
rename : dom/media/TaskQueue.cpp => xpcom/threads/TaskQueue.cpp
rename : dom/media/TaskQueue.h => xpcom/threads/TaskQueue.h
2015-08-11 08:55:22 -04:00
Alfredo Yang 8c59fda383 Bug 1146086: use promise to Init() in PlatformDecoderModule. r=jya,r=cpearce 2015-08-11 14:09:12 +10:00
Bobby Holley 5bb15d3a58 Bug 1190492 - Hoist AbstractThread and TaskDispatcher to xpcom. r=froydnj
--HG--
rename : dom/media/AbstractThread.cpp => xpcom/threads/AbstractThread.cpp
rename : dom/media/AbstractThread.h => xpcom/threads/AbstractThread.h
rename : dom/media/TaskDispatcher.h => xpcom/threads/TaskDispatcher.h
2015-08-07 16:38:35 -07:00
Nicholas Nethercote 0a97485195 Bug 1190735 - Remove nsITimer.TYPE_REPEATING_PRECISE. r=froydnj.
--HG--
extra : rebase_source : e4424bde52b0f90adbd328071f62b89193098d34
2015-08-04 17:30:53 -07:00
Bobby Holley ad1880d040 Bug 1191063 - Followup comments. r=me DONTBUILD 2015-08-04 17:36:06 -07:00
Birunthan Mohanathas 7315345693 Bug 1191100 - Remove XPIDL signature comments in .cpp files. r=ehsan
Comment-only so DONTBUILD.
2015-08-04 16:17:36 -07:00
Bobby Holley b5a26b0b15 Bug 1190496 - Hoist SharedThreadPool into xpcom. r=froydnj
--HG--
rename : dom/media/SharedThreadPool.cpp => xpcom/threads/SharedThreadPool.cpp
rename : dom/media/SharedThreadPool.h => xpcom/threads/SharedThreadPool.h
2015-08-04 14:00:58 -07:00
Byron Campen [:bwc] 309a57122b Bug 1059572 - Part 2: Make absolutely sure a timer is removed before reinitting it. r=nfroyd
--HG--
extra : rebase_source : 9a952241e046321a25adf52167bd7a538d25f37a
2015-07-28 10:10:54 -05:00
Byron Campen [:bwc] e145322168 Bug 1059572 - Part 1: Move PostTimerEvent to TimerThread to allow TimerThread's monitor to protect it. r=nfroyd
--HG--
extra : rebase_source : ec9623818cd1a5f3a2665a1c4af4be7869c0dec3
2015-07-22 12:39:34 -05:00
Kyle Huey ee4f5ba9fb Bug 1185470: Remove 'Get' prefixes from hashtable iterator methods. r=froydnj 2015-07-20 20:21:28 +08:00
Benoit Girard fe3dfcf5b2 Bug 1182516 - Add Chaos Mode environment variable MOZ_CHAOSMODE. r=roc
--HG--
extra : commitid : qfYBMvxZ7k
extra : rebase_source : 4c7098464712d7e5fa88ba1d8fba7c044772b0d6
2015-07-14 17:29:23 -04:00
Birunthan Mohanathas a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Nicholas Nethercote f32a629f7d Bug 1181445 (part 12) - Use nsBaseHashTable::Iterator in xpcom/threads/. r=froydnj.
--HG--
extra : rebase_source : 76f747c7ac22df28cc78a8afea0e25f3b4b2aa07
2015-07-09 16:54:59 -07:00
Randell Jesup f5e826fd1d Bug 1155059: Patch 4 - invoke NS_ASSERTION if DispatchToMainThread fails to get MainThread ptr r=froydnj 2015-07-09 23:21:46 -04:00
Randell Jesup c87c478f4f Bug 1155059: Patch 1&2 - Convert Dispatch() and friends to already_AddRefed<> r=froydnj
Modify Dispatch IDL and code to deal with MSVC issues with overloaded templates r=froydnj
2015-07-09 23:21:46 -04:00
Randell Jesup 78f6d80fa0 Bug 1178890: Update timer arrays after sleep to account for time sleeping r=bwc,froydnj 2015-07-09 20:18:34 -04:00
Bill McCloskey 43786e09b5 Bug 1177013 - Use CancelCurrentTransaction to avoid crashes (r=dvander) 2015-07-06 19:58:44 -07:00
Fabrice Desré 6929a81516 Bug 1180533 - Disable BackgroundHangMonitor on gonk 2015-07-05 18:30:51 -07:00
Juan Gomez 258ad59e3f Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj 2015-07-03 18:29:00 -07:00
Phil Ringnalda 166cfe8460 Back out 12 changesets (bug 1177013) on suspicion of causing b2g emulator debug test bustage
CLOSED TREE

Backed out changeset 912aae0815f8 (bug 1177013)
Backed out changeset 3b6448172e50 (bug 1177013)
Backed out changeset 2af18bef5703 (bug 1177013)
Backed out changeset e6bf35115c11 (bug 1177013)
Backed out changeset 4d7f5205b60b (bug 1177013)
Backed out changeset f7de893911bc (bug 1177013)
Backed out changeset de79eba232f0 (bug 1177013)
Backed out changeset 978a77b60f2a (bug 1177013)
Backed out changeset f5b52fa19511 (bug 1177013)
Backed out changeset e14a7b70b6fa (bug 1177013)
Backed out changeset d0f5a3474659 (bug 1177013)
Backed out changeset bff9f07dad52 (bug 1177013)
2015-07-02 22:08:54 -07:00
Bill McCloskey 72a845c0e6 Bug 1177013 - Use CancelCurrentTransaction to avoid crashes (r=dvander) 2015-07-02 17:18:10 -07:00
Nathan Froyd 4d01d51096 Bug 1178363 - make nsTimerImpl::GetGeneration a private method; r=poiru
Since GetGeneration() is only called by nsTimerEvent, it doesn't need to
be public.
2015-06-29 13:09:11 -04:00
Nathan Froyd ed7e987ecb Bug 1178363 - make nsTimerImpl::PostTimerEvent a private method; r=poiru
PostTimerEvent is only called by the timer thread, which is already able
to access private members of nsTimerImpl; there's no reason for
PostTimerEvent to be public.
2015-06-29 10:33:30 -04:00
Nathan Froyd 889fc1ad61 Bug 1178363 - make MOZ_TASK_TRACER-dependent bits of nsTimerImpl private; r=poiru
GetTracedTask() is only called from nsTimerImpl itself, so it doesn't
need to be public.  GetTLSTraceInfo() is called from the timer thread,
which has access to our private members already.
2015-06-18 12:02:23 -04:00
Nathan Froyd 4fea06a3a3 Bug 1178363 - make nsTimerImpl::Fire a private method; r=poiru
This method is only called by nsTimerEvent, which is an implementation
detail of nsTimerImpl.
2015-06-18 12:00:56 -04:00
Nathan Froyd 22b75ae28f Bug 1178363 - make nsTimerImpl::SetDelayInternal a private method; r=poiru
Nothing outside nsTimerImpl uses it, and with a name like
"SetDelayInternal", nothing should.
2015-06-17 21:40:18 -04:00
Ryan VanderMeulen 5f5c327690 Backed out changeset 8b4e4083639e (bug 1171931) for B2G debug emulator bustage. 2015-06-25 19:48:42 -04:00
Juan Gomez 702a59d135 Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj
--HG--
extra : rebase_source : 2ecbe6c1dd8a7ad8dc529b53349ad431cf1116c9
2015-06-24 14:11:00 -04:00
Benoit Girard 8d6a67f6d3 Bug 1172216 - Move nsStackwalk to mozglue. r=glandium
--HG--
rename : xpcom/base/nsStackWalk.cpp => mozglue/misc/StackWalk.cpp
rename : xpcom/base/nsStackWalk.h => mozglue/misc/StackWalk.h
extra : commitid : EMbWGfjKvdq
extra : rebase_source : b7308eb569cc1a019d3b7a92aaff0de7a49b5682
2015-06-10 16:32:45 -04:00
Shelly Lin 4eff0a1842 Bug 1113562 - Expected delay time of tasks should not be the latency of those kind. r=sinker
--HG--
extra : rebase_source : b5e012fb6570e87270a0924fbe395dc56e6242ec
2015-06-16 10:57:19 +08:00
Eric Rahm 75c4bebb79 Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj
This is straightforward mapping of PR_LOG levels to their LogLevel
counterparts:
  PR_LOG_ERROR   -> LogLevel::Error
  PR_LOG_WARNING -> LogLevel::Warning
  PR_LOG_WARN    -> LogLevel::Warning
  PR_LOG_INFO    -> LogLevel::Info
  PR_LOG_DEBUG   -> LogLevel::Debug
  PR_LOG_NOTICE  -> LogLevel::Debug
  PR_LOG_VERBOSE -> LogLevel::Verbose

Instances of PRLogModuleLevel were mapped to a fully qualified
mozilla::LogLevel, instances of PR_LOG levels in #defines were mapped to a
fully qualified mozilla::LogLevel::* level, and all other instances were
mapped to us a shorter format of LogLevel::*.

Bustage for usage of the non-fully qualified LogLevel were fixed by adding
|using mozilla::LogLevel;| where appropriate.
2015-06-03 15:25:57 -07:00
Eric Rahm f50b813989 Bug 1165515 - Part 3: Convert PR_LOG_TEST to MOZ_LOG_TEST. r=froydnj 2015-06-03 15:22:28 -07:00
Carsten "Tomcat" Book 5471309381 Backed out 14 changesets (bug 1165515) for linux x64 e10s m2 test failures
Backed out changeset d68dcf2ef372 (bug 1165515)
Backed out changeset 7c3b45a47811 (bug 1165515)
Backed out changeset b668b617bef2 (bug 1165515)
Backed out changeset d0916e1283a2 (bug 1165515)
Backed out changeset ac4dc7489942 (bug 1165515)
Backed out changeset e9632ce8bc65 (bug 1165515)
Backed out changeset c16d215cc7e4 (bug 1165515)
Backed out changeset e4d474f3c51a (bug 1165515)
Backed out changeset d87680bf9f7c (bug 1165515)
Backed out changeset b3c0a45ba99e (bug 1165515)
Backed out changeset 9370fa197674 (bug 1165515)
Backed out changeset 50970d668ca1 (bug 1165515)
Backed out changeset ffa4eb6d24b9 (bug 1165515)
Backed out changeset 5fcf1203cc1d (bug 1165515)

--HG--
extra : rebase_source : 6fb850d063cbabe738f97f0380302153e3eae97a
2015-06-02 13:05:56 +02:00
Eric Rahm a9afd68cef Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj
This is straightforward mapping of PR_LOG levels to their LogLevel
counterparts:
  PR_LOG_ERROR   -> LogLevel::Error
  PR_LOG_WARNING -> LogLevel::Warning
  PR_LOG_WARN    -> LogLevel::Warning
  PR_LOG_INFO    -> LogLevel::Info
  PR_LOG_DEBUG   -> LogLevel::Debug
  PR_LOG_NOTICE  -> LogLevel::Debug
  PR_LOG_VERBOSE -> LogLevel::Verbose

Instances of PRLogModuleLevel were mapped to a fully qualified
mozilla::LogLevel, instances of PR_LOG levels in #defines were mapped to a
fully qualified mozilla::LogLevel::* level, and all other instances were
mapped to us a shorter format of LogLevel::*.

Bustage for usage of the non-fully qualified LogLevel were fixed by adding
|using mozilla::LogLevel;| where appropriate.
2015-06-01 22:17:33 -07:00
Eric Rahm 141e0ff4a2 Bug 1165515 - Part 3: Convert PR_LOG_TEST to MOZ_LOG_TEST. r=froydnj 2015-06-01 22:17:19 -07:00
Wes Kocher 4e9f80ed2e Backed out 14 changesets (bug 1165515) for b2g mochitest-6 permafail CLOSED TREE
Backed out changeset 9b97e2aa2ed9 (bug 1165515)
Backed out changeset 150606c022a2 (bug 1165515)
Backed out changeset 4e875a488349 (bug 1165515)
Backed out changeset 467e7feeb546 (bug 1165515)
Backed out changeset d6b6cc373197 (bug 1165515)
Backed out changeset 0615265b593c (bug 1165515)
Backed out changeset fafd1dce9f08 (bug 1165515)
Backed out changeset d1df869245f9 (bug 1165515)
Backed out changeset 6876a7c63611 (bug 1165515)
Backed out changeset b7841c94a9a3 (bug 1165515)
Backed out changeset e5e3617f7c73 (bug 1165515)
Backed out changeset 39be3db95978 (bug 1165515)
Backed out changeset 0ec74176f8de (bug 1165515)
Backed out changeset 5b928dd10d71 (bug 1165515)
2015-06-01 17:57:58 -07:00
Eric Rahm f82c0e7caf Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj
This is straightforward mapping of PR_LOG levels to their LogLevel
counterparts:
  PR_LOG_ERROR   -> LogLevel::Error
  PR_LOG_WARNING -> LogLevel::Warning
  PR_LOG_WARN    -> LogLevel::Warning
  PR_LOG_INFO    -> LogLevel::Info
  PR_LOG_DEBUG   -> LogLevel::Debug
  PR_LOG_NOTICE  -> LogLevel::Debug
  PR_LOG_VERBOSE -> LogLevel::Verbose

Instances of PRLogModuleLevel were mapped to a fully qualified
mozilla::LogLevel, instances of PR_LOG levels in #defines were mapped to a
fully qualified mozilla::LogLevel::* level, and all other instances were
mapped to us a shorter format of LogLevel::*.

Bustage for usage of the non-fully qualified LogLevel were fixed by adding
|using mozilla::LogLevel;| where appropriate.
2015-06-01 14:31:01 -07:00
Eric Rahm dc090e3fe5 Bug 1165515 - Part 3: Convert PR_LOG_TEST to MOZ_LOG_TEST. r=froydnj 2015-06-01 14:31:00 -07:00
Nathan Froyd 9265d4998b Bug 1169034 - include <cstdlib> in ThreadStackHelper.cpp to declare correct overload for std::abs; r=jseward
The integer-valued {,l,ll}abs functions come from <stdlib.h>, and so the
integer-valued overload for std::abs comes from <cstdlib>.
2015-05-27 16:54:38 -04:00
Michael Layzell 7524d2bb65 Bug 1168167 - Mark LazyIdleThread::mIdleObserver with MOZ_UNSAFE_REF. r=froydnj
--HG--
extra : rebase_source : 59331d49e110ca59cfd2c396c5bac838bced7456
2015-05-29 06:56:00 -04:00