Commit Graph

1487 Commits

Author SHA1 Message Date
Sebastian Hengst
7eec7a0a11 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: mr7OYuaLKE
2017-09-21 15:23:43 +02:00
Nathan Froyd
3393422869 Bug 1401662 - don't inline nsThreadManager::get(); r=erahm
Defining get() in the declaration of nsThreadManager implicitly sticks
an "inline" on the function, which is not what we want: inlining it
spreads around a lot of static initialization code.  Providing an
out-of-line definition is much better in terms of code size.
2017-09-20 17:10:20 -04:00
Byron Campen [:bwc]
6b3da0609f Bug 1383019: Move more logic under the protection of nsTimerImpl::mMutex, and simplify. r=froydnj, a=abillings
MozReview-Commit-ID: JjYScKwyika

--HG--
extra : rebase_source : a5a8a17f86459ace51d9250454bd4cf1433130b0
2017-09-14 12:19:24 -05:00
Philippe Normand
fb80b50e2e Bug 1399825 - Include nsXULAppAPI.h in nsThreadManager.cpp. r=Ms2ger
This ensures XRE_IsContentProcess() is defined, as it's used in this file.

MozReview-Commit-ID: GwBYcFBiUBK
2017-09-14 12:51:41 +01:00
James Cheng
0c675a3236 Bug 1393710 - Add thread name into NS_DebugBreak for better debugging. r=froydnj
MozReview-Commit-ID: AvqajMgtpuh

--HG--
extra : rebase_source : 13e99f103abc9e39ec4cff15f720cd09a9e6b2c5
2017-08-30 11:13:50 +08:00
Wes Kocher
1ea82f66aa Merge m-c to autoland, a=merge
MozReview-Commit-ID: AHxJvcR2Tpa
2017-09-20 17:47:16 -07:00
Blake Kaplan
04b86e2150 Bug 1398393 - Set Servo thread state on cooperative threads. r=billm
By doing this we avoid triggering assertions in the Servo code that ensure
we have registered the thread with Servo and set the proper state on it.

MozReview-Commit-ID: K6qHrYoQDLm

--HG--
extra : rebase_source : d01b0aad42273f6b92b7cfd5f5fe17ffe7b4cda0
2017-09-08 16:50:34 -07:00
Blake Kaplan
c1ce54a82a Bug 1401412 - Destroy this singleton during XPCOM shutdown. r=smaug
Unfortunately, this needed some additional trickery in order to keep its
constructor "private". I stole this trick from [1]. With this patch, we tear
down the statistics object during XPCOM shutdown intead of after it. I don't
believe that we need the object to live past the ClearOnShutdown destructors.

[1] http://rienajouter.blogspot.com/2014/10/makeshared-and-makeunique-for-classes.html

MozReview-Commit-ID: JsiN6Bq9Yp4

--HG--
extra : rebase_source : dd26c8e6906a6c9fd500c28379f8c63fd7c3ad6a
2017-09-19 17:38:05 -07:00
Bill McCloskey
0f4e7d4fe6 Bug 1398423 - Fix LabeledEventQueue bug with unlabeled events (r=froydnj)
MozReview-Commit-ID: 7ru62QTkya2
2017-09-11 19:11:03 -07:00
Bill McCloskey
b9683a5b18 Bug 1398423 - Make linked list of SchedulerGroups static (r=froydnj)
MozReview-Commit-ID: GgfdRlhPiHP
2017-09-11 19:11:01 -07:00
Bill McCloskey
9c4cbe52d1 Bug 1398417 - Fix PrioritizedEventQueue bugs with input event prioritization (r=stone)
MozReview-Commit-ID: 4wk8EUv0h7C
2017-09-11 19:10:57 -07:00
James Cheng
fb6af85bd2 Bug 1397344 - Use Decay to ensure StoreCopyPassByXXX stores the value by copy not by reference. r=gerald
MozReview-Commit-ID: Ec9yjYdQ1jC

