[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 1 | # Copyright (c) 2012 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 | |
davidsz | 041528a | 2017-05-12 09:19:23 | [diff] [blame] | 5 | import("//build/buildflag_header.gni") |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 6 | import("//build/config/nacl/config.gni") |
Daniel Cheng | a75606f | 2018-03-13 05:01:46 | [diff] [blame] | 7 | import("//ipc/features.gni") |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 8 | import("//mojo/public/tools/bindings/mojom.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 9 | import("//testing/test.gni") |
ochang | cc11d0e | 2016-04-26 19:58:26 | [diff] [blame] | 10 | import("//tools/ipc_fuzzer/ipc_fuzzer.gni") |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 11 | import("//third_party/protobuf/proto_library.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 12 | |
Scott Violet | a35f9a4 | 2018-03-22 22:00:44 | [diff] [blame] | 13 | buildflag_header("ipc_buildflags") { |
| 14 | header = "ipc_buildflags.h" |
davidsz | 041528a | 2017-05-12 09:19:23 | [diff] [blame] | 15 | |
| 16 | flags = [ "IPC_MESSAGE_LOG_ENABLED=$enable_ipc_logging" ] |
| 17 | } |
| 18 | |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 19 | component("ipc") { |
| 20 | sources = [ |
Daniel Bratell | 7c413be | 2018-10-19 17:50:02 | [diff] [blame] | 21 | # These are the param_traits sources needed by all platforms, |
| 22 | # including ios. The rest are added in a conditional block below. |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 23 | "ipc_message_utils.cc", |
| 24 | "ipc_message_utils.h", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 25 | "ipc_mojo_param_traits.cc", |
| 26 | "ipc_mojo_param_traits.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 27 | "param_traits_log_macros.h", |
| 28 | "param_traits_macros.h", |
| 29 | "param_traits_read_macros.h", |
| 30 | "param_traits_write_macros.h", |
| 31 | "struct_constructor_macros.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 32 | ] |
| 33 | |
Daniel Bratell | 7c413be | 2018-10-19 17:50:02 | [diff] [blame] | 34 | if (!is_ios) { |
| 35 | sources += [ |
| 36 | # Most sources go here since ios only needs the param_traits |
| 37 | # code. |
| 38 | "ipc_channel.h", |
| 39 | "ipc_channel_common.cc", |
| 40 | "ipc_channel_factory.cc", |
| 41 | "ipc_channel_factory.h", |
| 42 | "ipc_channel_handle.h", |
| 43 | "ipc_channel_mojo.cc", |
| 44 | "ipc_channel_mojo.h", |
| 45 | "ipc_channel_proxy.cc", |
| 46 | "ipc_channel_proxy.h", |
| 47 | "ipc_channel_reader.cc", |
| 48 | "ipc_channel_reader.h", |
| 49 | "ipc_listener.h", |
| 50 | "ipc_logging.cc", |
| 51 | "ipc_logging.h", |
| 52 | "ipc_message_macros.h", |
| 53 | "ipc_message_pipe_reader.cc", |
| 54 | "ipc_message_pipe_reader.h", |
| 55 | "ipc_message_start.h", |
| 56 | "ipc_message_templates.h", |
| 57 | "ipc_message_templates_impl.h", |
| 58 | "ipc_mojo_bootstrap.cc", |
| 59 | "ipc_mojo_bootstrap.h", |
| 60 | "ipc_sender.h", |
| 61 | "ipc_sync_channel.cc", |
| 62 | "ipc_sync_channel.h", |
| 63 | "ipc_sync_message_filter.cc", |
| 64 | "ipc_sync_message_filter.h", |
| 65 | "message_filter.cc", |
| 66 | "message_filter.h", |
| 67 | "message_filter_router.cc", |
| 68 | "message_filter_router.h", |
| 69 | "message_router.cc", |
| 70 | "message_router.h", |
| 71 | ] |
| 72 | } |
| 73 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 74 | if (is_nacl && !is_nacl_nonsfi) { |
Daniel Bratell | 7c413be | 2018-10-19 17:50:02 | [diff] [blame] | 75 | sources += [ |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 76 | "ipc_channel_nacl.cc", |
| 77 | "ipc_channel_nacl.h", |
| 78 | ] |
Daniel Bratell | 7c413be | 2018-10-19 17:50:02 | [diff] [blame] | 79 | } else { |
| 80 | sources += [ "ipc_channel.cc" ] |
[email protected] | 517d528 | 2014-04-02 17:03:30 | [diff] [blame] | 81 | } |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 82 | |
Ken Rockot | 3044d21 | 2018-01-23 02:44:39 | [diff] [blame] | 83 | defines = [ "IS_IPC_IMPL" ] |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 84 | |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 85 | public_deps = [ |
Scott Violet | a35f9a4 | 2018-03-22 22:00:44 | [diff] [blame] | 86 | ":ipc_buildflags", |
Ken Rockot | fd90763 | 2017-09-14 04:23:41 | [diff] [blame] | 87 | ":message_support", |
rockot | a628d0b | 2017-02-09 08:40:15 | [diff] [blame] | 88 | ":mojom", |
Eve Martin-Jones | 475e7e6 | 2018-02-13 22:57:25 | [diff] [blame] | 89 | ":native_handle_type_converters", |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 90 | ":param_traits", |
Ken Rockot | 4c5bd80 | 2018-07-12 01:37:11 | [diff] [blame] | 91 | "//mojo/public/cpp/base", |
leon.han | f870ab5 | 2016-07-14 15:03:48 | [diff] [blame] | 92 | "//mojo/public/cpp/bindings", |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 93 | "//mojo/public/cpp/system", |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 94 | ] |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 95 | |
| 96 | if (!is_nacl_nonsfi) { |
Mike Bjorge | b7bf5b9 | 2017-07-28 00:43:49 | [diff] [blame] | 97 | sources += [ "ipc_message_protobuf_utils.h" ] |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 98 | |
Mike Bjorge | b7bf5b9 | 2017-07-28 00:43:49 | [diff] [blame] | 99 | public_deps += [ "//third_party/protobuf:protobuf_lite" ] |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 100 | } |
| 101 | |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 102 | deps = [ |
| 103 | "//base", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 104 | ] |
Sergey Ulanov | 384a29c9 | 2015-09-14 17:11:35 | [diff] [blame] | 105 | |
ochang | cc11d0e | 2016-04-26 19:58:26 | [diff] [blame] | 106 | if (enable_ipc_fuzzer) { |
| 107 | public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ] |
| 108 | } |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 109 | } |
| 110 | |
Ken Rockot | fd90763 | 2017-09-14 04:23:41 | [diff] [blame] | 111 | component("message_support") { |
| 112 | sources = [ |
| 113 | "handle_attachment_win.cc", |
| 114 | "handle_attachment_win.h", |
| 115 | "handle_win.cc", |
| 116 | "handle_win.h", |
| 117 | "ipc_message.cc", |
| 118 | "ipc_message.h", |
| 119 | "ipc_message_attachment.cc", |
| 120 | "ipc_message_attachment.h", |
| 121 | "ipc_message_attachment_set.cc", |
| 122 | "ipc_message_attachment_set.h", |
| 123 | "ipc_message_support_export.h", |
| 124 | "ipc_mojo_handle_attachment.cc", |
| 125 | "ipc_mojo_handle_attachment.h", |
| 126 | "ipc_mojo_message_helper.cc", |
| 127 | "ipc_mojo_message_helper.h", |
| 128 | "ipc_platform_file.cc", |
| 129 | "ipc_platform_file.h", |
Ken Rockot | fd90763 | 2017-09-14 04:23:41 | [diff] [blame] | 130 | "ipc_sync_message.cc", |
| 131 | "ipc_sync_message.h", |
| 132 | "mach_port_attachment_mac.cc", |
| 133 | "mach_port_attachment_mac.h", |
| 134 | "mach_port_mac.cc", |
| 135 | "mach_port_mac.h", |
| 136 | ] |
| 137 | |
Fabrice de Gans-Riberi | 3fdec69 | 2018-04-20 21:53:59 | [diff] [blame] | 138 | if (is_posix || is_fuchsia) { |
| 139 | sources += [ |
| 140 | "ipc_platform_file_attachment_posix.cc", |
| 141 | "ipc_platform_file_attachment_posix.h", |
| 142 | ] |
| 143 | } |
| 144 | |
Ken Rockot | fd90763 | 2017-09-14 04:23:41 | [diff] [blame] | 145 | if (is_fuchsia) { |
| 146 | sources += [ |
| 147 | "handle_attachment_fuchsia.cc", |
| 148 | "handle_attachment_fuchsia.h", |
| 149 | "handle_fuchsia.cc", |
| 150 | "handle_fuchsia.h", |
| 151 | ] |
| 152 | } |
| 153 | |
| 154 | defines = [ "IPC_MESSAGE_SUPPORT_IMPL" ] |
| 155 | |
| 156 | public_deps = [ |
Scott Violet | a35f9a4 | 2018-03-22 22:00:44 | [diff] [blame] | 157 | ":ipc_buildflags", |
Ken Rockot | fd90763 | 2017-09-14 04:23:41 | [diff] [blame] | 158 | ":param_traits", |
| 159 | "//base", |
| 160 | "//mojo/public/cpp/system", |
| 161 | ] |
| 162 | |
| 163 | if (is_win || is_mac) { |
| 164 | # On Windows HandleAttachmentWin needs to generate random IDs. |
| 165 | # On Mac MachPortAttachmentMac needs to generate random IDs. |
| 166 | deps = [ |
| 167 | "//crypto", |
| 168 | ] |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | source_set("native_handle_type_converters") { |
| 173 | sources = [ |
| 174 | "native_handle_type_converters.cc", |
| 175 | "native_handle_type_converters.h", |
| 176 | ] |
| 177 | public_deps = [ |
| 178 | ":message_support", |
Marek Haranczyk | 0779589 | 2018-08-14 09:46:03 | [diff] [blame] | 179 | "//mojo/public/interfaces/bindings:bindings_headers", |
Ken Rockot | fd90763 | 2017-09-14 04:23:41 | [diff] [blame] | 180 | ] |
| 181 | } |
| 182 | |
Ken Rockot | fe0424e7 | 2017-05-13 02:29:08 | [diff] [blame] | 183 | mojom_component("mojom") { |
| 184 | output_prefix = "ipc_mojom" |
| 185 | macro_prefix = "IPC_MOJOM" |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 186 | sources = [ |
| 187 | "ipc.mojom", |
| 188 | ] |
Yuzhu Shen | a0a2b36 | 2017-08-25 22:31:39 | [diff] [blame] | 189 | public_deps = [ |
Eve Martin-Jones | 475e7e6 | 2018-02-13 22:57:25 | [diff] [blame] | 190 | "//mojo/public/interfaces/bindings", |
Ken Rockot | 4c5bd80 | 2018-07-12 01:37:11 | [diff] [blame] | 191 | "//mojo/public/mojom/base", |
Yuzhu Shen | a0a2b36 | 2017-08-25 22:31:39 | [diff] [blame] | 192 | ] |
Ken Rockot | fd90763 | 2017-09-14 04:23:41 | [diff] [blame] | 193 | |
| 194 | # Don't generate a variant sources since we depend on generated internal |
| 195 | # bindings types and we don't generate or build variants of those. |
| 196 | disable_variants = true |
| 197 | } |
| 198 | |
| 199 | mojom("mojom_constants") { |
| 200 | sources = [ |
| 201 | "constants.mojom", |
| 202 | ] |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 203 | } |
| 204 | |
rockot | 7c6bf95 | 2016-07-14 00:34:11 | [diff] [blame] | 205 | mojom("test_interfaces") { |
| 206 | testonly = true |
| 207 | sources = [ |
| 208 | "ipc_test.mojom", |
| 209 | ] |
Ken Rockot | 474df014 | 2017-07-12 13:28:56 | [diff] [blame] | 210 | support_lazy_serialization = true |
rockot | 7c6bf95 | 2016-07-14 00:34:11 | [diff] [blame] | 211 | } |
| 212 | |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 213 | # This is provided as a separate target so other targets can provide param |
| 214 | # traits implementations without necessarily linking to all of IPC. |
| 215 | source_set("param_traits") { |
| 216 | public = [ |
| 217 | "ipc_param_traits.h", |
| 218 | ] |
| 219 | } |
| 220 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 221 | if (!is_ios) { |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 222 | source_set("run_all_unittests") { |
| 223 | testonly = true |
| 224 | |
| 225 | sources = [ |
| 226 | "run_all_unittests.cc", |
| 227 | ] |
| 228 | |
| 229 | deps = [ |
| 230 | "//base", |
| 231 | "//base/test:test_support", |
Ken Rockot | 8a7f35f | 2018-07-04 19:40:56 | [diff] [blame] | 232 | "//mojo/core/embedder", |
| 233 | "//mojo/core/test:test_support", |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 234 | ] |
| 235 | } |
| 236 | |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 237 | proto_library("test_proto") { |
| 238 | sources = [ |
| 239 | "test_proto.proto", |
| 240 | ] |
| 241 | } |
| 242 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 243 | test("ipc_tests") { |
| 244 | sources = [ |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 245 | "ipc_channel_mojo_unittest.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 246 | "ipc_channel_proxy_unittest.cc", |
| 247 | "ipc_channel_reader_unittest.cc", |
| 248 | "ipc_fuzzing_tests.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 249 | "ipc_message_unittest.cc", |
| 250 | "ipc_message_utils_unittest.cc", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 251 | "ipc_mojo_bootstrap_unittest.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 252 | "ipc_sync_channel_unittest.cc", |
| 253 | "ipc_sync_message_unittest.cc", |
| 254 | "ipc_sync_message_unittest.h", |
| 255 | "ipc_test_message_generator.cc", |
| 256 | "ipc_test_message_generator.h", |
| 257 | "ipc_test_messages.h", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 258 | "sync_socket_unittest.cc", |
| 259 | ] |
pkotwicz | a553a3b | 2015-10-16 22:29:46 | [diff] [blame] | 260 | |
Fabrice de Gans-Riberi | 3fdec69 | 2018-04-20 21:53:59 | [diff] [blame] | 261 | if (is_posix || is_fuchsia) { |
| 262 | sources += [ "ipc_message_attachment_set_posix_unittest.cc" ] |
| 263 | } |
| 264 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 265 | if (!is_ios) { |
| 266 | sources += [ "ipc_send_fds_test.cc" ] |
| 267 | } |
| 268 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 269 | deps = [ |
| 270 | ":ipc", |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 271 | ":run_all_unittests", |
rockot | 7c6bf95 | 2016-07-14 00:34:11 | [diff] [blame] | 272 | ":test_interfaces", |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 273 | ":test_proto", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 274 | ":test_support", |
| 275 | "//base", |
| 276 | "//base:i18n", |
| 277 | "//base/test:test_support", |
| 278 | "//crypto", |
Ken Rockot | 8a7f35f | 2018-07-04 19:40:56 | [diff] [blame] | 279 | "//mojo/core/embedder", |
| 280 | "//mojo/core/test:test_support", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 281 | "//testing/gtest", |
| 282 | ] |
| 283 | |
| 284 | if (is_mac) { |
| 285 | deps += [ "//sandbox/mac:seatbelt" ] |
| 286 | } |
Scott Graham | f4b38b4 | 2017-06-19 23:09:33 | [diff] [blame] | 287 | |
| 288 | if (is_fuchsia) { |
| 289 | sources -= [ |
| 290 | # No AF_UNIX domain sockets on Fuchsia. |
| 291 | "sync_socket_unittest.cc", |
| 292 | ] |
| 293 | } |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 294 | |
| 295 | if (!is_nacl_nonsfi) { |
Mike Bjorge | b7bf5b9 | 2017-07-28 00:43:49 | [diff] [blame] | 296 | sources += [ "ipc_message_protobuf_utils_unittest.cc" ] |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 297 | } |
dpranke | 177c1e2 | 2015-07-22 23:07:43 | [diff] [blame] | 298 | } |
| 299 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 300 | test("ipc_perftests") { |
| 301 | sources = [ |
Yuzhu Shen | 4d50dc4 | 2017-09-06 20:39:09 | [diff] [blame] | 302 | "ipc_cpu_perftest.cc", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 303 | "ipc_mojo_perftest.cc", |
Yuzhu Shen | 4d50dc4 | 2017-09-06 20:39:09 | [diff] [blame] | 304 | "ipc_perftest_messages.cc", |
| 305 | "ipc_perftest_messages.h", |
| 306 | "ipc_perftest_util.cc", |
| 307 | "ipc_perftest_util.h", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 308 | "run_all_perftests.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 309 | ] |
| 310 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 311 | deps = [ |
| 312 | ":ipc", |
jam | ca86c9e | 2017-01-06 19:55:57 | [diff] [blame] | 313 | ":test_interfaces", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 314 | ":test_support", |
| 315 | "//base", |
| 316 | "//base:i18n", |
| 317 | "//base/test:test_support", |
Ken Rockot | 8a7f35f | 2018-07-04 19:40:56 | [diff] [blame] | 318 | "//mojo/core/embedder", |
| 319 | "//mojo/core/test:test_support", |
| 320 | "//mojo/core/test:test_support_impl", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 321 | "//testing/gtest", |
| 322 | ] |
brettw | a59908d2 | 2016-01-21 19:16:48 | [diff] [blame] | 323 | } |
| 324 | |
brettw | 3871f52 | 2016-07-14 22:08:34 | [diff] [blame] | 325 | static_library("test_support") { |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 326 | testonly = true |
| 327 | sources = [ |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 328 | "ipc_security_test_util.cc", |
| 329 | "ipc_security_test_util.h", |
| 330 | "ipc_test_base.cc", |
| 331 | "ipc_test_base.h", |
| 332 | "ipc_test_channel_listener.cc", |
| 333 | "ipc_test_channel_listener.h", |
| 334 | "ipc_test_sink.cc", |
| 335 | "ipc_test_sink.h", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 336 | ] |
| 337 | public_deps = [ |
| 338 | ":ipc", |
| 339 | ] |
| 340 | deps = [ |
| 341 | "//base", |
| 342 | "//base/test:test_support", |
Ken Rockot | 8a7f35f | 2018-07-04 19:40:56 | [diff] [blame] | 343 | "//mojo/core/test:test_support", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 344 | "//testing/gtest", |
| 345 | ] |
kerrnel | dc059fe | 2016-04-12 16:39:06 | [diff] [blame] | 346 | } |
pkotwicz | a553a3b | 2015-10-16 22:29:46 | [diff] [blame] | 347 | } |