1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
  277
  278
  279
  280
  281
  282
  283
  284
  285
  286
  287
  288
  289
  290
  291
  292
  293
  294
  295
  296
  297
  298
  299
  300
  301
  302
  303
  304
  305
  306
  307
  308
  309
  310
  311
  312
  313

fuchsia_web / shell / web_engine_shell.cml [blame]

// 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: "web_engine_shell_exec",
  },


  use: [
    // Required in `--use-context-provider` mode.

    {
      protocol: [
        // Required to display the View in Scene Manager unless running in
        // `--headless` mode.
        "fuchsia.element.GraphicalPresenter",
      ],
      availability: "optional",
    },

    {
      protocol: [
        // The system ContextProvider is required to create the Context.
        "fuchsia.web.ContextProvider",
      ],
      availability: "optional",
    },

    // The remaining are provided from this Component to the `web_instance.cm`
    // via `CreateContextParams.service_directory`.

    {
      // Used to hold the cdm_data directory passed to the WebInstance.
      storage: "data",
      path: "/data",

      // The `--use-context-provider` mode  does not support
      // `--enable-web-instance-tmp` so there is no need to `use` "tmp" like
      // the `offer` when not in `--use-context-provider` mode.
    },
    {
      protocol: [
        // Required capabilities for all WebInstance configurations.
        "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",
      ],
      // TODO(crbug.com/42050582): Make required when `--use-context-provider`.
      availability: "optional",
    },
    {
      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",
        "fuchsia.scheduler.RoleManager",

        // Optionally used by the tracing service.
        // TODO(crbug.com/42050521): Offer only when enabled.
        "fuchsia.tracing.perfetto.ProducerConnector",
      ],
      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",
      ],
      // TODO(crbug.com/42050582): Make required when `--use-context-provider`.
      availability: "optional",
    },
    {
      // Required by `fuchsia.web/ContextFeatureFlags.WIDEVINE_CDM` if the value
      // of the GN arg `enable_widevine` at is true.
      // TODO(crbug.com/40875562): Use a shard to conditionally `use` based on
      // the build-time config.
      protocol: "fuchsia.media.drm.Widevine",
      availability: "optional",
    },
    {
      protocol: [
        // Required by the absence of `fuchsia.web/ContextFeatureFlags.HEADLESS`
        // unless running in `--headless` mode.
        "fuchsia.accessibility.semantics.SemanticsManager",
        "fuchsia.ui.composition.Allocator",
        "fuchsia.ui.composition.Flatland",
      ],
      availability: "optional",
    },
    {
      protocol: [
        // Required by `fuchsia.web/ContextFeatureFlags.KEYBOARD`.
        "fuchsia.ui.input3.Keyboard",

        // Required by `fuchsia.web/ContextFeatureFlags.VIRTUAL_KEYBOARD`.
        "fuchsia.input.virtualkeyboard.ControllerCreator",

        // Required by the absence of
        // `fuchsia.web/ContextFeatureFlags.DISABLE_DYNAMIC_CODE_GENERATION`.
        "fuchsia.kernel.VmexResource",
      ],
    },
  ],
  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.

    {
      // Used to hold the cdm_data directory passed to web_instance.
      storage: "data",
      from: "parent",
      to: "#realm_builder",
    },
    {
      // Used when launched with --enable-web-instance-tmp.
      storage: [ "tmp" ],
      from: "parent",
      to: "#realm_builder",
      availability: "optional",
    },
    {
      // 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",
        "fuchsia.scheduler.RoleManager",

        // 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",
    },
    {
      // Required by `fuchsia.web/ContextFeatureFlags.WIDEVINE_CDM` if the value
      // of the GN arg `enable_widevine` at is true.
      // TODO(crbug.com/40875562): Use a shard to conditionally `offer` based on
      // the build-time config.
      protocol: "fuchsia.media.drm.Widevine",
      from: "parent",
      to: "#realm_builder",
      availability: "optional",
    },
    {
      protocol: [
        // Required by the absence of `fuchsia.web/ContextFeatureFlags.HEADLESS`
        // unless running in `--headless` mode.
        "fuchsia.accessibility.semantics.SemanticsManager",
        "fuchsia.ui.composition.Allocator",
        "fuchsia.ui.composition.Flatland",
      ],
      from: "parent",
      to: "#realm_builder",
      availability: "optional",
    },
    {
      protocol: [
        // Required by `fuchsia.web/ContextFeatureFlags.KEYBOARD`.
        "fuchsia.ui.input3.Keyboard",

        // Required by `fuchsia.web/ContextFeatureFlags.VIRTUAL_KEYBOARD`.
        "fuchsia.input.virtualkeyboard.ControllerCreator",

        // 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",
        "web_engine_with_webui",
      ],
    },
  },
}