--HG--
extra : rebase_source : 6b2f63bf7af9a3c8a879ac6f3865abf6be9a4155
2017-09-07 17:02:13 +08:00
Bill McCloskey
9cbaae8cfc Bug 1396155 - Allow LabeledEventQueue to be used outside the Scheduler (r=froydnj)
MozReview-Commit-ID: 4yEX39HXh9W
2017-09-07 22:31:34 -07:00
Bill McCloskey
4219e067da Bug 1396155 - Support active tab prioritization and round-robin scheduling in LabeledEventQueue (r=froydnj)
MozReview-Commit-ID: Ax5rWAKN50h
2017-09-07 22:31:34 -07:00
Doug Thayer
2e2f55c74a Bug 1382440 - Fix CPUUsageWatcher on OSX and Linux r=froydnj
Properly enclose all relevant details of CPUUsageWatcher in ifdefs
which control whether it should be active or not. Additionally,
apparently clock_gettime is not defined on OSX prior to 10.12, so
this is failing to compile for OSX on the build server, but not
locally. However, clock_get_time and getrusage should cover our
use cases sufficiently.

MozReview-Commit-ID: Ffi6yXLb9gO

--HG--
extra : rebase_source : 84f9cf3b2074883dc6fe6d5a50ff27ffdb008a4f
2017-08-28 14:00:22 -07:00
Doug Thayer
8aae071723 Bug 1382440 - Watch CPU usage in BHR r=froydnj
We would like to be able to see if a given hang in BHR occurred
under high CPU load, as this is an indication that the hang is
of less use to us, since it's likely that the external CPU use
is more responsible for it.

The way this works is fairly simple. We get the system CPU usage
on a scale from 0 to 1, and we get the current process's CPU
usage, also on a scale from 0 to 1, and we subtract the latter
from the former. We then compare this value to a threshold, which
is 1 - (1 / p), where p is the number of (virtual) cores on the
machine. This threshold might need to be tuned, so that we
require an entire physical core in order to not annotate the hang,
but for now it seemed the most reasonable line in the sand.

I should note that this considers CPU usage in child or parent
processes as external. While we are responsible for that CPU usage,
it still indicates that the stack we receive from BHR is of little
value to us, since the source of the actual hang is external to
that stack.

MozReview-Commit-ID: JkG53zq1MdY

--HG--
extra : rebase_source : 16553a9b5eac0a73cd1619c6ee01fa177ca60e58
2017-07-24 13:46:09 -07:00
Andrew McCreight
f3d6766f0e Bug 1394176 - Use default values for scheduler prefs if the parent process didn't send any. r=billm
In some unknown circumstance, possibly if the parent process has a
different version than the child process, the child does not receive
scheduler prefs, which makes it read out of an uninitialized local
variable. This can probably happen because the scheduler prefs are
checked before we do the ContentChild::Init version check. Bill also
suggested that the pref env var might be getting truncated.

This patch improves on the situation by using null for the prefs array
if none was sent, and falling back on the default values, which leave
the scheduler disabled.

This also checks that the pref string is at least long enough to avoid
a buffer overflow. Note that if the end of the string isn't an integer
we'll end up with an sPrefThreadCount of zero, which can't be good.

MozReview-Commit-ID: ByHLFMEpgyZ

--HG--
extra : rebase_source : 8f6368b88ec3746f4d1c7716a962bb2ac3c2f3b5
2017-08-29 10:30:03 -07:00
Sean V Kelley
b24a6c913e Bug 1376858 - Use SystemGroup to label nsIThread::AsyncShutdown, r=billm
MozReview-Commit-ID: IDPE6zhEnVI

--HG--
extra : rebase_source : c6c47ba59dc983ba0747f4a222a88e9fbac3efb2
2017-08-27 18:58:54 -07:00
Andrew McCreight
c06c75d418 Bug 1394655 - Don't call SetNextIdleDeadlineRef on beta or release. r=froydnj
MozReview-Commit-ID: sIO4thBdpq

