chromium/fuchsia_web/shell/cast_streaming_shell.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: [
    // CML shards intended for tests are used here because this component is
    // launched as a test. While it doesn't fit the typical use-case for a test
    // component, it's a useful way to be able to launch the component from a
    // host tool and have it run somewhere it can get the capabilities it needs
    // to function correctly.
    // TODO(crbug.com/42050572): Run as a non-test component.
    "//build/config/fuchsia/test/chromium_system_test_facet.shard.test-cml",
    "//build/config/fuchsia/test/elf_test_runner.shard.test-cml",
    "sys/component/realm_builder_absolute.shard.cml",

    "syslog/client.shard.cml",
  ],
  program: {
    binary: "cast_streaming_shell_exe",
  },
  offer: [
    {
      // Required capabilities for WebInstanceHost in a child Component.
      protocol: [
        "fuchsia.feedback.ComponentDataRegister",
        "fuchsia.feedback.CrashReportingProductRegister",
      ],
      from: "parent",
      to: "#realm_builder",
    },

    // Offered for use by the relaunched
    // `fuchsia_web/shell/web_engine_shell_for_web_instance_host.cml`
    // TODO(crbug.com/42050572): Remove when running as a non-test component and
    // thus the relaunch is no longer needed.
    {
      protocol: [
        // Required to display the View in Scene Manager unless running in
        // `--headless` mode.
        "fuchsia.element.GraphicalPresenter",
      ],
      from: "parent",
      to: "#realm_builder",
      availability: "optional",
    },

    // The remaining are offered from the parent to `web_instance.cm` via
    // `RealmBuilder` when not in `--use-context-provider` mode.

    {
      // The chromium test realm offers the system-wide config-data dir to test
      // components. Route the web_engine sub-directory of this as required by
      // WebInstanceHost.
      directory: "config-data",
      from: "parent",
      as: "config-data-for-web-instance",
      to: "#realm_builder",
      subdir: "web_engine",
      availability: "optional",
    },
    {
      // Holds ICU time zone data files.
      // See:
      // https://fuchsia.dev/fuchsia-src/concepts/process/namespaces?typical_directory_structure
      directory: "tzdata-icu",
      from: "parent",
      to: "#realm_builder",
    },
    {
      // Required by `fuchsia.web/ContextFeatureFlags.NETWORK`.
      directory: "root-ssl-certificates",
      from: "parent",
      to: "#realm_builder",
    },
    {
      // Required capabilities for all WebInstance configurations.
      protocol: [
        "fuchsia.buildinfo.Provider",
        "fuchsia.device.NameProvider",
        "fuchsia.fonts.Provider",
        "fuchsia.hwinfo.Product",
        "fuchsia.intl.PropertyProvider",
        // "fuchsia.logger/LogSink", is included by the shard above.
        "fuchsia.memorypressure.Provider",
        "fuchsia.process.Launcher",
        "fuchsia.sysmem.Allocator",
        "fuchsia.sysmem2.Allocator",
      ],
      from: "parent",
      to: "#realm_builder",
    },
    {
      protocol: [
        // Allows CPU scheduling profiles to be applied to threads to
        // tune their performance, especially for media rendering.
        // TODO(crbug.com/42050308): Migrate to `fuchsia.scheduler`.
        "fuchsia.media.ProfileProvider",

        // Optionally used by the tracing service.
        // TODO(crbug.com/42050521): Offer only when enabled.
        "fuchsia.tracing.perfetto.ProducerConnector",
      ],
      from: "parent",
      to: "#realm_builder",
      availability: "optional",
    },
    {
      protocol: [
        // Required by `fuchsia.web/ContextFeatureFlags.NETWORK`.
        "fuchsia.net.interfaces.State",
        "fuchsia.net.name.Lookup",
        "fuchsia.posix.socket.Provider",

        // Required by `fuchsia.web/ContextFeatureFlags.AUDIO`.
        "fuchsia.media.Audio",
        "fuchsia.media.AudioDeviceEnumerator",
        "fuchsia.media.SessionAudioConsumerFactory",

        // Required by `fuchsia.web/ContextFeatureFlags.VULKAN`.
        // "fuchsia.tracing.provider.Registry" is optionally used by the
        // tracing service.
        "fuchsia.tracing.provider.Registry",
        "fuchsia.vulkan.loader.Loader",

        // Required by `fuchsia.web/ContextFeatureFlags.HARDWARE_VIDEO_DECODER`.
        "fuchsia.mediacodec.CodecFactory",
      ],
      from: "parent",
      to: "#realm_builder",
    },
    {
      protocol: [
        // Required by the absence of
        // `fuchsia.web/ContextFeatureFlags.HEADLESS`.
        "fuchsia.accessibility.semantics.SemanticsManager",
        "fuchsia.ui.composition.Allocator",
        "fuchsia.ui.composition.Flatland",
      ],
      from: "parent",
      to: "#realm_builder",
    },
    {
      protocol: [
        // Required by the absence of
        // `fuchsia.web/ContextFeatureFlags.DISABLE_DYNAMIC_CODE_GENERATION`.
        "fuchsia.kernel.VmexResource",
      ],
      from: "parent",
      to: "#realm_builder",
    },
  ],
  facets: {
    // TODO(crbug.com/42050572): Remove when converting to a non-test component.
    "fuchsia.test": {
      "deprecated-allowed-packages": [ "web_engine" ],
    },
  },
}