author Jim Blandy <jimb@mozilla.com>
Tue, 12 Feb 2019 08:16:16 +0000
changeset 458932 414b2c238839c321dee78a9d927c968f1e52ae79
parent 454764 956bd26eec5a9174753b63931d1a927a59cd4716
child 465552 3f760b5978708d239025d2db7c2201bc95c71963
permissions -rw-r--r--
Bug 1145201: Replace EnqueuePromiseJobCallback and GetIncumbentGlobalCallback with new JobQueue abstract base class. r=arai,smaug While the behavior of ECMAScript Promises and their associated job queue is covered by the ECMAScript standard, the HTML specification amends that with additional behavior the web platform requires. To support this, SpiderMonkey provides hooks the embedding can set to replace SpiderMonkey's queue with its own implementation. At present, these hooks are C-style function-pointer-and-void-pointer pairs, which are awkward to handle and mistake-prone, as passing a function the wrong void* is not a type error. Later patches in this series must add new hooks, making a bad situation worse. A C++ abstract base class is a well-typed alternative. This introduces a new `JS::JobQueue` abstract class, and adapts SpiderMonkey's internal job queue and Gecko's customization to use it. `GetIncumbentGlobalCallback` and `EnqueuePromiseJobCallback` become virtual methods. Within SpiderMonkey, the patch gathers the various fields of JSContext that implement the internal queue into their own type, js::InternalJobQueue. Various jsfriendapi functions become veneers for calls to methods specific to the derived class. The InternalJobQueue type itself remains private to SpiderMonkey, as it uses types like TraceableFifo, derived from Fifo, that are not part of SpiderMonkey's public API. Within Gecko, CycleCollectedJSContext acquires JS::JobQueue as a private base class, and a few static methods are cleaned up nicely. There are a few other hooks defined in js/public/Promise.h that might make sense to turn into virtual methods on JobQueue. For example, DispatchToEventLoopCallback, used for resolving promises of results from off-main-thread tasks, is probably necessarily connected to the JobQueue implementation in use, so it might not be sensible to set one without the other. But it was left unchanged to reduce this patch's size. Differential Revision: https://phabricator.services.mozilla.com/D17544

# Bug 1204606 - Reformat of dom/media
# https://hg.mozilla.org/mozilla-central/rev/0ceae9db9ec0be18daa1a279511ad305723185d4
abd6d77c618998827e5ffc3dab12f1a34d6ed03d # cinnabar
804b8b8883ba2a6795b0fcf65ebcb18306b6416b # gecko-dev

# Bug 1511181 - Reformat everything to the Google coding style
# https://hg.mozilla.org/mozilla-central/rev/6f3709b3878117466168c40affa7bca0b60cf75b
0e0308d10a5fd4a8dcf0601978776342a2abf2df # cinnabar
265e6721798a455604328ed5262f430cfcc37c2f # gecko-dev

# Bug 1516555 - Reformat everything to the Google coding style
# https://hg.mozilla.org/mozilla-central/rev/d57dde190f67
cf6442a0664caf8eb39eb75b77963f648597cbd8 # cinnabar
cccdda3c2aec019cc138d410fc0e4aa3e307b6ab # gecko-dev

# Bug 1512961 - Reformat recent changes to the Google coding style
# https://hg.mozilla.org/integration/autoland/rev/8869368a3f30
20061c7bfce850ba0158c7b8a439ac3ecc62a262 # cinnabar
ad75e912fbc1d64ed63c1d0a51d7157566de1887 # gecko-dev

# Bug 1513205 - Also update the tests to match the Google coding style
# https://hg.mozilla.org/integration/autoland/rev/09c71a7cf75a
13452f36fb36ad09d81f6b53eaf7928ee63f05e3 # cinnabar
6f45c666bc7f98c3e3250a7c2cf8dc3fb95d12d7 # gecko-dev

# Bug 1519636 - Reformat everything to the Google coding style
# https://hg.mozilla.org/mozilla-central/rev/d54846d01280026138135bde6e0bb1bcfe58feae
abc28896717209d5f0ed2a6b0a46f8e03880ad19 # cinnabar
47a5dd1fb80fa5bbe608c32db426f1ed29b7fd79 # gecko-dev

# Bug 1521000 - Part 1: Reformat the tree to ensure everything is forma…
# https://hg.mozilla.org/mozilla-central/rev/9916e7d6e327
4205caa5c71ba3b111ac494d32d46ff76882b795 # cinnabar
06c3d29113e60ab1a316fbd5a16c667202d012fb # gecko-dev

# Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces…
# https://hg.mozilla.org/mozilla-central/rev/5f4630838d46
d25e4032d4d15e732a78082505d62b6d6ffa1445 # cinnabar
e5e885ae3128a6878d08df4ff6baaf3fc4a4b9e8 # gecko-dev
# Bug 1513205 - Ride along, update some code to match the Google coding style
# https://hg.mozilla.org/integration/autoland/rev/039a7c0c18fb
1ce955dcb2e09fd9ce19c1ec6c470f75db486bd2 # cinnabar
7cf43b9bc01d650f87deceb65f336cdac7c0e78f # gecko-dev