--HG--
extra : rebase_source : a66b6372ab2effeb6ecc53b6eb170c117a9ba1df
2017-08-28 20:53:05 -07:00
Bill McCloskey
f90a87caa9 Bug 1350432 - Initial Quantum DOM scheduler implementation, disabled by default (r=froydnj)
MozReview-Commit-ID: JWBxz3bwgwD
2017-08-25 10:28:23 -07:00
Bill McCloskey
2270017046 Bug 1350432 - Add MutexAutoLock::AssertOwns (r=froydnj)
MozReview-Commit-ID: KQGaHRFDxo4
2017-08-25 10:28:23 -07:00
Bill McCloskey
9cd553af84 Bug 1350432 - Remove mEventObservers to SynchronizedEventQueue (r=froydnj)
MozReview-Commit-ID: 8Xt1gdxFDr4
2017-08-25 10:28:23 -07:00
Bill McCloskey
8d0e884b2f Bug 1391850 - Allow IdleDispatch from any thread (r=smaug)
MozReview-Commit-ID: FWb48VV0do8
2017-08-25 10:28:23 -07:00
Bill McCloskey
587e22d043 Bug 1333962 - Add nsILabelableRunnable to label runnables like vsync (r=kanru)
MozReview-Commit-ID: FdvqV0LfFsz
2017-08-25 10:28:23 -07:00
Michael Layzell
eab07b465e Bug 1393581 - Name all IdleTaskRunner runnables, r=smaug 2017-08-25 11:24:27 -04:00
Mike Hommey
615061e5be Bug 1392868 - Completely remove AutoCollectVsyncTelemetry on late beta. r=froydnj
The class, in practice, was already doing nothing in that case, but with
it being half #ifdef'ed on EARLY_BETA_OR_EARLIER, that led to build
failures for unused code on late beta. Just remove the class completely
on late beta.

--HG--
extra : rebase_source : 801b0b9bb9faf41270f72f616e720d5725e8b25c
2017-08-23 11:52:12 +09:00
Sebastian Hengst
99e5cb9c14 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: GSKVB94r7Kk
2017-08-23 16:29:51 +02:00
Andrew McCreight
2e0a92099c Bug 1392483 - ifdef out mNextIdleDeadline in a few more places. r=froydnj
MozReview-Commit-ID: D9bW4jEHlhl

--HG--
extra : rebase_source : a5a67943b389e5f54b80ee60ab2c60aa4d3f8205
2017-08-22 15:00:45 -07:00
Stone Shih
2c638fc04f Bug 1389314 Part2: Support enabling and disabling the input priority events in runtime. r=smaug.
MozReview-Commit-ID: 3a2TNVqguVb
2017-07-28 15:14:54 +08:00
Stone Shih
60d437ddc2 Bug 1389314 Part1: Rename event prioritization to input event queue. r=smaug.
MozReview-Commit-ID: 7wPWYwIjIet
2017-07-27 16:20:01 +08:00
Tom Ritter
2dbc80baea Bug 1392617 Fix comparison between signed and unsigned integer expressions r=aklotz
The return of these functions is actually (DWORD) –1

MozReview-Commit-ID: 112d6BTBt8O

--HG--
extra : rebase_source : f36ec05d9a1e85d4d2dd844d8024189971aaeb46
2017-08-22 06:35:12 -05:00
Bevis Tseng
88a5ee396a Bug 1392201 - Label nsThreadShutdownAckEvent. r=froydnj 2017-08-21 17:30:22 +08:00
Bill McCloskey
e7ca33ec9e Bug 1391657 - Fix missing member initialization for input prioritization (r=mccr8)
MozReview-Commit-ID: AaleTbntJ7U
2017-08-18 14:18:07 -07:00
Carsten "Tomcat" Book
99aa3f8e70 Merge mozilla-central to mozilla-inbound 2017-08-17 13:13:10 +02:00
Bill McCloskey
12e61085ce Bug 1382922 - Fix build bustage on a CLOSED TREE
MozReview-Commit-ID: 2Ls9zhiXXgS
2017-08-16 21:11:59 -07:00
Bill McCloskey
9edd615af7 Bug 1382922 - Refactor event queue to allow multiple implementations (r=erahm)
This patch refactors the nsThread event queue to clean it up and to make it easier to restructure. The fundamental concepts are as follows:

