Commit Graph
11 Commits
Author SHA1 Message Date
Michael Layzell e82670034d Bug 1393581 - Name all IdleTaskRunner runnables, r=smaug 2017-08-25 11:24:27 -04:00
Bill McCloskey e1b7db0651 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
Henry Chang 9c0d4ee313 Bug 1355746 - Part 3. Test cases for IdleTaskRunner. r=smaug
MozReview-Commit-ID: 3RsC1pT9Fzc
2017-07-12 14:13:44 +08: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
Sebastian Hengst 86f61eeb73 Backed out changeset 8cd0a75a643a (bug 1355746)
MozReview-Commit-ID: 1CxBzyDfpIP
2017-06-21 19:48:59 +02:00
Henry Chang 4019611f93 Bug 1355746 - Part 3. Test cases for IdleTaskRunner. r=smaug
MozReview-Commit-ID: 3RsC1pT9Fzc
2017-06-15 17:32:01 +08:00
Andreas Farre d98338d317 Bug 1371274 - Add tests for NewIdleRunnable for classes without SetDeadline. r=froydnj 2017-06-09 02:44:00 +02:00
Olli Pettay 812f14c522 Bug 1358476, add support for timeout when doing idle dispatch, tests, p=farre,smaug, r=nfroyd 2017-05-24 15:36:49 -04:00
Bevis Tseng 4c79a6c674 Bug 1333997 - Part 3: Add Test Coverage for Named NewRunnable APIs. r=froydnj 2017-02-07 16:45:45 +08:00
Benjamin Smedberg e91718eaa5 Bug 1332631 part H - move gtests from xpcom/glue to xpcom/tests, and unify the two TestThreadUtils.cpp into one file, r=froydnj
MozReview-Commit-ID: 2idOXKJOnuW
2017-01-20 15:22:23 -05:00
Eric Rahm dfce577e15 Bug 1313483 - Convert XPCOM test TestThreadUtils to a gtest. r=froydnj
MozReview-Commit-ID: EA0SNRX2EXC
2016-11-04 16:24:59 -07:00