BUILD.gn 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Copyright 2019 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//build/config/chromeos/ui_mode.gni")
  5. source_set("memory_pressure") {
  6. sources = [
  7. "memory_pressure_level_reporter.cc",
  8. "memory_pressure_level_reporter.h",
  9. "memory_pressure_voter.cc",
  10. "memory_pressure_voter.h",
  11. "multi_source_memory_pressure_monitor.cc",
  12. "multi_source_memory_pressure_monitor.h",
  13. "system_memory_pressure_evaluator.cc",
  14. "system_memory_pressure_evaluator.h",
  15. ]
  16. deps = [
  17. "//base",
  18. "//build:chromeos_buildflags",
  19. ]
  20. if (is_win) {
  21. sources += [
  22. "system_memory_pressure_evaluator_win.cc",
  23. "system_memory_pressure_evaluator_win.h",
  24. ]
  25. }
  26. if (is_mac) {
  27. sources += [
  28. "system_memory_pressure_evaluator_mac.cc",
  29. "system_memory_pressure_evaluator_mac.h",
  30. ]
  31. }
  32. if (is_fuchsia) {
  33. deps += [
  34. "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.memorypressure",
  35. "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
  36. ]
  37. sources += [
  38. "system_memory_pressure_evaluator_fuchsia.cc",
  39. "system_memory_pressure_evaluator_fuchsia.h",
  40. ]
  41. }
  42. if (is_linux || is_chromeos_lacros) {
  43. sources += [
  44. "system_memory_pressure_evaluator_linux.cc",
  45. "system_memory_pressure_evaluator_linux.h",
  46. ]
  47. }
  48. }
  49. source_set("unit_tests") {
  50. testonly = true
  51. sources = [
  52. "memory_pressure_level_reporter_unittest.cc",
  53. "memory_pressure_voter_unittest.cc",
  54. "multi_source_memory_pressure_monitor_unittest.cc",
  55. ]
  56. deps = [
  57. ":memory_pressure",
  58. "//base",
  59. "//base/test:test_support",
  60. "//testing/gmock",
  61. "//testing/gtest",
  62. ]
  63. if (is_win) {
  64. sources += [ "system_memory_pressure_evaluator_win_unittest.cc" ]
  65. }
  66. if (is_mac) {
  67. sources += [ "system_memory_pressure_evaluator_mac_unittest.cc" ]
  68. }
  69. if (is_fuchsia) {
  70. deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.memorypressure" ]
  71. sources += [ "system_memory_pressure_evaluator_fuchsia_unittest.cc" ]
  72. }
  73. if (is_linux || is_chromeos_lacros) {
  74. sources += [ "system_memory_pressure_evaluator_linux_unittest.cc" ]
  75. }
  76. }
  77. static_library("test_support") {
  78. testonly = true
  79. sources = [
  80. "fake_memory_pressure_monitor.cc",
  81. "fake_memory_pressure_monitor.h",
  82. ]
  83. public_deps = [
  84. ":memory_pressure",
  85. "//base",
  86. ]
  87. }