Each nsThread will have a pointer to a refcounted SynchronizedEventQueue. A SynchronizedEQ takes care of doing the locking and condition variable work when posting and popping events. For the actual storage of events, it delegates to an AbstractEventQueue data structure. It keeps a UniquePtr to the AbstractEventQueue that it uses for storage.

Both SynchronizedEQ and AbstractEventQueue are abstract classes. There is only one concrete implementation of SynchronizedEQ in this patch, which is called ThreadEventQueue. ThreadEventQueue uses locks and condition variables to post and pop events the same way nsThread does. It also encapsulates the functionality that DOM workers need to implement their special event loops (PushEventQueue and PopEventQueue). In later Quantum DOM work, I plan to have another SynchronizedEQ implementation for the main thread, called SchedulerEventQueue. It will have special code for the cooperatively scheduling threads in Quantum DOM.

There are two concrete implementations of AbstractEventQueue in this patch: EventQueue and PrioritizedEventQueue. EventQueue replaces the old nsEventQueue. The other AbstractEventQueue implementation is PrioritizedEventQueue, which uses multiple queues for different event priorities.

The final major piece here is ThreadEventTarget, which splits some of the code for posting events out of nsThread. Eventually, my plan is for multiple cooperatively scheduled nsThreads to be able to share a ThreadEventTarget. In this patch, though, each nsThread has its own ThreadEventTarget. The class's purpose is just to collect some related code together.

One final note: I tried to avoid virtual dispatch overhead as much as possible. Calls to SynchronizedEQ methods do use virtual dispatch, since I plan to use different implementations for different threads with Quantum DOM. But all the calls to EventQueue methods should be non-virtual. Although the methods are declared virtual, all the classes used are final and the concrete classes involved should all be known through templatization.

MozReview-Commit-ID: 9Evtr9oIJvx
2017-08-16 20:55:43 -07:00
Chris Pearce
f2902bdf82 Bug 1390406 - Remove unnecessary includes in dom/media/mediasource. r=jya
MozReview-Commit-ID: 1aTncGfBicu

--HG--
extra : rebase_source : 8ad085eb81d195732c385718c283b4752e5e3c80
2017-08-15 16:13:00 +12:00
Wes Kocher
22fd8d166d Backed out changeset 00e918528ce0 (bug 1388608) for build bustage a=backout CLOSED TREE
MozReview-Commit-ID: H6g0kvzH6tT
2017-08-16 16:22:30 -07:00
Kris Maglione
ff1cab15a3 Bug 1388608: Add profiler labels for dispatching named runnables. r=mstange
MozReview-Commit-ID: 2vmVY38Kdll

--HG--
extra : rebase_source : 59415696d2d59becb541a950d4077ddebeeef3ca
extra : amend_source : 81c9b683e83abe370088e80716ea63d74c783700
2017-08-08 20:19:10 -07:00
Michael Layzell
65ece3dba5 Bug 1380081 - Part 11: Simplify the HangAnnotations abstraction, r=froydnj
HangAnnotations was very complex, required a separate allocation, and used this
unfortunate virtual interface implementation which made it harder to do
interesting things with it (such as serialize it over IPC).

This new implementation is much simpler and more concrete, making
HangAnnotations simply be a nsTArray<Annotation>. This also simplifies some of
the IPC code which was added in part 7.

