chromium/fuchsia_web/webinstance_host/web_instance_host.shard.cml

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
{
  include: [
    // Enable logging from the Component that is a web_instance_host.
    "syslog/use.shard.cml",
  ],
  collections: [
    // The collection in which child instances are dynamically created.
    {
      name: "web_instances",
      durability: "transient",
      allowed_offers: "static_and_dynamic",
      persistent_storage: false,
    },
  ],
  capabilities: [
    // The root of a directory tree through which directory capabilities are
    // dynamically routed to child instances.
    {
      directory: "web_instances",
      rights: [ "rw*" ],
      path: "/web_instances",
    },
  ],
  use: [
    {
      protocol: "fuchsia.component.Realm",
      from: "framework",
    },
    {
      protocol: [
        "fuchsia.feedback.ComponentDataRegister",
        "fuchsia.feedback.CrashReportingProductRegister",
      ],
    },
  ],
  offer: [
    {
      directory: "config-data-for-web-instance",
      from: "parent",
      as: "config-data",
      to: "#web_instances",
      availability: "optional",
    },
    {
      directory: "tzdata-icu",
      from: "parent",
      to: "#web_instances",
    },
    {
      // Statically offered to all web_instances regardless of whether they were
      // created with `ContextFeatureFlags.NETWORK`.
      directory: "root-ssl-certificates",
      from: "parent",
      to: "#web_instances",
      // Required if the WebInstanceHost may create Contexts with
      // `ContextFeatureFlags.NETWORK`.
      availability: "optional",
    },
    {
      protocol: [
        "fuchsia.buildinfo.Provider",
        "fuchsia.device.NameProvider",
        "fuchsia.fonts.Provider",
        "fuchsia.hwinfo.Product",
        "fuchsia.intl.PropertyProvider",
        "fuchsia.logger.LogSink",  // Targeted copy of syslog/offer.shard.cml.
        "fuchsia.memorypressure.Provider",
        "fuchsia.process.Launcher",
        "fuchsia.sysmem.Allocator",
        "fuchsia.sysmem2.Allocator",
      ],
      from: "parent",
      to: "#web_instances",
    },
    {
      protocol: [
        // Required for video capture.
        // TODO(crbug.com/42050280): Move to AppendDynamicServices() to provide
        // it conditionally when a ContextFeatureFlags is defined.
        "fuchsia.camera3.DeviceWatcher",

        // Required to schedule display-critical and realtime audio threads.
        // TODO(crbug.com/42050308): Migrate to `fuchsia.scheduler`.
        "fuchsia.media.ProfileProvider",

        // Required by Frame.SetPreferredTheme(DEFAULT).
        "fuchsia.settings.Display",

        // Optionally used by the tracing service.
        // crbug.com/1364196 tracks providing it conditionally when enabled.
        "fuchsia.tracing.perfetto.ProducerConnector",
      ],
      from: "parent",
      to: "#web_instances",
      availability: "optional",
    },
  ],
}