blob: 5f51166850100040de3537d6140abedd5ad21e03 [file] [log] [blame]
Ryan Powell30287d42019-08-15 15:48:321# 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
Sylvain Defresne13c9a332019-10-30 18:25:125# Reset sources_assignment_filter for the BUILD.gn file to prevent
6# regression during the migration of Chromium away from the feature.
7# See build/no_sources_assignment_filter.md for more information.
8# TODO(crbug.com/1018739): remove this when migration is done.
9set_sources_assignment_filter([])
10
Ryan Powell30287d42019-08-15 15:48:3211source_set("memory_pressure") {
12 sources = [
13 "memory_pressure_voter.cc",
14 "memory_pressure_voter.h",
15 "multi_source_memory_pressure_monitor.cc",
16 "multi_source_memory_pressure_monitor.h",
Ryan Powella68d66fc2019-08-19 21:32:3917 "system_memory_pressure_evaluator.cc",
18 "system_memory_pressure_evaluator.h",
Ryan Powell30287d42019-08-15 15:48:3219 ]
20
Weze8b1e1a2020-02-17 16:14:2921 deps = [ "//base" ]
22
Sylvain Defresne13c9a332019-10-30 18:25:1223 if (is_win) {
24 sources += [
25 "system_memory_pressure_evaluator_win.cc",
26 "system_memory_pressure_evaluator_win.h",
27 ]
28 }
29
30 if (is_mac) {
31 sources += [
32 "system_memory_pressure_evaluator_mac.cc",
33 "system_memory_pressure_evaluator_mac.h",
34 ]
35 }
36
Weze8b1e1a2020-02-17 16:14:2937 if (is_fuchsia) {
38 deps += [
Wez174807c42020-03-01 21:00:3039 "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.memorypressure",
40 "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
Weze8b1e1a2020-02-17 16:14:2941 ]
42 sources += [
43 "system_memory_pressure_evaluator_fuchsia.cc",
44 "system_memory_pressure_evaluator_fuchsia.h",
45 ]
46 }
47
Sylvain Defresne13c9a332019-10-30 18:25:1248 if (is_chromeos) {
49 sources += [
50 "system_memory_pressure_evaluator_chromeos.cc",
51 "system_memory_pressure_evaluator_chromeos.h",
52 ]
53 }
Ryan Powell30287d42019-08-15 15:48:3254}
55
56source_set("unittests") {
57 testonly = true
58 sources = [
59 "memory_pressure_voter_unittest.cc",
60 "multi_source_memory_pressure_monitor_unittest.cc",
61 ]
62
Sylvain Defresne13c9a332019-10-30 18:25:1263 if (is_win) {
64 sources += [ "system_memory_pressure_evaluator_win_unittest.cc" ]
65 }
66
67 if (is_mac) {
68 sources += [ "system_memory_pressure_evaluator_mac_unittest.cc" ]
69 }
70
71 if (is_chromeos) {
72 sources += [ "system_memory_pressure_evaluator_chromeos_unittest.cc" ]
73 }
74
Ryan Powell30287d42019-08-15 15:48:3275 deps = [
76 ":memory_pressure",
77 "//base",
78 "//base/test:test_support",
Ryan Powella68d66fc2019-08-19 21:32:3979 "//testing/gmock",
Ryan Powell30287d42019-08-15 15:48:3280 "//testing/gtest",
81 ]
82}
Sebastien Marchand1e9276e2019-10-08 00:03:5083
84static_library("test_support") {
85 testonly = true
86 sources = [
87 "fake_memory_pressure_monitor.cc",
88 "fake_memory_pressure_monitor.h",
89 ]
90
91 public_deps = [
92 ":memory_pressure",
93 "//base",
94 ]
95}