MozReview-Commit-ID: EzaaxdHpW1t
2017-08-15 16:35:46 -04:00
Michael Layzell
916fbaa397 Bug 1380081 - Part 5: Add some helper methods to HangAnnotations, r=froydnj
These will be used to implement IPC serialization and deserialization of the
HangDetails object to send over IPC. This is a temporary measure as
HangAnnotations is rewritten in part 11.

MozReview-Commit-ID: 1WHNvhDrMF5
2017-08-15 16:35:06 -04:00
Michael Layzell
b7564c8ece Bug 1380081 - Part 4: Move BHR into its own component, r=froydnj
MozReview-Commit-ID: 7TOGofAYM6W


--HG--
rename : xpcom/threads/BackgroundHangMonitor.cpp => toolkit/components/backgroundhangmonitor/BackgroundHangMonitor.cpp
rename : xpcom/threads/BackgroundHangMonitor.h => toolkit/components/backgroundhangmonitor/BackgroundHangMonitor.h
rename : toolkit/components/telemetry/ThreadHangStats.h => toolkit/components/backgroundhangmonitor/ThreadHangStats.h
rename : xpcom/threads/ThreadStackHelper.cpp => toolkit/components/backgroundhangmonitor/ThreadStackHelper.cpp
rename : xpcom/threads/ThreadStackHelper.h => toolkit/components/backgroundhangmonitor/ThreadStackHelper.h
rename : xpcom/threads/nsIHangDetails.idl => toolkit/components/backgroundhangmonitor/nsIHangDetails.idl
2017-08-15 16:35:00 -04:00
Michael Layzell
cd973809f7 Bug 1380081 - Part 3: Remove the ThreadHangStats object and related code, r=froydnj
MozReview-Commit-ID: EtrktVmc3vP
2017-08-15 16:34:21 -04:00
Bill McCloskey
268004b056 Bug 1382172 - Compute names for all JS-implemented XPCOM objects (r=mrbkap)
MozReview-Commit-ID: 4kPbqOpGYnq
2017-08-14 22:42:42 -07:00
Phil Ringnalda
6bfeb0577d Backed out changeset c0c52209c8f2 (bug 1382172) for static build bustage
CLOSED TREE

MozReview-Commit-ID: 9GzjXjoIrp5
2017-08-14 22:23:57 -07:00
Bill McCloskey
96944ff355 Bug 1382172 - Compute names for all JS-implemented XPCOM objects (r=mrbkap)
MozReview-Commit-ID: 4kPbqOpGYnq
2017-08-14 21:10:14 -07:00
Michael Layzell
ba3aeb0481 Bug 1365309 - Part 2: re-enable BHR on linux, r=froydnj
MozReview-Commit-ID: BtRZecG4IYA
2017-08-14 10:05:24 -04:00
Stone Shih
4e8f0045a9 Bug 1351148 Part10: nsChainedEventQueue::PutEvent should always put high priority event in mHighQueue. r=smaug.
MozReview-Commit-ID: H6TV9bdm6QM
2017-07-26 10:52:06 +08:00
Stone Shih
393c62eba7 Bug 1351148 Part3: Synthesize native input events with priority. f=kats,smaug. r=smaug.
The test helper_touch_action_regions.html uses nsDOMWindowUtils to synthesize native input events and creates some runnables to trigger the test. It expects the runnables which synthesize native input events are processed first, then the runnables to continue the test, and finally the input events are forwarded from chrome process to content process. Enabling event prioritization may change the execution order.
Wraps those runnables to synthesize native input events as priority=input and dispatches those runnables to continue the test with priority=input to make sure the execution order is as expected.

MozReview-Commit-ID: 8hkaB1FRW9T
2017-05-19 15:41:24 +08:00
Stone Shih
de7f705042 Bug 1351148 Part2: Add a priority queue for input events. r=smaug.
MozReview-Commit-ID: 5ud1Ex9UNVo
2017-03-21 15:44:12 +08:00