File: BUILD.gn

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (145 lines) | stat: -rw-r--r-- 3,813 bytes parent folder | download | duplicates (3)
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
# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//base/allocator/allocator.gni")
import("//base/allocator/partition_allocator/partition_alloc.gni")

config("gwp_asan_implementation") {
  defines = [ "GWP_ASAN_IMPLEMENTATION" ]
}

source_set("export") {
  sources = [ "export.h" ]
}

source_set("features") {
  sources = [
    "gwp_asan_features.cc",
    "gwp_asan_features.h",
  ]
  deps = [
    ":export",
    "//base",
  ]
  configs += [
    ":gwp_asan_implementation",
    "//build/config/compiler:wexit_time_destructors",
    "//build/config/compiler:wglobal_constructors",
  ]

  if (is_android) {
    sources += [ "feature_map.cc" ]
    deps += [ "android:gwp_asan_jni" ]
  }
}

component("client") {
  output_name = "gwp_asan_client"
  sources = [
    "guarded_page_allocator.cc",
    "guarded_page_allocator.h",
    "gwp_asan.cc",
    "gwp_asan.h",
    "lightweight_detector/poison_metadata_recorder.cc",
    "lightweight_detector/poison_metadata_recorder.h",
    "lightweight_detector/shared_state.h",
    "sampling_helpers.cc",
    "sampling_helpers.h",
    "sampling_state.h",
    "thread_local_random_bit_generator.h",
    "thread_local_state.h",
  ]

  if (is_win) {
    sources += [ "guarded_page_allocator_win.cc" ]
  }

  if (is_posix) {
    sources += [ "guarded_page_allocator_posix.cc" ]
  }

  if (use_allocator_shim) {
    sources += [
      "extreme_lightweight_detector_malloc_shims.cc",
      "extreme_lightweight_detector_malloc_shims.h",
      "extreme_lightweight_detector_quarantine.cc",
      "extreme_lightweight_detector_quarantine.h",
      "lightweight_detector/malloc_shims.cc",
      "lightweight_detector/malloc_shims.h",
      "lightweight_detector/random_eviction_quarantine.cc",
      "lightweight_detector/random_eviction_quarantine.h",
      "sampling_malloc_shims.cc",
      "sampling_malloc_shims.h",
    ]
  }

  if (use_partition_alloc) {
    sources += [
      "lightweight_detector/partitionalloc_shims.cc",
      "lightweight_detector/partitionalloc_shims.h",
      "sampling_partitionalloc_shims.cc",
      "sampling_partitionalloc_shims.h",
    ]
  }

  configs += [
    "//build/config/compiler:wexit_time_destructors",
    "//build/config/compiler:wglobal_constructors",
  ]

  deps = [
    ":export",
    ":features",
    "//base",
    "//base/allocator:buildflags",
    "//components/crash/core/common:crash_key",
    "//components/gwp_asan/common",
    "//components/gwp_asan/common:crash_keys",
  ]

  configs += [ ":gwp_asan_implementation" ]

  if (is_android || is_ios) {
    deps += [ "//components/crash/core/app" ]
  }
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "guarded_page_allocator_unittest.cc",
    "gwp_asan_unittest.cc",
    "lightweight_detector/poison_metadata_recorder_unittest.cc",
    "sampling_helpers_unittest.cc",
  ]

  if (use_allocator_shim && !is_ios) {
    sources += [
      "extreme_lightweight_detector_malloc_shims_unittest.cc",
      "extreme_lightweight_detector_quarantine_unittest.cc",
      "lightweight_detector/malloc_shims_unittest.cc",
      "lightweight_detector/random_eviction_quarantine_unittest.cc",
      "sampling_malloc_shims_unittest.cc",
    ]
  }

  if (use_partition_alloc && !is_ios) {
    sources += [
      "lightweight_detector/partitionalloc_shims_unittest.cc",
      "sampling_partitionalloc_shims_unittest.cc",
    ]
  }

  deps = [
    ":client",
    "//base/allocator:buildflags",
    "//base/allocator/partition_allocator/src/partition_alloc:test_support",
    "//base/test:test_support",
    "//components/crash/core/common:crash_key",
    "//components/gwp_asan/common",
    "//components/gwp_asan/common:crash_keys",
    "//testing/gmock",
    "//testing/gtest",
  ]
}