blob: 5753bd5c0fbc1ebfe3ee2cd18f9b1dfe510a4a06 [file] [log] [blame]
[email protected]7603bbd12013-08-13 17:33:371# 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
davidsz041528a2017-05-12 09:19:235import("//build/buildflag_header.gni")
phosek636bceb32015-10-27 03:36:486import("//build/config/nacl/config.gni")
amistryd4aa70d2016-06-23 07:52:377import("//mojo/public/tools/bindings/mojom.gni")
qsrfb5251d12015-01-21 15:57:228import("//testing/test.gni")
ochangcc11d0e2016-04-26 19:58:269import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
zijiehe84eef4fa2017-07-18 20:39:5010import("//third_party/protobuf/proto_library.gni")
qsrfb5251d12015-01-21 15:57:2211
davidsz041528a2017-05-12 09:19:2312declare_args() {
13 # Enabling debug builds automatically sets enable_ipc_logging to true.
14 enable_ipc_logging = is_debug
15}
16
17buildflag_header("ipc_features") {
18 header = "ipc_features.h"
19
20 flags = [ "IPC_MESSAGE_LOG_ENABLED=$enable_ipc_logging" ]
21}
22
[email protected]7603bbd12013-08-13 17:33:3723component("ipc") {
24 sources = [
mdempsky8a519042016-02-09 05:41:4725 "export_template.h",
erikcheneece6c32015-07-07 22:13:1126 "handle_attachment_win.cc",
erikchen151b2f92015-06-16 20:20:5127 "handle_attachment_win.h",
erikchen959039d2015-08-11 21:17:4728 "handle_win.cc",
29 "handle_win.h",
[email protected]7603bbd12013-08-13 17:33:3730 "ipc_channel.cc",
31 "ipc_channel.h",
scottmg7c7296f42015-02-28 02:23:0932 "ipc_channel_common.cc",
[email protected]64860882014-08-04 23:44:1733 "ipc_channel_factory.cc",
34 "ipc_channel_factory.h",
[email protected]7603bbd12013-08-13 17:33:3735 "ipc_channel_handle.h",
amistryd4aa70d2016-06-23 07:52:3736 "ipc_channel_mojo.cc",
37 "ipc_channel_mojo.h",
[email protected]7603bbd12013-08-13 17:33:3738 "ipc_channel_nacl.cc",
39 "ipc_channel_nacl.h",
[email protected]7603bbd12013-08-13 17:33:3740 "ipc_channel_proxy.cc",
41 "ipc_channel_proxy.h",
42 "ipc_channel_reader.cc",
43 "ipc_channel_reader.h",
[email protected]7603bbd12013-08-13 17:33:3744 "ipc_export.h",
[email protected]7603bbd12013-08-13 17:33:3745 "ipc_listener.h",
46 "ipc_logging.cc",
47 "ipc_logging.h",
48 "ipc_message.cc",
49 "ipc_message.h",
morrita98b7aaa2015-01-26 22:42:5450 "ipc_message_attachment.cc",
51 "ipc_message_attachment.h",
morrita4b5c28e22015-01-14 21:17:0652 "ipc_message_attachment_set.cc",
53 "ipc_message_attachment_set.h",
[email protected]7603bbd12013-08-13 17:33:3754 "ipc_message_macros.h",
amistryd4aa70d2016-06-23 07:52:3755 "ipc_message_pipe_reader.cc",
56 "ipc_message_pipe_reader.h",
[email protected]7603bbd12013-08-13 17:33:3757 "ipc_message_start.h",
mdempsky8a519042016-02-09 05:41:4758 "ipc_message_templates.h",
59 "ipc_message_templates_impl.h",
[email protected]7603bbd12013-08-13 17:33:3760 "ipc_message_utils.cc",
61 "ipc_message_utils.h",
amistryd4aa70d2016-06-23 07:52:3762 "ipc_mojo_bootstrap.cc",
63 "ipc_mojo_bootstrap.h",
64 "ipc_mojo_handle_attachment.cc",
65 "ipc_mojo_handle_attachment.h",
66 "ipc_mojo_message_helper.cc",
67 "ipc_mojo_message_helper.h",
68 "ipc_mojo_param_traits.cc",
69 "ipc_mojo_param_traits.h",
[email protected]7603bbd12013-08-13 17:33:3770 "ipc_platform_file.cc",
71 "ipc_platform_file.h",
morrita1aa788c2015-01-31 05:45:4272 "ipc_platform_file_attachment_posix.cc",
73 "ipc_platform_file_attachment_posix.h",
[email protected]7603bbd12013-08-13 17:33:3774 "ipc_sender.h",
[email protected]7603bbd12013-08-13 17:33:3775 "ipc_sync_channel.cc",
76 "ipc_sync_channel.h",
77 "ipc_sync_message.cc",
78 "ipc_sync_message.h",
79 "ipc_sync_message_filter.cc",
80 "ipc_sync_message_filter.h",
erikchen1c1e6652015-10-01 18:51:3281 "mach_port_attachment_mac.cc",
82 "mach_port_attachment_mac.h",
83 "mach_port_mac.cc",
84 "mach_port_mac.h",
[email protected]74122042014-04-25 00:07:3085 "message_filter.cc",
86 "message_filter.h",
87 "message_filter_router.cc",
88 "message_filter_router.h",
markdittmer638a1492016-02-19 01:11:5089 "message_router.cc",
90 "message_router.h",
[email protected]7603bbd12013-08-13 17:33:3791 "param_traits_log_macros.h",
92 "param_traits_macros.h",
93 "param_traits_read_macros.h",
94 "param_traits_write_macros.h",
95 "struct_constructor_macros.h",
96 "struct_destructor_macros.h",
[email protected]7603bbd12013-08-13 17:33:3797 ]
98
phosek636bceb32015-10-27 03:36:4899 if (is_nacl && !is_nacl_nonsfi) {
sammccde362062016-11-23 02:33:57100 sources -= [ "ipc_channel.cc" ]
dpranke6065cf72015-02-26 03:30:58101 } else {
[email protected]7603bbd12013-08-13 17:33:37102 sources -= [
103 "ipc_channel_nacl.cc",
104 "ipc_channel_nacl.h",
105 ]
[email protected]517d5282014-04-02 17:03:30106 }
[email protected]7603bbd12013-08-13 17:33:37107
Scott Graham3eebff02017-06-30 01:07:10108 if (is_fuchsia) {
109 sources += [
110 "handle_attachment_fuchsia.cc",
111 "handle_attachment_fuchsia.h",
112 "handle_fuchsia.cc",
113 "handle_fuchsia.h",
114 ]
115 }
116
[email protected]7603bbd12013-08-13 17:33:37117 defines = [ "IPC_IMPLEMENTATION" ]
118
brettwb7f2c302015-12-08 01:29:21119 public_deps = [
davidsz041528a2017-05-12 09:19:23120 ":ipc_features",
rockota628d0b2017-02-09 08:40:15121 ":mojom",
brettwb7f2c302015-12-08 01:29:21122 ":param_traits",
leon.hanf870ab52016-07-14 15:03:48123 "//mojo/public/cpp/bindings",
rockot6d7be622016-06-15 18:25:19124 "//mojo/public/cpp/system",
brettwb7f2c302015-12-08 01:29:21125 ]
zijiehe84eef4fa2017-07-18 20:39:50126
127 if (!is_nacl_nonsfi) {
Mike Bjorgeb7bf5b92017-07-28 00:43:49128 sources += [ "ipc_message_protobuf_utils.h" ]
zijiehe84eef4fa2017-07-18 20:39:50129
Mike Bjorgeb7bf5b92017-07-28 00:43:49130 public_deps += [ "//third_party/protobuf:protobuf_lite" ]
zijiehe84eef4fa2017-07-18 20:39:50131 }
132
[email protected]7603bbd12013-08-13 17:33:37133 deps = [
134 "//base",
[email protected]7603bbd12013-08-13 17:33:37135 ]
Sergey Ulanov384a29c92015-09-14 17:11:35136
erikchen3ee5d55e32015-10-09 23:20:49137 if (is_win || is_mac) {
138 # On Windows HandleAttachmentWin needs to generate random IDs.
139 # On Mac MachPortAttachmentMac needs to generate random IDs.
Sergey Ulanov384a29c92015-09-14 17:11:35140 deps += [ "//crypto" ]
141 }
ochangcc11d0e2016-04-26 19:58:26142
143 if (enable_ipc_fuzzer) {
144 public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
145 }
[email protected]7603bbd12013-08-13 17:33:37146}
147
Ken Rockotfe0424e72017-05-13 02:29:08148mojom_component("mojom") {
149 output_prefix = "ipc_mojom"
150 macro_prefix = "IPC_MOJOM"
amistryd4aa70d2016-06-23 07:52:37151 sources = [
152 "ipc.mojom",
153 ]
Yuzhu Shena0a2b362017-08-25 22:31:39154 public_deps = [
155 "//mojo/common:read_only_buffer",
156 ]
amistryd4aa70d2016-06-23 07:52:37157}
158
rockot7c6bf952016-07-14 00:34:11159mojom("test_interfaces") {
160 testonly = true
161 sources = [
162 "ipc_test.mojom",
163 ]
Ken Rockot474df0142017-07-12 13:28:56164 support_lazy_serialization = true
rockot7c6bf952016-07-14 00:34:11165}
166
brettwb7f2c302015-12-08 01:29:21167# This is provided as a separate target so other targets can provide param
168# traits implementations without necessarily linking to all of IPC.
169source_set("param_traits") {
170 public = [
171 "ipc_param_traits.h",
172 ]
173}
174
sdefresne6fd373e2016-05-24 21:24:06175if (!is_ios) {
rockot6d7be622016-06-15 18:25:19176 source_set("run_all_unittests") {
177 testonly = true
178
179 sources = [
180 "run_all_unittests.cc",
181 ]
182
183 deps = [
184 "//base",
185 "//base/test:test_support",
186 "//mojo/edk/system",
amistryd4aa70d2016-06-23 07:52:37187 "//mojo/edk/test:test_support",
rockot6d7be622016-06-15 18:25:19188 ]
189 }
190
zijiehe84eef4fa2017-07-18 20:39:50191 proto_library("test_proto") {
192 sources = [
193 "test_proto.proto",
194 ]
195 }
196
sdefresne6fd373e2016-05-24 21:24:06197 test("ipc_tests") {
198 sources = [
amistryd4aa70d2016-06-23 07:52:37199 "ipc_channel_mojo_unittest.cc",
sdefresne6fd373e2016-05-24 21:24:06200 "ipc_channel_proxy_unittest.cc",
201 "ipc_channel_reader_unittest.cc",
202 "ipc_fuzzing_tests.cc",
203 "ipc_message_attachment_set_posix_unittest.cc",
204 "ipc_message_unittest.cc",
205 "ipc_message_utils_unittest.cc",
amistryd4aa70d2016-06-23 07:52:37206 "ipc_mojo_bootstrap_unittest.cc",
sdefresne6fd373e2016-05-24 21:24:06207 "ipc_sync_channel_unittest.cc",
208 "ipc_sync_message_unittest.cc",
209 "ipc_sync_message_unittest.h",
210 "ipc_test_message_generator.cc",
211 "ipc_test_message_generator.h",
212 "ipc_test_messages.h",
sdefresne6fd373e2016-05-24 21:24:06213 "sync_socket_unittest.cc",
214 ]
pkotwicza553a3b2015-10-16 22:29:46215
sdefresne6fd373e2016-05-24 21:24:06216 if (!is_ios) {
217 sources += [ "ipc_send_fds_test.cc" ]
218 }
219
sdefresne6fd373e2016-05-24 21:24:06220 deps = [
221 ":ipc",
rockot6d7be622016-06-15 18:25:19222 ":run_all_unittests",
rockot7c6bf952016-07-14 00:34:11223 ":test_interfaces",
zijiehe84eef4fa2017-07-18 20:39:50224 ":test_proto",
sdefresne6fd373e2016-05-24 21:24:06225 ":test_support",
226 "//base",
227 "//base:i18n",
228 "//base/test:test_support",
229 "//crypto",
amistryd4aa70d2016-06-23 07:52:37230 "//mojo/edk/system",
231 "//mojo/edk/test:test_support",
sdefresne6fd373e2016-05-24 21:24:06232 "//testing/gtest",
233 ]
234
235 if (is_mac) {
236 deps += [ "//sandbox/mac:seatbelt" ]
237 }
Scott Grahamf4b38b42017-06-19 23:09:33238
239 if (is_fuchsia) {
240 sources -= [
241 # No AF_UNIX domain sockets on Fuchsia.
242 "sync_socket_unittest.cc",
243 ]
244 }
zijiehe84eef4fa2017-07-18 20:39:50245
246 if (!is_nacl_nonsfi) {
Mike Bjorgeb7bf5b92017-07-28 00:43:49247 sources += [ "ipc_message_protobuf_utils_unittest.cc" ]
zijiehe84eef4fa2017-07-18 20:39:50248 }
dpranke177c1e22015-07-22 23:07:43249 }
250
sdefresne6fd373e2016-05-24 21:24:06251 test("ipc_perftests") {
252 sources = [
Yuzhu Shen4d50dc42017-09-06 20:39:09253 "ipc_cpu_perftest.cc",
amistryd4aa70d2016-06-23 07:52:37254 "ipc_mojo_perftest.cc",
Yuzhu Shen4d50dc42017-09-06 20:39:09255 "ipc_perftest_messages.cc",
256 "ipc_perftest_messages.h",
257 "ipc_perftest_util.cc",
258 "ipc_perftest_util.h",
amistryd4aa70d2016-06-23 07:52:37259 "run_all_perftests.cc",
sdefresne6fd373e2016-05-24 21:24:06260 ]
261
sdefresne6fd373e2016-05-24 21:24:06262 deps = [
263 ":ipc",
jamca86c9e2017-01-06 19:55:57264 ":test_interfaces",
sdefresne6fd373e2016-05-24 21:24:06265 ":test_support",
266 "//base",
267 "//base:i18n",
268 "//base/test:test_support",
amistryd4aa70d2016-06-23 07:52:37269 "//mojo/edk/system",
270 "//mojo/edk/test:test_support",
jamca86c9e2017-01-06 19:55:57271 "//mojo/edk/test:test_support_impl",
sdefresne6fd373e2016-05-24 21:24:06272 "//testing/gtest",
273 ]
brettwa59908d22016-01-21 19:16:48274 }
275
brettw3871f522016-07-14 22:08:34276 static_library("test_support") {
sdefresne6fd373e2016-05-24 21:24:06277 testonly = true
278 sources = [
sdefresne6fd373e2016-05-24 21:24:06279 "ipc_security_test_util.cc",
280 "ipc_security_test_util.h",
281 "ipc_test_base.cc",
282 "ipc_test_base.h",
283 "ipc_test_channel_listener.cc",
284 "ipc_test_channel_listener.h",
285 "ipc_test_sink.cc",
286 "ipc_test_sink.h",
sdefresne6fd373e2016-05-24 21:24:06287 ]
288 public_deps = [
289 ":ipc",
290 ]
291 deps = [
292 "//base",
293 "//base/test:test_support",
sammc4bcc4ed62016-10-27 10:13:59294 "//mojo/edk/test:test_support",
sdefresne6fd373e2016-05-24 21:24:06295 "//testing/gtest",
296 ]
kerrneldc059fe2016-04-12 16:39:06297 }
pkotwicza553a3b2015-10-16 22:29:46298}