`ServiceAllocator` wraps the various `Context.bindService` APIs and manages
the allocation of service names (in the case of non-isolated services) or
instance names (in the case of isolated services on Android 10+).
During the first allocation of a content process, we construct a policy that
is used for all content process allocations.
The `DefaultContentPolicy` computes the maximum number of content processes
and then allocates those names using a `BitSet`.
The `IsolatedContentPolicy` tracks the number of live content processes, but
simply uses a monotonically-increasing counter for generating instance IDs.
This patch also adds a `ServiceUtils` class that contains numerous functions
relating to generating service names and retrieving information about
service definitions in this package.
* Content processes are now named `tab0` through `tabN`. When a single content
process name is used (either for single-e10s or for the process name
used by isolated services), we always use `tab0`.
* I am not wedded to the names of the priorities used in the `PriorityLevel`
enum -- suggestions welcome!
* Some of the `ServiceUtils` functions could arguably go into `ContextUtils`
instead, but I thought that this was fine since they are fairly specific
to this use case.
* Further modifications will need to be made to support multiple priorities.
This patch is enough to get everything up and running for testing, with
further prioritization work being done in bug 1620145.
Differential Revision: https://phabricator.services.mozilla.com/D65636
--HG--
extra : moz-landing-system : lando
An explanation of the Mozilla Source Code Directory Structure and links to
project pages with documentation can be found at:
https://firefox-source-docs.mozilla.org/contributing/directory_structure.html
For information on how to build Mozilla from the source code and create the patch see:
https://firefox-source-docs.mozilla.org/contributing/how_to_contribute_firefox.html
If you have a question about developing Mozilla, and can't find the solution
on https://developer.mozilla.org, you can try asking your question on Matrix at chat.mozilla.org in `Introduction` (https://chat.mozilla.org/#/room/#introduction:mozilla.org) channel.
Nightly development builds can be downloaded from:
https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
- or -
https://www.mozilla.org/firefox/channel/desktop/#nightly
Keep in mind that nightly builds, which are used by Mozilla developers for
testing, may be buggy.