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

25 Коммитов

Автор SHA1 Сообщение Дата
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
Nicholas Nethercote 87b80f8c66 Bug 1188745 - Rename nsTArray::SizeOfExcludingThis() as ShallowSizeOfExcludingThis(). r=froydnj.
This makes it clearer that, unlike how SizeOf*() functions usually work, this
doesn't measure any children hanging off the array.

And do likewise for nsTObserverArray.

--HG--
extra : rebase_source : 6a8c8d8ffb53ad51b5773afea77126cdd767f149
2015-07-28 23:24:24 -07: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
Honza Bambas 326b2476af Bug 1170534 - Remove Visual Event Tracer. r=dougt 2015-06-02 11:44:00 -04:00
Honza Bambas adddf68b3c Bug 1122420 - Improve after-shutdown dispatch assertion on CacheIOThread. r=michal
--HG--
extra : rebase_source : f4e438e004b4e18e81ce35db5659a6c9cef18ce1
2015-04-13 16:58:00 +02:00
Daniel Holbert 082fd9cd7f Bug 1142841: Convert all nsRefPtr<nsIRunnable> to nsCOMPtr<nsIRunnable>. r=ehsan
This patch was generated by a script.  Here's the source of the script for
future reference:

find . \( -iname "*.cpp" -o -iname "*.h" \) | \
  xargs -n 1 sed -i "s/nsRefPtr<nsIRunnable>/nsCOMPtr<nsIRunnable>/g"
2015-03-17 09:29:17 -07:00
Honza Bambas 39cdf6c4cb Bug 976171 - crash in mozilla::net::CacheIOThread::LoopOneLevel(unsigned int), r=michal 2014-05-02 20:15:15 +02:00
Birunthan Mohanathas 5f1fde8824 Bug 900908 - Part 3: Change uses of numbered macros in nsIClassInfoImpl.h/nsISupportsImpl.h to the variadic variants. r=froydnj 2014-04-27 03:06:00 -04:00
Aaron Klotz 025fed58f4 Bug 913653: Remove lock from IOInterposer and add IOInterposer thread registration; r=froydnj 2014-04-08 22:57:52 -06:00
Honza Bambas fb73a2ae07 Bug 976866 - HTTP cache v2: Specific dispatch method for eviction events, r=michal 2014-04-04 14:42:05 +02:00
Honza Bambas 5267e9c628 Bug 975255 - HTTP cache v2: optimize CacheIOThread::Target(), r=michal 2014-02-27 00:11:42 +01:00
Honza Bambas ff7f64d64a Bug 958317 - HTTP cache v2: allow yield to more priority levels in IOThread, r=michal 2014-02-27 00:11:42 +01:00
Honza Bambas a2b286f768 Bug 964039 - Memory used by the new cache backend is not reported, r=michal 2014-02-27 00:11:40 +01:00
Ed Morley 8dbef9c6e0 Backed out changeset 240333c3d2c1 (bug 964039) 2014-03-05 17:24:55 +00:00
Ed Morley 6fee27b115 Backed out changeset 18d79e1e15f9 (bug 958317) 2014-03-05 17:24:52 +00:00
Ed Morley 24bad37290 Backed out changeset 2275f8be60c9 (bug 975255) 2014-03-05 17:24:49 +00:00
Honza Bambas 91aa8a6856 Bug 975255 - HTTP cache v2: optimize CacheIOThread::Target(), r=michal 2014-02-27 00:11:42 +01:00
Honza Bambas 6891434bc6 Bug 958317 - HTTP cache v2: allow yield to more priority levels in IOThread, r=michal 2014-02-27 00:11:42 +01:00
Honza Bambas 260271bf43 Bug 964039 - Memory used by the new cache backend is not reported, r=michal 2014-02-27 00:11:40 +01:00
Honza Bambas ebad344e5a Bug 957707 - Merge management and IO threads in cache v2, r=michal 2014-01-22 18:54:52 +01:00
Honza Bambas 369780f48e Bug 956374 - HTTP cache v2: fix CacheIOThread::Target() wait conditioning, r=michal 2014-01-09 00:27:31 +01:00
Honza Bambas 5f369d6c6b Bug 951713 - CacheIOThread causes activity spikes during idle, r=michal 2013-12-19 01:39:16 +01:00
Ben Turner 4d2b15f34c Bug 939182 - Add 'eventWasProcessed' argument to nsIThreadObserver::afterProcessNextEvent(), r=bsmedberg.
--HG--
extra : transplant_source : %5E%80p%D6%C6A%23%0AZ%06%23%16%155%DB%CE%F5%5CEx
2013-10-23 05:01:20 -07:00
Honza Bambas 441efac7c7 Bug 934610 - fix Assertion failure: \!EventsPending(), at CacheIOThread.cpp:172, r=michal 2013-11-20 23:20:15 +01:00
Honza Bambas 894ba59236 Bug 913807 - HTTP cache v2: API+top service+integration+tests, off by default, r=michal+ehsan+mark.finkle+fabrice+mhammond+gavin 2013-09-20 11:11:25 +02:00