Reland "Add IPC layer + Platform implementation for Windows"
Reland of aosp/1539396. Fixes WIN32 in platform_windows and
small things that broke since then.
Reason for revert (aosp/1608095): broke chromium win32
https://ci.chromium.org/p/chromium/builders/ci/win32-archive-rel/20608?
https://chromium-review.googlesource.com/c/chromium/src/+/2717017
Original CL description:
The final CL that adds the Windows-specific IPC bits.
This implements the IPC transport as a AF_UNIX socket
and a named shared memory region. AF_UNIX doesn't
bring any major benefits really and I wonder whether
we should just use a TCP socket. In fact, AF_UNIX on
Windows misses the interesting bits of UNIX sockets:
(1) FD-passing is not supported; (2) Peer credentials
are not supported. Given that the shared memory is
based on an unguessable string, we could send that
over TCP as well.
#fixit
Bug: 174454879
Test: manual on Windows, the following works:
Change-Id: Iab7337e625338671873d5dffb169290fcbdd855e
perfetto_unittests.exe
perfetto_integrationtests.exe
traced.exe + perfetto.exe
stress_test.exe (there is something odd scheduling-wise here but
seems unrelated with the IPC port)
diff --git a/gn/perfetto.gni b/gn/perfetto.gni
index c1ff723..d7263e7 100644
--- a/gn/perfetto.gni
+++ b/gn/perfetto.gni
@@ -144,9 +144,12 @@
# system backend in the client library.
# This includes building things that rely on POSIX sockets, this places
# limitations on the supported operating systems.
- enable_perfetto_ipc = !is_win && !is_fuchsia && !is_nacl &&
- (perfetto_build_standalone ||
- perfetto_build_with_android || build_with_chromium)
+ # For now the IPC layer is conservatively not enabled on Chromium+Windows
+ # builds.
+ enable_perfetto_ipc =
+ !is_fuchsia && !is_nacl &&
+ (perfetto_build_standalone || perfetto_build_with_android ||
+ (build_with_chromium && !is_win))
# Makes the heap profiling daemon target reachable. It works only on Android,
# but is built on Linux as well for test/compiler coverage.
@@ -186,7 +189,7 @@
build_with_chromium || perfetto_build_with_android
enable_perfetto_integration_tests =
- (perfetto_build_standalone && !is_win) || perfetto_build_with_android
+ perfetto_build_standalone || perfetto_build_with_android
enable_perfetto_benchmarks = perfetto_build_standalone && !is_win
@@ -314,9 +317,6 @@
# |is_perfetto_build_generator| must be true.
assert(!perfetto_build_with_android || is_perfetto_build_generator)
-# The IPC layer based on UNIX sockets can't be built on Win.
-assert(!enable_perfetto_ipc || !is_win)
-
# We should never end up in a state where is_perfetto_embedder=true but
# perfetto_build_with_embedder=false.
assert(!is_perfetto_embedder || perfetto_build_with_embedder)
diff --git a/gn/proto_library.gni b/gn/proto_library.gni
index 03d6455..5b87753 100644
--- a/gn/proto_library.gni
+++ b/gn/proto_library.gni
@@ -173,6 +173,17 @@
} else {
deps += [ "$perfetto_root_path/src/ipc:common" ]
}
+ if (is_win) {
+ # TODO(primiano): investigate this. In Windows standalone builds, some
+ # executable targets end up in a state where no code pulls a dep on the
+ # ipc:client (in turn that seems a subtle consequence of not having
+ # traced_probes on Windows). This dep here is effectively needed because
+ # the client-side code in the generated .ipc.cc effectively depends on the
+ # client-side IPC library. Perhaps we just should do this unconditionally
+ # on all platforms?
+ deps += [ "$perfetto_root_path/src/ipc:client" ]
+ }
+
if (defined(invoker.deps)) {
deps += invoker.deps
}
diff --git a/gn/standalone/BUILD.gn b/gn/standalone/BUILD.gn
index af70070..31941ed 100644
--- a/gn/standalone/BUILD.gn
+++ b/gn/standalone/BUILD.gn
@@ -161,6 +161,8 @@
cflags += [
"/bigobj", # Some of our files are bigger than the regular limits.
"/Gy", # Enable function-level linking.
+ "/FS", # Preserve previous PDB behavior.
+ "/utf-8", # Assume UTF-8 by default to avoid code page dependencies.
]
defines += [
"_CRT_NONSTDC_NO_WARNINGS",