# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/ui.gni")
import("//components/viz/viz.gni")

viz_component("host") {
  defines = [ "VIZ_HOST_IMPLEMENTATION" ]

  sources = [
    "client_frame_sink_video_capturer.cc",
    "client_frame_sink_video_capturer.h",
    "compositing_mode_reporter_impl.cc",
    "compositing_mode_reporter_impl.h",
    "gpu_client.cc",
    "gpu_client.h",
    "gpu_client_delegate.h",
    "gpu_host_impl.cc",
    "gpu_host_impl.h",
    "host_display_client.cc",
    "host_display_client.h",
    "host_frame_sink_client.h",
    "host_frame_sink_manager.cc",
    "host_frame_sink_manager.h",
    "persistent_cache_sandboxed_file_factory.cc",
    "persistent_cache_sandboxed_file_factory.h",
    "renderer_settings_creation.cc",
    "renderer_settings_creation.h",
    "viz_host_export.h",
  ]

  if (is_win) {
    sources += [
      "layered_window_updater_impl.cc",
      "layered_window_updater_impl.h",
    ]
  }

  deps = [
    "//base",
    "//components/base32",
    "//components/input",
    "//components/persistent_cache",
    "//gpu/ipc/client",
    "//gpu/ipc/common",
    "//gpu/webgpu:common",
    "//services/viz/privileged/mojom",
    "//services/webnn/host",
    "//services/webnn/public/mojom",
    "//ui/base",
    "//ui/base:ozone_buildflags",
    "//ui/gfx",
  ]

  public_deps = [
    "//components/viz/common",
    "//gpu/command_buffer/client",
    "//gpu/ipc/host",
    "//services/viz/privileged/mojom/compositing",
    "//services/viz/public/mojom",
    "//ui/gfx/geometry",
  ]

  if (is_apple) {
    deps += [ "//ui/accelerated_widget_mac" ]
  }

  if (use_ozone) {
    deps += [ "//ui/ozone" ]
  }

  if (is_win) {
    deps += [ "//services/webnn/public/cpp:win" ]
  }
}

viz_source_set("unit_tests") {
  testonly = true

  sources = [ "host_frame_sink_manager_unittest.cc" ]

  if (enable_skia_graphite_tests) {
    sources += [ "persistent_cache_sandboxed_file_factory_unittest.cc" ]
  }

  deps = [
    ":host",
    "//base",
    "//base/test:test_support",
    "//components/viz/test:test_support",
    "//gpu/ipc/host",
    "//media:media_buildflags",
    "//mojo/public/cpp/bindings",
    "//services/viz/privileged/mojom",
    "//services/viz/public/mojom",
    "//testing/gmock",
    "//testing/gtest",
  ]

  if (use_ozone) {
    deps += [ "//ui/ozone" ]
  }
}
