Introduce Consumer API
This introduces the most relevant classes for the Consumer
API surface.
The IPC plumbing and the implementation inside the service
will come in upcoming CLs.
The static_cast in the generated .cc files are needed to
suppress warning/errors in the following cases:
- When assigning a protobuf enum to a generated enum.
Even if the underlying type is the same (int), they are
different types for the compiler.
- Protobuf generated classes do NOT use stdint.h and use
uint64 instead of uint64_t. Interestingly, on some 64-bit
architectures they typedef to slightly different types
(long long vs long). And even if ultimately they map to
the same bitness, the compiler sees them as different
types.
Bug: 70284518
Change-Id: If65c345028a9f5f78cd39c4b92ab1b50b966044b
diff --git a/gn/ipc_library.gni b/gn/ipc_library.gni
new file mode 100644
index 0000000..db4d72c
--- /dev/null
+++ b/gn/ipc_library.gni
@@ -0,0 +1,51 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/build.gni")
+
+if (!build_with_chromium) {
+ import("//gn/standalone/proto_library.gni")
+} else {
+ import("//third_party/protobuf/proto_library.gni")
+}
+
+# Generates .ipc.{h,cc} stubs for IPC services defined in .proto files.
+template("ipc_library") {
+ proto_library(target_name) {
+ perfetto_root_path = invoker.perfetto_root_path
+
+ generator_plugin_label =
+ perfetto_root_path + "src/ipc/protoc_plugin:ipc_plugin"
+ generator_plugin_suffix = ".ipc"
+ deps = [
+ "${perfetto_root_path}src/ipc",
+ ]
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+
+ proto_out_dir = "protos_lite"
+ forward_variables_from(invoker,
+ [
+ "defines",
+ "extra_configs",
+ "include_dirs",
+ "proto_in_dir",
+ "proto_out_dir",
+ "sources",
+ "testonly",
+ "visibility",
+ ])
+ }
+}