gecko-dev/mobile
Aaron Klotz 09593d71de Bug 1608301: Part 3 - Add an allocator for generating unique service names and instance IDs; r=geckoview-reviewers,snorp
`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
2020-03-10 15:25:03 +00:00
..
android Bug 1608301: Part 3 - Add an allocator for generating unique service names and instance IDs; r=geckoview-reviewers,snorp 2020-03-10 15:25:03 +00:00
locales Bug 1601076 - Fix some broken BUG_COMPONENTS in moz.build files; r=jmaher 2019-12-04 13:55:45 +00:00