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

import("//content/common/features.gni")
import("//mojo/public/tools/bindings/mojom.gni")

mojom_component("mojom") {
  output_prefix = "content_browser_memory_coordinator_mojom"
  macro_prefix = "CONTENT_BROWSER_MEMORY_COORDINATOR_MOJOM"

  cpp_only = true

  sources = [ "memory_coordinator.mojom" ]

  if (enable_memory_coordinator_internals) {
    sources += [ "memory_coordinator_diagnostics.mojom" ]
    enabled_features = [ "ENABLE_MEMORY_COORDINATOR_INTERNALS" ]
  }

  public_deps = [ "//mojo/public/mojom/base" ]

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "content.mojom.MemoryConsumerTraits"
          cpp = "::base::MemoryConsumerTraits"
          copyable_pass_by_value = true
          default_constructible = false
        },
      ]

      traits_headers = [ "memory_consumer_traits_mojom_traits.h" ]
      traits_public_deps = [ "//base" ]
    },
    {
      types = [
        {
          mojom = "content.mojom.MemoryConsumerUpdate"
          cpp = "::content::MemoryConsumerUpdate"
          move_only = true
        },
      ]

      traits_headers = [ "memory_coordinator_mojom_traits.h" ]
      traits_public_deps = [ "//content/public/common:memory_consumer_update" ]
    },
  ]
}

mojom("test_interfaces") {
  cpp_only = true

  sources = [ "memory_consumer_traits_test.mojom" ]

  public_deps = [ ":mojom" ]
}
