Support building Perfetto as part of Chrome
Change-Id: I4ea39895852e8fa02df7e0ad45f6b4b103ec3195
diff --git a/.travis.yml b/.travis.yml
index be9ec29..8a5efa7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -142,7 +142,7 @@
- build/ninja -C out/dist -j8 all
- |
TEST_TARGETS="
- base_unittests
+ perfetto_base_unittests
protozero_unittests
tracing_unittests
tracing_benchmarks
diff --git a/BUILD.gn b/BUILD.gn
index 280f760..50df164 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -12,27 +12,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import("gn/perfetto.gni")
+
group("all") {
testonly = true # allow to build also test targets
deps = [
":tests",
- "//ftrace_reader:ftrace_reader_demo",
- "//ipc/src/protoc_plugin:ipc_plugin($host_toolchain)",
- "//protozero/src/protoc_plugin($host_toolchain)",
- "//tools/ftrace_proto_gen:ftrace_proto_gen",
+ "ftrace_reader:ftrace_reader_demo",
+ "ipc/src/protoc_plugin:ipc_plugin($host_toolchain)",
+ "protozero/src/protoc_plugin($host_toolchain)",
+ "tools/ftrace_proto_gen:ftrace_proto_gen",
]
}
group("tests") {
testonly = true
deps = [
- "//base:base_unittests",
- "//ftrace_reader:ftrace_reader_integrationtests",
- "//ftrace_reader:ftrace_reader_unittests",
- "//ipc:ipc_unittests",
- "//protozero:protozero_unittests",
- "//tools/sanitizers_unittests",
- "//tracing:tracing_benchmarks",
- "//tracing:tracing_unittests",
+ "ftrace_reader:ftrace_reader_integrationtests",
+ "ftrace_reader:ftrace_reader_unittests",
+ "ipc:ipc_unittests",
+ "perfetto_base:perfetto_base_unittests",
+ "protozero:protozero_unittests",
+ "tools/sanitizers_unittests",
+ "tracing:tracing_unittests",
]
+
+ if (!build_with_chromium) {
+ deps += [ "tracing:tracing_benchmarks" ]
+ }
}
diff --git a/build/BUILDCONFIG.gn b/build/BUILDCONFIG.gn
index 0c726de..26f5fb0 100644
--- a/build/BUILDCONFIG.gn
+++ b/build/BUILDCONFIG.gn
@@ -60,12 +60,10 @@
set_defaults("source_set") {
configs = default_configs
- deps = []
}
set_defaults("static_library") {
configs = default_configs
- deps = []
}
# Realistically the only shared_library that we build right now is libc++.so
@@ -74,18 +72,11 @@
set_defaults("shared_library") {
configs = default_configs
configs += [ "//build:shared_library" ]
- deps = [
- "//build/sanitizers:deps",
- ]
}
set_defaults("executable") {
configs = default_configs
configs += [ "//build:executable" ]
- deps = [
- "//build/libc++:deps",
- "//build/sanitizers:deps",
- ]
}
set_default_toolchain("//build/toolchain:gcc_like")
diff --git a/build_overrides/build.gni b/build_overrides/build.gni
new file mode 100644
index 0000000..fb1ec3d
--- /dev/null
+++ b/build_overrides/build.gni
@@ -0,0 +1,15 @@
+# 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.
+
+build_with_chromium = false
diff --git a/buildtools/BUILD.gn b/buildtools/BUILD.gn
index b58bb77..814188d 100644
--- a/buildtools/BUILD.gn
+++ b/buildtools/BUILD.gn
@@ -166,7 +166,9 @@
}
source_set("protobuf_full") {
- deps += [ ":protobuf_lite" ]
+ deps = [
+ ":protobuf_lite",
+ ]
sources = [
"protobuf/src/google/protobuf/any.cc",
"protobuf/src/google/protobuf/any.pb.cc",
@@ -228,7 +230,9 @@
if (current_toolchain == host_toolchain) {
source_set("protoc_lib") {
- deps += [ ":protobuf_full" ]
+ deps = [
+ ":protobuf_full",
+ ]
sources = [
"protobuf/src/google/protobuf/compiler/code_generator.cc",
"protobuf/src/google/protobuf/compiler/command_line_interface.cc",
@@ -327,7 +331,10 @@
}
executable("protoc") {
- deps += [ ":protoc_lib" ]
+ deps = [
+ ":protoc_lib",
+ "../gn:default_deps",
+ ]
sources = [
"protobuf/src/google/protobuf/compiler/main.cc",
]
@@ -410,7 +417,9 @@
":libc++config",
"//build/sanitizers:sanitizer_options_link_helper",
]
- deps += [ ":libunwind" ]
+ deps = [
+ ":libunwind",
+ ]
}
if (custom_libcxx_is_static) {
@@ -461,7 +470,9 @@
"//build/sanitizers:sanitizer_options_link_helper",
]
defines = [ "_LIBCPP_BUILDING_LIBRARY" ]
- deps += [ ":libc++abi" ]
+ deps = [
+ ":libc++abi",
+ ]
}
} # if (use_custom_libcxx)
diff --git a/ftrace_reader/BUILD.gn b/ftrace_reader/BUILD.gn
index faf25cb..3ddd116 100644
--- a/ftrace_reader/BUILD.gn
+++ b/ftrace_reader/BUILD.gn
@@ -12,19 +12,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import("//build_overrides/build.gni")
+
config("ftrace_reader_config") {
- include_dirs = [ "include" ]
+ include_dirs = [
+ "include",
+ "..",
+ ]
+
+ if (build_with_chromium) {
+ include_dirs += [ "//testing/gtest/include" ]
+ }
}
executable("ftrace_reader_unittests") {
testonly = true
- deps += [
+ deps = [
":ftrace_reader",
- "//buildtools:gmock",
- "//buildtools:gtest",
- "//buildtools:gtest_main",
- "//protos/ftrace:full",
+ "../gn:default_deps",
+ "../gn:gtest_deps",
+ "../gn:protobuf_full_deps",
+ "../protos/ftrace:full",
]
+
sources = [
"src/cpu_reader_unittest.cc",
"src/format_parser_unittest.cc",
@@ -39,15 +49,14 @@
# run with sudo.
executable("ftrace_reader_integrationtests") {
testonly = true
- deps += [
+ deps = [
":ftrace_reader",
- "//base",
- "//buildtools:gmock",
- "//buildtools:gtest",
- "//buildtools:gtest_main",
- "//buildtools:protobuf_full",
- "//protos/ftrace:full",
+ "../gn:default_deps",
+ "../gn:gtest_deps",
+ "../perfetto_base",
+ "../protos/ftrace:full",
]
+
sources = [
"src/end_to_end_integrationtest.cc",
"src/ftrace_procfs_integrationtest.cc",
@@ -59,20 +68,27 @@
sources = [
"src/main.cc",
]
- deps += [
+ deps = [
":ftrace_reader",
- "//base",
+ "../gn:default_deps",
+ "../perfetto_base",
]
}
source_set("ftrace_reader") {
- all_dependent_configs = [
- ":ftrace_reader_config",
- "//buildtools:googletest_prod_config",
+ all_dependent_configs = [ ":ftrace_reader_config" ]
+
+ deps = [
+ "../perfetto_base",
+ "../protozero",
]
- deps += [ "//base" ]
+
+ if (!build_with_chromium) {
+ all_dependent_configs += [ "//buildtools:googletest_prod_config" ]
+ }
+
public_deps = [
- "//protos/ftrace:zero",
+ "../protos/ftrace:zero",
]
sources = [
"include/ftrace_reader/format_parser.h",
diff --git a/ftrace_reader/include/ftrace_reader/ftrace_controller.h b/ftrace_reader/include/ftrace_reader/ftrace_controller.h
index 4d56657..f5ace93 100644
--- a/ftrace_reader/include/ftrace_reader/ftrace_controller.h
+++ b/ftrace_reader/include/ftrace_reader/ftrace_controller.h
@@ -25,10 +25,10 @@
#include <string>
#include <vector>
-#include "base/scoped_file.h"
-#include "base/task_runner.h"
-#include "base/weak_ptr.h"
#include "gtest/gtest_prod.h"
+#include "perfetto_base/scoped_file.h"
+#include "perfetto_base/task_runner.h"
+#include "perfetto_base/weak_ptr.h"
#include "protozero/protozero_message_handle.h"
namespace perfetto {
diff --git a/ftrace_reader/src/cpu_reader.cc b/ftrace_reader/src/cpu_reader.cc
index 3282ff9..7626185 100644
--- a/ftrace_reader/src/cpu_reader.cc
+++ b/ftrace_reader/src/cpu_reader.cc
@@ -18,7 +18,7 @@
#include <utility>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
#include "proto_translation_table.h"
#include "protos/ftrace/ftrace_event.pbzero.h"
@@ -101,7 +101,7 @@
long bytes = PERFETTO_EINTR(read(fd_.get(), buffer, kPageSize));
if (bytes == -1 || bytes == 0)
return false;
- PERFETTO_CHECK(bytes <= kPageSize);
+ PERFETTO_CHECK(bytes <= (long)kPageSize);
for (size_t i = 0; i < kMaxSinks; i++) {
if (!filters[i])
diff --git a/ftrace_reader/src/cpu_reader.h b/ftrace_reader/src/cpu_reader.h
index 3b7f030..3d58a00 100644
--- a/ftrace_reader/src/cpu_reader.h
+++ b/ftrace_reader/src/cpu_reader.h
@@ -23,9 +23,9 @@
#include <array>
#include <memory>
-#include "base/scoped_file.h"
#include "ftrace_reader/ftrace_controller.h"
#include "gtest/gtest_prod.h"
+#include "perfetto_base/scoped_file.h"
#include "proto_translation_table.h"
namespace perfetto {
diff --git a/ftrace_reader/src/cpu_reader_unittest.cc b/ftrace_reader/src/cpu_reader_unittest.cc
index 5cabd1c..f517785 100644
--- a/ftrace_reader/src/cpu_reader_unittest.cc
+++ b/ftrace_reader/src/cpu_reader_unittest.cc
@@ -123,8 +123,8 @@
memcpy(&buffer, &expected, 16);
EXPECT_TRUE(CpuReader::ReadAndAdvance<PlainStruct>(&ptr, ptr + 16, &actual));
EXPECT_EQ(ptr, start + 16);
- EXPECT_EQ(actual.timestamp, 42);
- EXPECT_EQ(actual.length, 999);
+ EXPECT_EQ(actual.timestamp, 42ul);
+ EXPECT_EQ(actual.length, 999ul);
}
TEST(CpuReaderTest, ReadAndAdvanceComplexStruct) {
@@ -144,9 +144,9 @@
EXPECT_TRUE(
CpuReader::ReadAndAdvance<ComplexStruct>(&ptr, ptr + 16, &actual));
EXPECT_EQ(ptr, start + 16);
- EXPECT_EQ(actual.timestamp, 42);
+ EXPECT_EQ(actual.timestamp, 42ul);
EXPECT_EQ(actual.length, 0xabababab);
- EXPECT_EQ(actual.overwrite, 0xcd);
+ EXPECT_EQ(actual.overwrite, 0xCDu);
}
TEST(CpuReaderTest, ReadAndAdvanceOverruns) {
@@ -156,7 +156,7 @@
const uint8_t* ptr = buffer;
EXPECT_FALSE(CpuReader::ReadAndAdvance<uint64_t>(&ptr, ptr + 7, &result));
EXPECT_EQ(ptr, start);
- EXPECT_EQ(result, 42);
+ EXPECT_EQ(result, 42ul);
}
TEST(CpuReaderTest, ReadAndAdvanceAtEnd) {
@@ -234,10 +234,10 @@
protos::FtraceEventBundle proto_bundle;
proto_bundle.ParseFromArray(proto.get(), static_cast<int>(msg_size));
- EXPECT_EQ(proto_bundle.cpu(), 42);
+ EXPECT_EQ(proto_bundle.cpu(), 42u);
ASSERT_EQ(proto_bundle.event().size(), 1);
const protos::FtraceEvent& proto_event = proto_bundle.event().Get(0);
- EXPECT_EQ(proto_event.pid(), 72);
+ EXPECT_EQ(proto_event.pid(), 72u);
EXPECT_TRUE(proto_event.has_print());
// TODO(hjd): Check if this is the correct format.
EXPECT_EQ(proto_event.print().buf(), "Hello, world!\n");
diff --git a/ftrace_reader/src/end_to_end_integrationtest.cc b/ftrace_reader/src/end_to_end_integrationtest.cc
index 1b1a26d..810c27d 100644
--- a/ftrace_reader/src/end_to_end_integrationtest.cc
+++ b/ftrace_reader/src/end_to_end_integrationtest.cc
@@ -17,12 +17,12 @@
#include <fstream>
#include <sstream>
-#include "base/unix_task_runner.h"
#include "ftrace_procfs.h"
#include "ftrace_reader/ftrace_controller.h"
#include "gmock/gmock.h"
#include "google/protobuf/text_format.h"
#include "gtest/gtest.h"
+#include "perfetto_base/unix_task_runner.h"
#include "protozero/scattered_stream_writer.h"
#include "scattered_stream_delegate_for_testing.h"
diff --git a/ftrace_reader/src/format_parser.cc b/ftrace_reader/src/format_parser.cc
index d986b8e..954ddc3 100644
--- a/ftrace_reader/src/format_parser.cc
+++ b/ftrace_reader/src/format_parser.cc
@@ -23,8 +23,8 @@
#include <memory>
#include <vector>
-#include "base/utils.h"
#include "ftrace_reader/ftrace_to_proto.h"
+#include "perfetto_base/utils.h"
namespace perfetto {
namespace {
diff --git a/ftrace_reader/src/ftrace_controller.cc b/ftrace_reader/src/ftrace_controller.cc
index 1098a65..09b22ea 100644
--- a/ftrace_reader/src/ftrace_controller.cc
+++ b/ftrace_reader/src/ftrace_controller.cc
@@ -25,10 +25,10 @@
#include <array>
#include <string>
-#include "base/logging.h"
-#include "base/utils.h"
#include "cpu_reader.h"
#include "ftrace_procfs.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/utils.h"
#include "proto_translation_table.h"
#include "protos/ftrace/ftrace_event_bundle.pbzero.h"
diff --git a/ftrace_reader/src/ftrace_procfs.cc b/ftrace_reader/src/ftrace_procfs.cc
index cb7c3f6..332d993 100644
--- a/ftrace_reader/src/ftrace_procfs.cc
+++ b/ftrace_reader/src/ftrace_procfs.cc
@@ -24,8 +24,8 @@
#include <sstream>
#include <string>
-#include "base/logging.h"
-#include "base/utils.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/utils.h"
namespace perfetto {
namespace {
diff --git a/ftrace_reader/src/ftrace_procfs.h b/ftrace_reader/src/ftrace_procfs.h
index dc305d9..bf8b2be 100644
--- a/ftrace_reader/src/ftrace_procfs.h
+++ b/ftrace_reader/src/ftrace_procfs.h
@@ -19,7 +19,7 @@
#include <string>
-#include "base/scoped_file.h"
+#include "perfetto_base/scoped_file.h"
namespace perfetto {
diff --git a/ftrace_reader/src/main.cc b/ftrace_reader/src/main.cc
index 46ec56f..068c046 100644
--- a/ftrace_reader/src/main.cc
+++ b/ftrace_reader/src/main.cc
@@ -24,8 +24,8 @@
#include <utility>
#include <vector>
-#include "base/unix_task_runner.h"
#include "ftrace_reader/ftrace_controller.h"
+#include "perfetto_base/unix_task_runner.h"
#include "protozero/scattered_stream_writer.h"
#include "scattered_stream_delegate_for_testing.h"
diff --git a/ftrace_reader/src/proto_translation_table.h b/ftrace_reader/src/proto_translation_table.h
index 2854ca7..0058527 100644
--- a/ftrace_reader/src/proto_translation_table.h
+++ b/ftrace_reader/src/proto_translation_table.h
@@ -25,7 +25,7 @@
#include <string>
#include <vector>
-#include "base/scoped_file.h"
+#include "perfetto_base/scoped_file.h"
namespace perfetto {
diff --git a/ftrace_reader/src/proto_translation_table_unittest.cc b/ftrace_reader/src/proto_translation_table_unittest.cc
index 848ea3e..797e3ee 100644
--- a/ftrace_reader/src/proto_translation_table_unittest.cc
+++ b/ftrace_reader/src/proto_translation_table_unittest.cc
@@ -50,14 +50,14 @@
std::string path = "ftrace_reader/test/data/android_seed_N2F62_3.10.49/";
FtraceProcfs ftrace_procfs(path);
auto table = ProtoTranslationTable::Create(&ftrace_procfs);
- EXPECT_EQ(table->largest_id(), 744);
+ EXPECT_EQ(table->largest_id(), 744ul);
EXPECT_EQ(table->common_fields().at(0).ftrace_offset, 0u);
EXPECT_EQ(table->common_fields().at(0).ftrace_size, 2u);
auto sched_switch_event = table->GetEventByName("sched_switch");
EXPECT_EQ(sched_switch_event->name, "sched_switch");
EXPECT_EQ(sched_switch_event->group, "sched");
- EXPECT_EQ(sched_switch_event->ftrace_event_id, 68);
+ EXPECT_EQ(sched_switch_event->ftrace_event_id, 68ul);
EXPECT_EQ(sched_switch_event->fields.at(0).ftrace_offset, 8u);
EXPECT_EQ(sched_switch_event->fields.at(0).ftrace_size, 16u);
}
@@ -91,10 +91,10 @@
}
ProtoTranslationTable table(events, std::move(common_fields));
- EXPECT_EQ(table.largest_id(), 100);
- EXPECT_EQ(table.EventNameToFtraceId("foo"), 1);
- EXPECT_EQ(table.EventNameToFtraceId("baz"), 100);
- EXPECT_EQ(table.EventNameToFtraceId("no_such_event"), 0);
+ EXPECT_EQ(table.largest_id(), 100ul);
+ EXPECT_EQ(table.EventNameToFtraceId("foo"), 1ul);
+ EXPECT_EQ(table.EventNameToFtraceId("baz"), 100ul);
+ EXPECT_EQ(table.EventNameToFtraceId("no_such_event"), 0ul);
EXPECT_EQ(table.GetEventById(1)->name, "foo");
EXPECT_EQ(table.GetEventById(3), nullptr);
EXPECT_EQ(table.GetEventById(200), nullptr);
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
new file mode 100644
index 0000000..d6b4315
--- /dev/null
+++ b/gn/BUILD.gn
@@ -0,0 +1,68 @@
+# 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("perfetto.gni")
+
+group("gtest_deps") {
+ testonly = true
+
+ if (!build_with_chromium) {
+ public_deps = [
+ "//buildtools:gmock",
+ "//buildtools:gtest",
+ "//buildtools:gtest_main",
+ ]
+ } else {
+ public_deps = [
+ "//testing/gmock",
+ "//testing/gtest",
+ "//testing/gtest:gtest_main",
+ ]
+ }
+}
+
+group("protoc_lib_deps") {
+ if (!build_with_chromium) {
+ if (current_toolchain == host_toolchain) {
+ public_deps = [
+ "//buildtools:protoc_lib",
+ ]
+ }
+ } else {
+ public_deps = [
+ "//third_party/protobuf:protoc_lib",
+ ]
+ }
+}
+
+group("protobuf_full_deps") {
+ if (!build_with_chromium) {
+ public_deps = [
+ "//buildtools:protobuf_full",
+ ]
+ } else {
+ public_deps = [
+ "//third_party/protobuf:protobuf_full",
+ ]
+ }
+}
+
+group("default_deps") {
+ if (!build_with_chromium) {
+ public_deps = [
+ "//build/libc++:deps",
+ "//build/sanitizers:deps",
+ ]
+ }
+}
diff --git a/gn/perfetto.gni b/gn/perfetto.gni
new file mode 100644
index 0000000..213534a
--- /dev/null
+++ b/gn/perfetto.gni
@@ -0,0 +1,21 @@
+# 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) {
+ perfetto_root_path = "//"
+} else {
+ perfetto_root_path = "//third_party/perfetto/"
+}
diff --git a/ipc/BUILD.gn b/ipc/BUILD.gn
index 3bfe9e8..854f318 100644
--- a/ipc/BUILD.gn
+++ b/ipc/BUILD.gn
@@ -12,18 +12,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("//build/proto_library.gni")
+import("../gn/perfetto.gni")
+import("//build_overrides/build.gni")
import("ipc_library.gni")
+if (!build_with_chromium) {
+ import("//build/proto_library.gni")
+} else {
+ import("//third_party/protobuf/proto_library.gni")
+}
+
config("config") {
- include_dirs = [ "include" ]
+ include_dirs = [
+ perfetto_root_path + "ipc/include",
+ perfetto_root_path,
+ ]
}
source_set("ipc") {
public_configs = [ ":config" ]
- deps += [
+ deps = [
":wire_protocol",
- "//base",
+ "../perfetto_base",
]
sources = [
"include/ipc/async_result.h",
@@ -49,16 +59,16 @@
executable("ipc_unittests") {
testonly = true
- deps += [
+ deps = [
":ipc",
":test_messages",
":wire_protocol",
- "//base",
- "//base:test_support",
- "//buildtools:gmock",
- "//buildtools:gtest",
- "//buildtools:gtest_main",
+ "../gn:default_deps",
+ "../gn:gtest_deps",
+ "../perfetto_base",
+ "../perfetto_base:test_support",
]
+
sources = [
"src/buffered_frame_deserializer_unittest.cc",
"src/client_impl_unittest.cc",
@@ -73,7 +83,9 @@
sources = [
"src/wire_protocol.proto",
]
- include_dirs = [ "include" ]
+
+ extra_configs = [ ":config" ]
+ proto_in_dir = perfetto_root_path
proto_out_dir = "protos_lite"
}
@@ -83,5 +95,6 @@
"src/test/deferred_unittest_messages.proto",
"src/test/greeter_service.proto",
]
- include_dirs = [ "include" ]
+ proto_in_dir = perfetto_root_path
+ extra_configs = [ ":config" ]
}
diff --git a/ipc/include/ipc/client.h b/ipc/include/ipc/client.h
index 752976f..b703bae 100644
--- a/ipc/include/ipc/client.h
+++ b/ipc/include/ipc/client.h
@@ -20,9 +20,9 @@
#include <functional>
#include <memory>
-#include "base/scoped_file.h"
-#include "base/weak_ptr.h"
#include "ipc/basic_types.h"
+#include "perfetto_base/scoped_file.h"
+#include "perfetto_base/weak_ptr.h"
namespace perfetto {
diff --git a/ipc/include/ipc/client_info.h b/ipc/include/ipc/client_info.h
index 09c4945..2af429b 100644
--- a/ipc/include/ipc/client_info.h
+++ b/ipc/include/ipc/client_info.h
@@ -17,8 +17,8 @@
#ifndef IPC_INCLUDE_IPC_CLIENT_INFO_H_
#define IPC_INCLUDE_IPC_CLIENT_INFO_H_
-#include "base/logging.h"
#include "ipc/basic_types.h"
+#include "perfetto_base/logging.h"
namespace perfetto {
namespace ipc {
diff --git a/ipc/include/ipc/service.h b/ipc/include/ipc/service.h
index 55e4c19..aebb430 100644
--- a/ipc/include/ipc/service.h
+++ b/ipc/include/ipc/service.h
@@ -17,8 +17,8 @@
#ifndef IPC_INCLUDE_IPC_SERVICE_H_
#define IPC_INCLUDE_IPC_SERVICE_H_
-#include "base/logging.h"
#include "ipc/client_info.h"
+#include "perfetto_base/logging.h"
namespace perfetto {
namespace ipc {
diff --git a/ipc/include/ipc/service_proxy.h b/ipc/include/ipc/service_proxy.h
index 9e6ba39..b38cc47 100644
--- a/ipc/include/ipc/service_proxy.h
+++ b/ipc/include/ipc/service_proxy.h
@@ -26,8 +26,8 @@
#include <memory>
#include <string>
-#include "base/weak_ptr.h"
#include "ipc/deferred.h"
+#include "perfetto_base/weak_ptr.h"
namespace perfetto {
namespace ipc {
diff --git a/ipc/ipc_library.gni b/ipc/ipc_library.gni
index f43f461..7f61f23 100644
--- a/ipc/ipc_library.gni
+++ b/ipc/ipc_library.gni
@@ -12,14 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("//build/proto_library.gni")
+import("../gn/perfetto.gni")
+import("//build_overrides/build.gni")
+
+if (!build_with_chromium) {
+ import("//build/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) {
- generator_plugin_label = "//ipc/src/protoc_plugin:ipc_plugin"
+ perfetto_root_path = invoker.perfetto_root_path
+
+ generator_plugin_label =
+ perfetto_root_path + "ipc/src/protoc_plugin:ipc_plugin"
generator_plugin_suffix = ".ipc"
- public_configs = [ "//ipc:config" ]
+
+ #public_configs = [ rebase_path("ipc:config", perfetto_root_path) ]
deps = [
"//ipc",
]
@@ -27,6 +38,7 @@
forward_variables_from(invoker,
[
"defines",
+ "extra_configs",
"include_dirs",
"proto_in_dir",
"proto_out_dir",
diff --git a/ipc/src/buffered_frame_deserializer.cc b/ipc/src/buffered_frame_deserializer.cc
index 9d7b34f..ab8dca5 100644
--- a/ipc/src/buffered_frame_deserializer.cc
+++ b/ipc/src/buffered_frame_deserializer.cc
@@ -23,9 +23,9 @@
#include <type_traits>
#include <utility>
-#include "base/logging.h"
-#include "base/utils.h"
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/utils.h"
#include "ipc/src/wire_protocol.pb.h"
@@ -200,7 +200,7 @@
buf.insert(0, kHeaderSize, 0); // Reserve the space for the header.
frame.AppendToString(&buf);
const uint32_t payload_size = static_cast<uint32_t>(buf.size() - kHeaderSize);
- PERFETTO_DCHECK(payload_size == frame.GetCachedSize());
+ PERFETTO_DCHECK(payload_size == static_cast<uint32_t>(frame.GetCachedSize()));
char header[kHeaderSize];
memcpy(header, base::AssumeLittleEndian(&payload_size), kHeaderSize);
buf.replace(0, kHeaderSize, header, kHeaderSize);
diff --git a/ipc/src/buffered_frame_deserializer.h b/ipc/src/buffered_frame_deserializer.h
index 0aca5e7..17a43dc 100644
--- a/ipc/src/buffered_frame_deserializer.h
+++ b/ipc/src/buffered_frame_deserializer.h
@@ -22,7 +22,7 @@
#include <list>
#include <memory>
-#include "base/utils.h"
+#include "perfetto_base/utils.h"
namespace perfetto {
namespace ipc {
diff --git a/ipc/src/buffered_frame_deserializer_unittest.cc b/ipc/src/buffered_frame_deserializer_unittest.cc
index a796b69..f459b61 100644
--- a/ipc/src/buffered_frame_deserializer_unittest.cc
+++ b/ipc/src/buffered_frame_deserializer_unittest.cc
@@ -19,9 +19,9 @@
#include <algorithm>
#include <string>
-#include "base/logging.h"
-#include "base/utils.h"
#include "gtest/gtest.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/utils.h"
#include "ipc/src/wire_protocol.pb.h"
@@ -62,7 +62,7 @@
}
frame.add_data_for_testing(padding.data(), padding_size);
}
- PERFETTO_CHECK(frame.ByteSize() == payload_size);
+ PERFETTO_CHECK(frame.ByteSize() == static_cast<int>(payload_size));
std::vector<char> encoded_frame;
encoded_frame.resize(size);
char* enc_buf = encoded_frame.data();
@@ -107,7 +107,8 @@
// Excactly one frame should be decoded, with no leftover buffer.
auto decoded_frame = bfd.PopNextFrame();
ASSERT_TRUE(decoded_frame);
- ASSERT_EQ(size - kHeaderSize, decoded_frame->ByteSize());
+ ASSERT_EQ(static_cast<int32_t>(size - kHeaderSize),
+ decoded_frame->ByteSize());
ASSERT_FALSE(bfd.PopNextFrame());
ASSERT_EQ(0u, bfd.size());
}
@@ -161,7 +162,7 @@
// Validate the received frame2.
std::unique_ptr<Frame> decoded_simple_frame = bfd.PopNextFrame();
ASSERT_TRUE(decoded_simple_frame);
- ASSERT_EQ(simple_frame.size() - kHeaderSize,
+ ASSERT_EQ(static_cast<int32_t>(simple_frame.size() - kHeaderSize),
decoded_simple_frame->ByteSize());
std::unique_ptr<Frame> decoded_frame = bfd.PopNextFrame();
@@ -236,7 +237,8 @@
for (size_t expected_size : batch) {
auto frame = bfd.PopNextFrame();
ASSERT_TRUE(frame);
- ASSERT_EQ(expected_size - kHeaderSize, frame->ByteSize());
+ ASSERT_EQ(static_cast<int32_t>(expected_size - kHeaderSize),
+ frame->ByteSize());
}
ASSERT_FALSE(bfd.PopNextFrame());
ASSERT_EQ(0u, bfd.size());
@@ -298,7 +300,8 @@
ASSERT_FALSE(decoded_frame);
} else {
ASSERT_TRUE(decoded_frame);
- ASSERT_EQ(size - kHeaderSize, decoded_frame->ByteSize());
+ ASSERT_EQ(static_cast<int32_t>(size - kHeaderSize),
+ decoded_frame->ByteSize());
}
ASSERT_EQ(0u, bfd.size());
}
diff --git a/ipc/src/client_impl.cc b/ipc/src/client_impl.cc
index b70fe2b..229056b 100644
--- a/ipc/src/client_impl.cc
+++ b/ipc/src/client_impl.cc
@@ -18,10 +18,10 @@
#include <inttypes.h>
-#include "base/task_runner.h"
-#include "base/utils.h"
#include "ipc/service_descriptor.h"
#include "ipc/service_proxy.h"
+#include "perfetto_base/task_runner.h"
+#include "perfetto_base/utils.h"
// TODO(primiano): Add ThreadChecker everywhere.
diff --git a/ipc/src/client_impl.h b/ipc/src/client_impl.h
index 30c8e34..f2762ca 100644
--- a/ipc/src/client_impl.h
+++ b/ipc/src/client_impl.h
@@ -17,11 +17,11 @@
#ifndef IPC_SRC_CLIENT_IMPL_H_
#define IPC_SRC_CLIENT_IMPL_H_
-#include "base/scoped_file.h"
-#include "base/task_runner.h"
#include "ipc/client.h"
#include "ipc/src/buffered_frame_deserializer.h"
#include "ipc/src/unix_socket.h"
+#include "perfetto_base/scoped_file.h"
+#include "perfetto_base/task_runner.h"
#include "ipc/src/wire_protocol.pb.h"
diff --git a/ipc/src/client_impl_unittest.cc b/ipc/src/client_impl_unittest.cc
index 01ebe8c..4645443 100644
--- a/ipc/src/client_impl_unittest.cc
+++ b/ipc/src/client_impl_unittest.cc
@@ -21,14 +21,14 @@
#include <string>
-#include "base/test/test_task_runner.h"
-#include "base/utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "ipc/service_descriptor.h"
#include "ipc/service_proxy.h"
#include "ipc/src/buffered_frame_deserializer.h"
#include "ipc/src/unix_socket.h"
+#include "perfetto_base/test/test_task_runner.h"
+#include "perfetto_base/utils.h"
#include "ipc/src/test/client_unittest_messages.pb.h"
@@ -154,10 +154,12 @@
Frame reply;
reply.set_request_id(req.request_id());
for (const auto& svc : services) {
- if (svc.second->id != req.msg_invoke_method().service_id())
+ if (static_cast<int32_t>(svc.second->id) !=
+ req.msg_invoke_method().service_id())
continue;
for (const auto& method : svc.second->methods) {
- if (method.second->id != req.msg_invoke_method().method_id())
+ if (static_cast<int32_t>(method.second->id) !=
+ req.msg_invoke_method().method_id())
continue;
method.second->OnInvoke(req.msg_invoke_method(),
reply.mutable_msg_invoke_method_reply());
@@ -341,7 +343,8 @@
ASSERT_TRUE(rx_fd);
char buf[sizeof(kFileContent)] = {};
ASSERT_EQ(0, lseek(*rx_fd, 0, SEEK_SET));
- ASSERT_EQ(sizeof(buf), PERFETTO_EINTR(read(*rx_fd, buf, sizeof(buf))));
+ ASSERT_EQ(static_cast<long>(sizeof(buf)),
+ PERFETTO_EINTR(read(*rx_fd, buf, sizeof(buf))));
ASSERT_STREQ(kFileContent, buf);
}
diff --git a/ipc/src/deferred.cc b/ipc/src/deferred.cc
index 2cd01ed..3862115 100644
--- a/ipc/src/deferred.cc
+++ b/ipc/src/deferred.cc
@@ -16,8 +16,8 @@
#include "ipc/deferred.h"
-#include "base/logging.h"
#include "google/protobuf/message_lite.h"
+#include "perfetto_base/logging.h"
namespace perfetto {
namespace ipc {
diff --git a/ipc/src/deferred_unittest.cc b/ipc/src/deferred_unittest.cc
index b52bf20..51472ed 100644
--- a/ipc/src/deferred_unittest.cc
+++ b/ipc/src/deferred_unittest.cc
@@ -16,8 +16,8 @@
#include "ipc/deferred.h"
-#include "base/logging.h"
#include "gtest/gtest.h"
+#include "perfetto_base/logging.h"
#include "ipc/src/test/deferred_unittest_messages.pb.h"
diff --git a/ipc/src/host_impl.cc b/ipc/src/host_impl.cc
index 6c4a32a..2c15519 100644
--- a/ipc/src/host_impl.cc
+++ b/ipc/src/host_impl.cc
@@ -21,10 +21,10 @@
#include <algorithm>
#include <utility>
-#include "base/task_runner.h"
-#include "base/utils.h"
#include "ipc/service.h"
#include "ipc/service_descriptor.h"
+#include "perfetto_base/task_runner.h"
+#include "perfetto_base/utils.h"
#include "ipc/src/wire_protocol.pb.h"
@@ -149,7 +149,8 @@
Service* service = svc_it->second.instance.get();
const ServiceDescriptor& svc = service->GetDescriptor();
const auto& methods = svc.methods;
- if (req.method_id() <= 0 || req.method_id() > methods.size())
+ if (req.method_id() <= 0 ||
+ static_cast<uint32_t>(req.method_id()) > methods.size())
return SendFrame(client, reply_frame);
const ServiceDescriptor::Method& method = methods[req.method_id() - 1];
diff --git a/ipc/src/host_impl.h b/ipc/src/host_impl.h
index 61d88a3..bbb6a33 100644
--- a/ipc/src/host_impl.h
+++ b/ipc/src/host_impl.h
@@ -22,12 +22,12 @@
#include <string>
#include <vector>
-#include "base/task_runner.h"
-#include "base/thread_checker.h"
#include "ipc/deferred.h"
#include "ipc/host.h"
#include "ipc/src/buffered_frame_deserializer.h"
#include "ipc/src/unix_socket.h"
+#include "perfetto_base/task_runner.h"
+#include "perfetto_base/thread_checker.h"
namespace perfetto {
namespace ipc {
diff --git a/ipc/src/host_impl_unittest.cc b/ipc/src/host_impl_unittest.cc
index c3b8b6f..a98efb7 100644
--- a/ipc/src/host_impl_unittest.cc
+++ b/ipc/src/host_impl_unittest.cc
@@ -18,14 +18,14 @@
#include <memory>
-#include "base/scoped_file.h"
-#include "base/test/test_task_runner.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "ipc/service.h"
#include "ipc/service_descriptor.h"
#include "ipc/src/buffered_frame_deserializer.h"
#include "ipc/src/unix_socket.h"
+#include "perfetto_base/scoped_file.h"
+#include "perfetto_base/test/test_task_runner.h"
#include "ipc/src/test/client_unittest_messages.pb.h"
#include "ipc/src/wire_protocol.pb.h"
@@ -297,7 +297,8 @@
.WillOnce(Invoke([on_fd_received](int fd) {
char buf[sizeof(kFileContent)] = {};
ASSERT_EQ(0, lseek(fd, 0, SEEK_SET));
- ASSERT_EQ(sizeof(buf), PERFETTO_EINTR(read(fd, buf, sizeof(buf))));
+ ASSERT_EQ(static_cast<int32_t>(sizeof(buf)),
+ PERFETTO_EINTR(read(fd, buf, sizeof(buf))));
ASSERT_STREQ(kFileContent, buf);
on_fd_received();
}));
diff --git a/ipc/src/protoc_plugin/BUILD.gn b/ipc/src/protoc_plugin/BUILD.gn
index 4a72ace..6350637 100644
--- a/ipc/src/protoc_plugin/BUILD.gn
+++ b/ipc/src/protoc_plugin/BUILD.gn
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import("//build_overrides/build.gni")
+
if (current_toolchain == host_toolchain) {
executable("ipc_plugin") {
sources = [
@@ -19,7 +21,13 @@
"ipc_generator.h",
"ipc_plugin.cc",
]
- deps += [ "//buildtools:protoc_lib" ]
+
+ deps = [
+ "../../../gn:default_deps",
+ "../../../gn:protoc_lib_deps",
+ ]
+ public_configs = [ "../../../perfetto_base:base_config" ]
+
if (is_clang) {
# Internal protobuf headers hit this.
cflags = [ "-Wno-unreachable-code" ]
diff --git a/ipc/src/service_proxy.cc b/ipc/src/service_proxy.cc
index 39be416..bce6bfc 100644
--- a/ipc/src/service_proxy.cc
+++ b/ipc/src/service_proxy.cc
@@ -18,11 +18,11 @@
#include <utility>
-#include "base/logging.h"
-#include "base/weak_ptr.h"
#include "google/protobuf/message_lite.h"
#include "ipc/service_descriptor.h"
#include "ipc/src/client_impl.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/weak_ptr.h"
namespace perfetto {
namespace ipc {
diff --git a/ipc/src/test/ipc_integrationtest.cc b/ipc/src/test/ipc_integrationtest.cc
index 66053e9..815bf35 100644
--- a/ipc/src/test/ipc_integrationtest.cc
+++ b/ipc/src/test/ipc_integrationtest.cc
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-#include "base/test/test_task_runner.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "ipc/client.h"
#include "ipc/host.h"
+#include "perfetto_base/test/test_task_runner.h"
#include "ipc/src/test/greeter_service.ipc.h"
#include "ipc/src/test/greeter_service.pb.h"
diff --git a/ipc/src/unix_socket.cc b/ipc/src/unix_socket.cc
index 60986bd..54e3a40 100644
--- a/ipc/src/unix_socket.cc
+++ b/ipc/src/unix_socket.cc
@@ -29,10 +29,10 @@
#include <algorithm>
#include <memory>
-#include "base/build_config.h"
-#include "base/logging.h"
-#include "base/task_runner.h"
-#include "base/utils.h"
+#include "perfetto_base/build_config.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/task_runner.h"
+#include "perfetto_base/utils.h"
#if BUILDFLAG(OS_MACOSX)
#include <sys/ucred.h>
diff --git a/ipc/src/unix_socket.h b/ipc/src/unix_socket.h
index 9f9deeb..b192381 100644
--- a/ipc/src/unix_socket.h
+++ b/ipc/src/unix_socket.h
@@ -23,9 +23,9 @@
#include <memory>
#include <string>
-#include "base/logging.h"
-#include "base/scoped_file.h"
-#include "base/weak_ptr.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/scoped_file.h"
+#include "perfetto_base/weak_ptr.h"
namespace perfetto {
diff --git a/ipc/src/unix_socket_unittest.cc b/ipc/src/unix_socket_unittest.cc
index eea9e12..ec18ea9 100644
--- a/ipc/src/unix_socket_unittest.cc
+++ b/ipc/src/unix_socket_unittest.cc
@@ -20,12 +20,12 @@
#include <list>
-#include "base/build_config.h"
-#include "base/logging.h"
-#include "base/test/test_task_runner.h"
-#include "base/utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include "perfetto_base/build_config.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/test/test_task_runner.h"
+#include "perfetto_base/utils.h"
namespace perfetto {
namespace ipc {
@@ -252,7 +252,7 @@
EXPECT_CALL(event_listener_, OnNewIncomingConnection(srv.get(), _))
.WillOnce(Invoke(
[this, tmp_fd, checkpoint, mem](UnixSocket*, UnixSocket* new_conn) {
- ASSERT_EQ(geteuid(), new_conn->peer_uid());
+ ASSERT_EQ(geteuid(), static_cast<uint32_t>(new_conn->peer_uid()));
ASSERT_TRUE(new_conn->Send("txfd", 5, tmp_fd));
// Wait for the client to change this again.
EXPECT_CALL(event_listener_, OnDataAvailable(new_conn))
@@ -357,7 +357,7 @@
Invoke([cli_connected](UnixSocket*, bool) { cli_connected(); }));
task_runner_.RunUntilCheckpoint("cli_connected");
ASSERT_TRUE(cli->is_connected());
- ASSERT_EQ(geteuid(), cli->peer_uid());
+ ASSERT_EQ(geteuid(), static_cast<uint32_t>(cli->peer_uid()));
bool did_requeue = false;
for (int i = 0; i < kNumFrames; i++)
@@ -382,7 +382,7 @@
.WillOnce(Invoke(
[&srv_client_conn, srv_connected](UnixSocket*, UnixSocket* srv_conn) {
srv_client_conn = srv_conn;
- EXPECT_EQ(geteuid(), srv_conn->peer_uid());
+ EXPECT_EQ(geteuid(), static_cast<uint32_t>(srv_conn->peer_uid()));
srv_connected();
}));
auto cli_connected = task_runner_.CreateCheckpoint("cli_connected");
@@ -410,7 +410,7 @@
cli.reset();
task_runner_.RunUntilCheckpoint("cli_disconnected");
ASSERT_FALSE(srv_client_conn->is_connected());
- EXPECT_EQ(geteuid(), srv_client_conn->peer_uid());
+ EXPECT_EQ(geteuid(), static_cast<uint32_t>(srv_client_conn->peer_uid()));
}
// TODO(primiano): add a test to check that in the case of a peer sending a fd
diff --git a/base/BUILD.gn b/perfetto_base/BUILD.gn
similarity index 83%
rename from base/BUILD.gn
rename to perfetto_base/BUILD.gn
index c58a552..acc70d1 100644
--- a/base/BUILD.gn
+++ b/perfetto_base/BUILD.gn
@@ -12,7 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-source_set("base") {
+import("//build_overrides/build.gni")
+
+config("base_config") {
+ include_dirs = [ ".." ]
+}
+
+source_set("perfetto_base") {
+ public_configs = [ ":base_config" ]
+
sources = [
"build_config.h",
"logging.h",
@@ -55,22 +63,24 @@
source_set("test_support") {
testonly = true
- deps += [ ":base" ]
+ deps = [
+ ":perfetto_base",
+ ]
sources = [
"test/test_task_runner.cc",
"test/test_task_runner.h",
]
}
-executable("base_unittests") {
+executable("perfetto_base_unittests") {
testonly = true
- deps += [
- ":base",
+ deps = [
+ ":perfetto_base",
":test_support",
- "//buildtools:gmock",
- "//buildtools:gtest",
- "//buildtools:gtest_main",
+ "../gn:default_deps",
+ "../gn:gtest_deps",
]
+
sources = [
"scoped_file_unittest.cc",
"task_runner_unittest.cc",
diff --git a/base/android_task_runner.cc b/perfetto_base/android_task_runner.cc
similarity index 98%
rename from base/android_task_runner.cc
rename to perfetto_base/android_task_runner.cc
index 4b2c3f9..c16f80f 100644
--- a/base/android_task_runner.cc
+++ b/perfetto_base/android_task_runner.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "base/android_task_runner.h"
+#include "perfetto_base/android_task_runner.h"
#include <sys/eventfd.h>
#include <sys/timerfd.h>
diff --git a/base/android_task_runner.h b/perfetto_base/android_task_runner.h
similarity index 92%
rename from base/android_task_runner.h
rename to perfetto_base/android_task_runner.h
index 0c00aa1..f5f8199 100644
--- a/base/android_task_runner.h
+++ b/perfetto_base/android_task_runner.h
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#ifndef PERFETTO_BASE_ANDROID_TASK_RUNNER_H_
-#define PERFETTO_BASE_ANDROID_TASK_RUNNER_H_
+#ifndef PERFETTO_PERFETTO_BASE_ANDROID_TASK_RUNNER_H_
+#define PERFETTO_PERFETTO_BASE_ANDROID_TASK_RUNNER_H_
-#include "base/scoped_file.h"
-#include "base/task_runner.h"
-#include "base/thread_checker.h"
+#include "perfetto_base/scoped_file.h"
+#include "perfetto_base/task_runner.h"
+#include "perfetto_base/thread_checker.h"
#include <poll.h>
#include <chrono>
@@ -116,4 +116,4 @@
} // namespace base
} // namespace perfetto
-#endif // PERFETTO_BASE_ANDROID_TASK_RUNNER_H_
+#endif // PERFETTO_PERFETTO_BASE_ANDROID_TASK_RUNNER_H_
diff --git a/base/build_config.h b/perfetto_base/build_config.h
similarity index 90%
rename from base/build_config.h
rename to perfetto_base/build_config.h
index 797d68a..213f2f5 100644
--- a/base/build_config.h
+++ b/perfetto_base/build_config.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef PERFETTO_BASE_BUILD_CONFIG_H_
-#define PERFETTO_BASE_BUILD_CONFIG_H_
+#ifndef PERFETTO_PERFETTO_BASE_BUILD_CONFIG_H_
+#define PERFETTO_PERFETTO_BASE_BUILD_CONFIG_H_
// DO NOT include this file in public headers (include/) to avoid collisions.
@@ -41,4 +41,4 @@
#error OS not supported (see build_config.h)
#endif
-#endif // PERFETTO_BASE_BUILD_CONFIG_H_
+#endif // PERFETTO_PERFETTO_BASE_BUILD_CONFIG_H_
diff --git a/base/debug_crash_stack_trace.cc b/perfetto_base/debug_crash_stack_trace.cc
similarity index 100%
rename from base/debug_crash_stack_trace.cc
rename to perfetto_base/debug_crash_stack_trace.cc
diff --git a/base/logging.h b/perfetto_base/logging.h
similarity index 92%
rename from base/logging.h
rename to perfetto_base/logging.h
index bcb7e4d..ad50ce5 100644
--- a/base/logging.h
+++ b/perfetto_base/logging.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef PERFETTO_BASE_LOGGING_H_
-#define PERFETTO_BASE_LOGGING_H_
+#ifndef PERFETTO_PERFETTO_BASE_LOGGING_H_
+#define PERFETTO_PERFETTO_BASE_LOGGING_H_
#include <errno.h>
#include <stdlib.h>
@@ -29,7 +29,7 @@
#include <string.h> // For strerror.
#endif
-#include "base/utils.h"
+#include "perfetto_base/utils.h"
#if PERFETTO_DCHECK_IS_ON()
#define PERFETTO_DLOG(fmt, ...) \
@@ -60,4 +60,4 @@
} while (0)
#endif // PERFETTO_DCHECK_IS_ON()
-#endif // PERFETTO_BASE_LOGGING_H_
+#endif // PERFETTO_PERFETTO_BASE_LOGGING_H_
diff --git a/base/scoped_file.h b/perfetto_base/scoped_file.h
similarity index 90%
rename from base/scoped_file.h
rename to perfetto_base/scoped_file.h
index 83507b4..d9ba25b 100644
--- a/base/scoped_file.h
+++ b/perfetto_base/scoped_file.h
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-#ifndef PERFETTO_BASE_SCOPED_FILE_H_
-#define PERFETTO_BASE_SCOPED_FILE_H_
+#ifndef PERFETTO_PERFETTO_BASE_SCOPED_FILE_H_
+#define PERFETTO_PERFETTO_BASE_SCOPED_FILE_H_
#include <dirent.h>
#include <unistd.h>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
namespace perfetto {
namespace base {
@@ -64,4 +64,4 @@
} // namespace base
} // namespace perfetto
-#endif // PERFETTO_BASE_SCOPED_FILE_H_
+#endif // PERFETTO_PERFETTO_BASE_SCOPED_FILE_H_
diff --git a/base/scoped_file_unittest.cc b/perfetto_base/scoped_file_unittest.cc
similarity index 98%
rename from base/scoped_file_unittest.cc
rename to perfetto_base/scoped_file_unittest.cc
index 174f220..10aa72c 100644
--- a/base/scoped_file_unittest.cc
+++ b/perfetto_base/scoped_file_unittest.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "base/scoped_file.h"
+#include "perfetto_base/scoped_file.h"
#include <fcntl.h>
#include <unistd.h>
diff --git a/base/task_runner.h b/perfetto_base/task_runner.h
similarity index 94%
rename from base/task_runner.h
rename to perfetto_base/task_runner.h
index 1575a8c..1ae69bb 100644
--- a/base/task_runner.h
+++ b/perfetto_base/task_runner.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef PERFETTO_BASE_TASK_RUNNER_H_
-#define PERFETTO_BASE_TASK_RUNNER_H_
+#ifndef PERFETTO_PERFETTO_BASE_TASK_RUNNER_H_
+#define PERFETTO_PERFETTO_BASE_TASK_RUNNER_H_
#include <functional>
@@ -62,4 +62,4 @@
} // namespace base
} // namespace perfetto
-#endif // PERFETTO_BASE_TASK_RUNNER_H_
+#endif // PERFETTO_PERFETTO_BASE_TASK_RUNNER_H_
diff --git a/base/task_runner_unittest.cc b/perfetto_base/task_runner_unittest.cc
similarity index 98%
rename from base/task_runner_unittest.cc
rename to perfetto_base/task_runner_unittest.cc
index 5d60816..5a6e230 100644
--- a/base/task_runner_unittest.cc
+++ b/perfetto_base/task_runner_unittest.cc
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-#include "base/unix_task_runner.h"
+#include "perfetto_base/unix_task_runner.h"
-#include "base/build_config.h"
-#include "base/scoped_file.h"
#include "gtest/gtest.h"
+#include "perfetto_base/build_config.h"
+#include "perfetto_base/scoped_file.h"
#if BUILDFLAG(OS_ANDROID)
-#include "base/android_task_runner.h"
+#include "perfetto_base/android_task_runner.h"
#endif
#include <thread>
diff --git a/base/test/test_task_runner.cc b/perfetto_base/test/test_task_runner.cc
similarity index 97%
rename from base/test/test_task_runner.cc
rename to perfetto_base/test/test_task_runner.cc
index ef7aa09..fdc3859 100644
--- a/base/test/test_task_runner.cc
+++ b/perfetto_base/test/test_task_runner.cc
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-#include "base/test/test_task_runner.h"
+#include "perfetto_base/test/test_task_runner.h"
#include <stdio.h>
#include <unistd.h>
#include <chrono>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
namespace perfetto {
namespace base {
diff --git a/base/test/test_task_runner.h b/perfetto_base/test/test_task_runner.h
similarity index 91%
rename from base/test/test_task_runner.h
rename to perfetto_base/test/test_task_runner.h
index 45609ee..6c56594 100644
--- a/base/test/test_task_runner.h
+++ b/perfetto_base/test/test_task_runner.h
@@ -24,12 +24,12 @@
#include <map>
#include <string>
-#include "base/build_config.h"
-#include "base/thread_checker.h"
-#include "base/unix_task_runner.h"
+#include "perfetto_base/build_config.h"
+#include "perfetto_base/thread_checker.h"
+#include "perfetto_base/unix_task_runner.h"
#if BUILDFLAG(OS_ANDROID)
-#include "base/android_task_runner.h"
+#include "perfetto_base/android_task_runner.h"
#endif
namespace perfetto {
diff --git a/base/thread_checker.cc b/perfetto_base/thread_checker.cc
similarity index 96%
rename from base/thread_checker.cc
rename to perfetto_base/thread_checker.cc
index 9d37640..ab15ee8 100644
--- a/base/thread_checker.cc
+++ b/perfetto_base/thread_checker.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "base/thread_checker.h"
+#include "perfetto_base/thread_checker.h"
namespace perfetto {
namespace base {
diff --git a/base/thread_checker.h b/perfetto_base/thread_checker.h
similarity index 88%
rename from base/thread_checker.h
rename to perfetto_base/thread_checker.h
index bc323a6..988d3d8 100644
--- a/base/thread_checker.h
+++ b/perfetto_base/thread_checker.h
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-#ifndef PERFETTO_BASE_THREAD_CHECKER_H_
-#define PERFETTO_BASE_THREAD_CHECKER_H_
+#ifndef PERFETTO_PERFETTO_BASE_THREAD_CHECKER_H_
+#define PERFETTO_PERFETTO_BASE_THREAD_CHECKER_H_
#include <pthread.h>
#include <atomic>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
namespace perfetto {
namespace base {
@@ -52,4 +52,4 @@
} // namespace base
} // namespace perfetto
-#endif // PERFETTO_BASE_THREAD_CHECKER_H_
+#endif // PERFETTO_PERFETTO_BASE_THREAD_CHECKER_H_
diff --git a/base/thread_checker_unittest.cc b/perfetto_base/thread_checker_unittest.cc
similarity index 98%
rename from base/thread_checker_unittest.cc
rename to perfetto_base/thread_checker_unittest.cc
index 8cc6433..69b65aa 100644
--- a/base/thread_checker_unittest.cc
+++ b/perfetto_base/thread_checker_unittest.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "base/thread_checker.h"
+#include "perfetto_base/thread_checker.h"
#include <pthread.h>
diff --git a/base/unix_task_runner.cc b/perfetto_base/unix_task_runner.cc
similarity index 98%
rename from base/unix_task_runner.cc
rename to perfetto_base/unix_task_runner.cc
index a7cb307..ba162ab 100644
--- a/base/unix_task_runner.cc
+++ b/perfetto_base/unix_task_runner.cc
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#include "base/unix_task_runner.h"
+#include "perfetto_base/unix_task_runner.h"
-#include "base/build_config.h"
+#include "perfetto_base/build_config.h"
#include <fcntl.h>
#include <stdlib.h>
diff --git a/base/unix_task_runner.h b/perfetto_base/unix_task_runner.h
similarity index 89%
rename from base/unix_task_runner.h
rename to perfetto_base/unix_task_runner.h
index 554de63..e804308 100644
--- a/base/unix_task_runner.h
+++ b/perfetto_base/unix_task_runner.h
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#ifndef PERFETTO_BASE_UNIX_TASK_RUNNER_H_
-#define PERFETTO_BASE_UNIX_TASK_RUNNER_H_
+#ifndef PERFETTO_PERFETTO_BASE_UNIX_TASK_RUNNER_H_
+#define PERFETTO_PERFETTO_BASE_UNIX_TASK_RUNNER_H_
-#include "base/scoped_file.h"
-#include "base/task_runner.h"
-#include "base/thread_checker.h"
+#include "perfetto_base/scoped_file.h"
+#include "perfetto_base/task_runner.h"
+#include "perfetto_base/thread_checker.h"
#include <poll.h>
#include <chrono>
@@ -95,4 +95,4 @@
} // namespace base
} // namespace perfetto
-#endif // PERFETTO_BASE_UNIX_TASK_RUNNER_H_
+#endif // PERFETTO_PERFETTO_BASE_UNIX_TASK_RUNNER_H_
diff --git a/base/utils.h b/perfetto_base/utils.h
similarity index 90%
rename from base/utils.h
rename to perfetto_base/utils.h
index 5c1c6f1..368c253 100644
--- a/base/utils.h
+++ b/perfetto_base/utils.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef PERFETTO_BASE_UTILS_H_
-#define PERFETTO_BASE_UTILS_H_
+#ifndef PERFETTO_PERFETTO_BASE_UTILS_H_
+#define PERFETTO_PERFETTO_BASE_UTILS_H_
#include <errno.h>
#include <stddef.h>
@@ -47,9 +47,7 @@
// std::unique_ptr<int, base::FreeDeleter> foo_ptr(
// static_cast<int*>(malloc(sizeof(int))));
struct FreeDeleter {
- inline void operator()(void* ptr) const {
- free(ptr);
- }
+ inline void operator()(void* ptr) const { free(ptr); }
};
template <typename T>
@@ -62,4 +60,4 @@
} // namespace base
} // namespace perfetto
-#endif // PERFETTO_BASE_UTILS_H_
+#endif // PERFETTO_PERFETTO_BASE_UTILS_H_
diff --git a/base/utils_unittest.cc b/perfetto_base/utils_unittest.cc
similarity index 98%
rename from base/utils_unittest.cc
rename to perfetto_base/utils_unittest.cc
index 5495fd7..0848701 100644
--- a/base/utils_unittest.cc
+++ b/perfetto_base/utils_unittest.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "base/utils.h"
+#include "perfetto_base/utils.h"
#include <fcntl.h>
#include <signal.h>
diff --git a/base/weak_ptr.h b/perfetto_base/weak_ptr.h
similarity index 93%
rename from base/weak_ptr.h
rename to perfetto_base/weak_ptr.h
index 1a22a5a..e18212d 100644
--- a/base/weak_ptr.h
+++ b/perfetto_base/weak_ptr.h
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#ifndef PERFETTO_BASE_WEAK_PTR_H_
-#define PERFETTO_BASE_WEAK_PTR_H_
+#ifndef PERFETTO_PERFETTO_BASE_WEAK_PTR_H_
+#define PERFETTO_PERFETTO_BASE_WEAK_PTR_H_
-#include "base/thread_checker.h"
+#include "perfetto_base/thread_checker.h"
#include <memory>
@@ -100,4 +100,4 @@
} // namespace base
} // namespace perfetto
-#endif // PERFETTO_BASE_WEAK_PTR_H_
+#endif // PERFETTO_PERFETTO_BASE_WEAK_PTR_H_
diff --git a/base/weak_ptr_unittest.cc b/perfetto_base/weak_ptr_unittest.cc
similarity index 97%
rename from base/weak_ptr_unittest.cc
rename to perfetto_base/weak_ptr_unittest.cc
index 16b32a9..009df4a 100644
--- a/base/weak_ptr_unittest.cc
+++ b/perfetto_base/weak_ptr_unittest.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "base/weak_ptr.h"
+#include "perfetto_base/weak_ptr.h"
#include "gtest/gtest.h"
diff --git a/protos/ftrace/BUILD.gn b/protos/ftrace/BUILD.gn
index 76e011a..d7e81a1 100644
--- a/protos/ftrace/BUILD.gn
+++ b/protos/ftrace/BUILD.gn
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("//protozero/protozero_library.gni")
+import("../../gn/perfetto.gni")
+import("../../protozero/protozero_library.gni")
import("all_protos.gni")
# Create a copy of all the protos listed in all_protos.gni with the
@@ -24,7 +25,7 @@
action_foreach("generate_full_protos") {
visibility = [ ":*" ]
- script = "//build/generate_full_protos.py"
+ script = "../../build/generate_full_protos.py"
sources = ftrace_proto_names
# TODO(hjd): Add support for subdirectories.
@@ -47,8 +48,8 @@
]
sources = []
use_protobuf_full = true
+ proto_in_dir = "$full_protos_base_dir/" + perfetto_root_path
proto_out_dir = "protos_full"
- proto_in_dir = full_protos_base_dir
foreach(proto, ftrace_proto_names) {
sources += [ "$full_protos_target_dir/$proto" ]
}
@@ -56,11 +57,13 @@
proto_library("lite") {
sources = ftrace_proto_names
+ proto_in_dir = perfetto_root_path
proto_out_dir = "protos_lite"
}
protozero_library("zero") {
sources = ftrace_proto_names
+ proto_in_dir = perfetto_root_path
proto_out_dir = "protos_zero"
generator_plugin_options = "wrapper_namespace=pbzero"
}
diff --git a/protozero/BUILD.gn b/protozero/BUILD.gn
index 0f01f26..1ebfaca 100644
--- a/protozero/BUILD.gn
+++ b/protozero/BUILD.gn
@@ -12,7 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("//build/proto_library.gni")
+import("../gn/perfetto.gni")
+import("//build_overrides/build.gni")
+
+if (!build_with_chromium) {
+ import("//build/proto_library.gni")
+} else {
+ import("//third_party/protobuf/proto_library.gni")
+}
+
+import("../gn/perfetto.gni")
import("protozero_library.gni")
config("protozero_config") {
@@ -21,8 +30,15 @@
source_set("protozero") {
all_dependent_configs = [ ":protozero_config" ]
- configs += [ "//buildtools:googletest_prod_config" ]
- deps += [ "//base" ]
+
+ deps = [
+ "../perfetto_base",
+ ]
+
+ if (!build_with_chromium) {
+ configs += [ "//buildtools:googletest_prod_config" ]
+ }
+
sources = [
"include/protozero/contiguous_memory_range.h",
"include/protozero/proto_field_descriptor.h",
@@ -38,15 +54,15 @@
executable("protozero_unittests") {
testonly = true
- deps += [
+ deps = [
":protozero",
":testing_messages_lite",
":testing_messages_zero",
- "//base",
- "//buildtools:gmock",
- "//buildtools:gtest",
- "//buildtools:gtest_main",
+ "../gn:default_deps",
+ "../gn:gtest_deps",
+ "../perfetto_base",
]
+
sources = [
"src/proto_utils_unittest.cc",
"src/protozero_message_unittest.cc",
@@ -67,14 +83,16 @@
]
protozero_library("testing_messages_zero") {
- include_dirs = [ "include" ]
+ #include_dirs = [ "include" ]
sources = testing_proto_sources
+ proto_in_dir = perfetto_root_path
proto_out_dir = "protos_zero"
generator_plugin_options = "wrapper_namespace=pbzero"
}
proto_library("testing_messages_lite") {
- include_dirs = [ "include" ]
+ #include_dirs = [ "include" ]
sources = testing_proto_sources
+ proto_in_dir = perfetto_root_path
proto_out_dir = "protos_lite"
}
diff --git a/protozero/protozero_library.gni b/protozero/protozero_library.gni
index 9192fb9..8698052 100644
--- a/protozero/protozero_library.gni
+++ b/protozero/protozero_library.gni
@@ -12,23 +12,40 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("//build/proto_library.gni")
+import("//build_overrides/build.gni")
-# Equivalent to proto_library (generation of .h/.cc form .proto files) but
+if (!build_with_chromium) {
+ import("//build/proto_library.gni")
+} else {
+ import("//third_party/protobuf/proto_library.gni")
+}
+
+# Equivalent to proto_library (generation of .h/.cc from .proto files) but
# enables also generation using the protozero plugin.
-# The generated files will have the .pbzero.{cc,h} suffix, as opposite to the
+# The generated files will have the .pbzero.{cc,h} suffix, as opposed to the
# .pb.{cc,h} of the official proto library.
template("protozero_library") {
proto_library(target_name) {
+ perfetto_root_path = invoker.perfetto_root_path
+
generate_cc = false
- generator_plugin_label = "//protozero/src/protoc_plugin"
+ generator_plugin_label = perfetto_root_path + "protozero/src/protoc_plugin"
generator_plugin_suffix = ".pbzero"
- public_configs = [ "//protozero:protozero_config" ]
- deps = []
+
+ if (!defined(invoker.public_configs)) {
+ public_configs = []
+ }
+
if (defined(invoker.deps)) {
deps = invoker.deps
+ } else {
+ deps = []
}
- deps += [ "//protozero" ]
+
+ deps += [ perfetto_root_path + "protozero" ]
+
+ public_configs += [ "//protozero:protozero_config" ]
+
forward_variables_from(invoker,
[
"defines",
diff --git a/protozero/src/proto_utils.cc b/protozero/src/proto_utils.cc
index 4e2ead8..833dfdd 100644
--- a/protozero/src/proto_utils.cc
+++ b/protozero/src/proto_utils.cc
@@ -20,7 +20,7 @@
#include <limits>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
#define PERFETTO_CHECK_PTR_LE(a, b) \
PERFETTO_CHECK(reinterpret_cast<uintptr_t>(a) <= \
diff --git a/protozero/src/proto_utils_unittest.cc b/protozero/src/proto_utils_unittest.cc
index e1b3f2b..2d8f3fc 100644
--- a/protozero/src/proto_utils_unittest.cc
+++ b/protozero/src/proto_utils_unittest.cc
@@ -18,9 +18,9 @@
#include <limits>
-#include "base/logging.h"
-#include "base/utils.h"
#include "gtest/gtest.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/utils.h"
namespace protozero {
namespace proto_utils {
diff --git a/protozero/src/protoc_plugin/BUILD.gn b/protozero/src/protoc_plugin/BUILD.gn
index 7ab92fb..0f8cc4d 100644
--- a/protozero/src/protoc_plugin/BUILD.gn
+++ b/protozero/src/protoc_plugin/BUILD.gn
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import("//build_overrides/build.gni")
+
if (current_toolchain == host_toolchain) {
executable("protoc_plugin") {
sources = [
@@ -19,7 +21,18 @@
"protozero_generator.h",
"protozero_plugin.cc",
]
- deps += [ "//buildtools:protoc_lib" ]
+
+ if (!build_with_chromium) {
+ deps = [
+ "../../../gn:default_deps",
+ "//buildtools:protoc_lib",
+ ]
+ } else {
+ deps = [
+ "//third_party/protobuf:protoc_lib",
+ ]
+ }
+
if (is_clang) {
# Internal protobuf headers hit this.
cflags = [ "-Wno-unreachable-code" ]
diff --git a/protozero/src/protozero_message.cc b/protozero/src/protozero_message.cc
index 3e053f4..c88cb8c 100644
--- a/protozero/src/protozero_message.cc
+++ b/protozero/src/protozero_message.cc
@@ -18,7 +18,7 @@
#include <type_traits>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
// The memcpy() for float and double below needs to be adjusted if we want to
diff --git a/protozero/src/protozero_message_handle.cc b/protozero/src/protozero_message_handle.cc
index e44a1fc..5c4b838 100644
--- a/protozero/src/protozero_message_handle.cc
+++ b/protozero/src/protozero_message_handle.cc
@@ -18,7 +18,7 @@
#include <utility>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
#include "protozero/protozero_message.h"
namespace protozero {
diff --git a/protozero/src/protozero_message_unittest.cc b/protozero/src/protozero_message_unittest.cc
index dd8ae76..ffad3c7 100644
--- a/protozero/src/protozero_message_unittest.cc
+++ b/protozero/src/protozero_message_unittest.cc
@@ -21,8 +21,8 @@
#include <utility>
#include <vector>
-#include "base/logging.h"
#include "gtest/gtest.h"
+#include "perfetto_base/logging.h"
#include "protozero/src/test/fake_scattered_buffer.h"
namespace protozero {
diff --git a/protozero/src/scattered_stream_writer.cc b/protozero/src/scattered_stream_writer.cc
index 3dc738d..292c461 100644
--- a/protozero/src/scattered_stream_writer.cc
+++ b/protozero/src/scattered_stream_writer.cc
@@ -18,7 +18,7 @@
#include <algorithm>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
namespace protozero {
diff --git a/protozero/src/scattered_stream_writer_unittest.cc b/protozero/src/scattered_stream_writer_unittest.cc
index d1d37e1..65951b5 100644
--- a/protozero/src/scattered_stream_writer_unittest.cc
+++ b/protozero/src/scattered_stream_writer_unittest.cc
@@ -20,8 +20,8 @@
#include <memory>
-#include "base/logging.h"
#include "gtest/gtest.h"
+#include "perfetto_base/logging.h"
#include "protozero/src/test/fake_scattered_buffer.h"
namespace protozero {
diff --git a/tools/ftrace_proto_gen/BUILD.gn b/tools/ftrace_proto_gen/BUILD.gn
index 003c6e9..87b89ec 100644
--- a/tools/ftrace_proto_gen/BUILD.gn
+++ b/tools/ftrace_proto_gen/BUILD.gn
@@ -16,8 +16,9 @@
sources = [
"main.cc",
]
- deps += [
- "//base",
- "//ftrace_reader",
+ deps = [
+ "../../ftrace_reader",
+ "../../gn:default_deps",
+ "../../perfetto_base",
]
}
diff --git a/tools/sanitizers_unittests/BUILD.gn b/tools/sanitizers_unittests/BUILD.gn
index 62925b1..9053395 100644
--- a/tools/sanitizers_unittests/BUILD.gn
+++ b/tools/sanitizers_unittests/BUILD.gn
@@ -14,10 +14,12 @@
executable("sanitizers_unittests") {
testonly = true
- deps += [
- "//buildtools:gtest",
- "//buildtools:gtest_main",
+
+ deps = [
+ "../../gn:default_deps",
+ "../../gn:gtest_deps",
]
+
sources = [
"sanitizers_unittest.cc",
]
diff --git a/tracing/BUILD.gn b/tracing/BUILD.gn
index 698721b..f25c654 100644
--- a/tracing/BUILD.gn
+++ b/tracing/BUILD.gn
@@ -12,16 +12,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("//ipc//ipc_library.gni")
+import("../gn/perfetto.gni")
+import("//build_overrides/build.gni")
+import("../ipc//ipc_library.gni")
config("tracing_config") {
- include_dirs = [ "include" ]
+ include_dirs = [
+ "include",
+ perfetto_root_path,
+ ]
}
# Core tracing library, platform independent, no transport layer.
source_set("tracing") {
all_dependent_configs = [ ":tracing_config" ]
- deps += [ "//base" ]
+ deps = [
+ "../perfetto_base",
+ ]
sources = [
"include/tracing/core/basic_types.h",
"include/tracing/core/data_source_config.h",
@@ -36,6 +43,8 @@
# IPC service definitions.
ipc_library("ipc_protos") {
+ proto_in_dir = perfetto_root_path
+ extra_configs = [ "../ipc:config" ]
sources = [
"src/ipc/data_source_config.proto",
"src/ipc/data_source_descriptor.proto",
@@ -61,21 +70,22 @@
deps = [
":ipc_protos",
":tracing",
- "//base",
+ "../ipc",
+ "../perfetto_base",
]
}
executable("tracing_unittests") {
testonly = true
- deps += [
+ deps = [
":ipc",
":tracing",
- "//base",
- "//base:test_support",
- "//buildtools:gmock",
- "//buildtools:gtest",
- "//buildtools:gtest_main",
+ "../gn:default_deps",
+ "../gn:gtest_deps",
+ "../perfetto_base",
+ "../perfetto_base:test_support",
]
+
sources = [
"src/core/service_impl_unittest.cc",
"src/ipc/posix_shared_memory_unittest.cc",
@@ -86,23 +96,31 @@
executable("tracing_test") {
testonly = true
- deps += [
+ deps = [
":ipc",
":ipc_protos",
":tracing",
- "//base",
- "//base:test_support",
- "//ipc",
+ "../gn:default_deps",
+ "../ipc",
+ "../perfetto_base",
+ "../perfetto_base:test_support",
]
sources = [
"src/test/ipc_test.cc",
]
}
-executable("tracing_benchmarks") {
- testonly = true
- deps += [ "//buildtools:benchmark" ]
- sources = [
- "src/test/hello_world_benchmark.cc",
- ]
+if (!build_with_chromium) {
+ executable("tracing_benchmarks") {
+ testonly = true
+
+ deps = [
+ "../gn:default_deps",
+ "//buildtools:benchmark",
+ ]
+
+ sources = [
+ "src/test/hello_world_benchmark.cc",
+ ]
+ }
}
diff --git a/tracing/src/core/service_impl.cc b/tracing/src/core/service_impl.cc
index 23bb873..9a56e62 100644
--- a/tracing/src/core/service_impl.cc
+++ b/tracing/src/core/service_impl.cc
@@ -20,8 +20,8 @@
#include <algorithm>
-#include "base/logging.h"
-#include "base/task_runner.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/task_runner.h"
#include "tracing/core/data_source_config.h"
#include "tracing/core/producer.h"
#include "tracing/core/shared_memory.h"
diff --git a/tracing/src/core/service_impl_unittest.cc b/tracing/src/core/service_impl_unittest.cc
index e2914a8..804bbf6 100644
--- a/tracing/src/core/service_impl_unittest.cc
+++ b/tracing/src/core/service_impl_unittest.cc
@@ -18,9 +18,9 @@
#include <string.h>
-#include "base/test/test_task_runner.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include "perfetto_base/test/test_task_runner.h"
#include "tracing/core/data_source_config.h"
#include "tracing/core/data_source_descriptor.h"
#include "tracing/core/producer.h"
diff --git a/tracing/src/ipc/posix_shared_memory.cc b/tracing/src/ipc/posix_shared_memory.cc
index 77bcaf0..6d22600 100644
--- a/tracing/src/ipc/posix_shared_memory.cc
+++ b/tracing/src/ipc/posix_shared_memory.cc
@@ -27,7 +27,7 @@
#include <memory>
#include <utility>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
namespace perfetto {
diff --git a/tracing/src/ipc/posix_shared_memory.h b/tracing/src/ipc/posix_shared_memory.h
index 2f783cf..89c5eb8 100644
--- a/tracing/src/ipc/posix_shared_memory.h
+++ b/tracing/src/ipc/posix_shared_memory.h
@@ -21,7 +21,7 @@
#include <memory>
-#include "base/scoped_file.h"
+#include "perfetto_base/scoped_file.h"
#include "tracing/core/shared_memory.h"
namespace perfetto {
diff --git a/tracing/src/ipc/posix_shared_memory_unittest.cc b/tracing/src/ipc/posix_shared_memory_unittest.cc
index e66ded1..016014a 100644
--- a/tracing/src/ipc/posix_shared_memory_unittest.cc
+++ b/tracing/src/ipc/posix_shared_memory_unittest.cc
@@ -24,11 +24,11 @@
#include <sys/stat.h>
#include <unistd.h>
-#include "base/build_config.h"
-#include "base/scoped_file.h"
-#include "base/test/test_task_runner.h"
-#include "base/utils.h"
#include "gtest/gtest.h"
+#include "perfetto_base/build_config.h"
+#include "perfetto_base/scoped_file.h"
+#include "perfetto_base/test/test_task_runner.h"
+#include "perfetto_base/utils.h"
namespace perfetto {
namespace {
diff --git a/tracing/src/ipc/producer/producer_ipc_client_impl.cc b/tracing/src/ipc/producer/producer_ipc_client_impl.cc
index ff3094e..fd5814f 100644
--- a/tracing/src/ipc/producer/producer_ipc_client_impl.cc
+++ b/tracing/src/ipc/producer/producer_ipc_client_impl.cc
@@ -19,8 +19,8 @@
#include <inttypes.h>
#include <string.h>
-#include "base/task_runner.h"
#include "ipc/client.h"
+#include "perfetto_base/task_runner.h"
#include "tracing/core/data_source_config.h"
#include "tracing/core/data_source_descriptor.h"
#include "tracing/core/producer.h"
diff --git a/tracing/src/ipc/service/producer_ipc_service.cc b/tracing/src/ipc/service/producer_ipc_service.cc
index bd8e2ed..f4e8d4e 100644
--- a/tracing/src/ipc/service/producer_ipc_service.cc
+++ b/tracing/src/ipc/service/producer_ipc_service.cc
@@ -18,9 +18,9 @@
#include <inttypes.h>
-#include "base/logging.h"
-#include "base/task_runner.h"
#include "ipc/host.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/task_runner.h"
#include "tracing/core/data_source_config.h"
#include "tracing/core/data_source_descriptor.h"
#include "tracing/core/service.h"
diff --git a/tracing/src/ipc/service/producer_ipc_service.h b/tracing/src/ipc/service/producer_ipc_service.h
index 70b92f9..4bd4c0f 100644
--- a/tracing/src/ipc/service/producer_ipc_service.h
+++ b/tracing/src/ipc/service/producer_ipc_service.h
@@ -21,8 +21,8 @@
#include <memory>
#include <string>
-#include "base/weak_ptr.h"
#include "ipc/basic_types.h"
+#include "perfetto_base/weak_ptr.h"
#include "tracing/core/producer.h"
#include "tracing/core/service.h"
diff --git a/tracing/src/ipc/service/service_ipc_host_impl.cc b/tracing/src/ipc/service/service_ipc_host_impl.cc
index d11f5d5..3f19347 100644
--- a/tracing/src/ipc/service/service_ipc_host_impl.cc
+++ b/tracing/src/ipc/service/service_ipc_host_impl.cc
@@ -16,9 +16,9 @@
#include "tracing/src/ipc/service/service_ipc_host_impl.h"
-#include "base/logging.h"
-#include "base/task_runner.h"
#include "ipc/host.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/task_runner.h"
#include "tracing/core/service.h"
#include "tracing/src/ipc/posix_shared_memory.h"
#include "tracing/src/ipc/service/producer_ipc_service.h"
diff --git a/tracing/src/test/ipc_test.cc b/tracing/src/test/ipc_test.cc
index 3a2d1cf..8bda6b2 100644
--- a/tracing/src/test/ipc_test.cc
+++ b/tracing/src/test/ipc_test.cc
@@ -19,8 +19,8 @@
#include <string.h>
#include <unistd.h>
-#include "base/logging.h"
-#include "base/test/test_task_runner.h"
+#include "perfetto_base/logging.h"
+#include "perfetto_base/test/test_task_runner.h"
#include "tracing/core/data_source_config.h"
#include "tracing/core/data_source_descriptor.h"
#include "tracing/core/producer.h"
diff --git a/tracing/src/test/test_shared_memory.cc b/tracing/src/test/test_shared_memory.cc
index 6bda050..d71de52 100644
--- a/tracing/src/test/test_shared_memory.cc
+++ b/tracing/src/test/test_shared_memory.cc
@@ -18,7 +18,7 @@
#include <string.h>
-#include "base/logging.h"
+#include "perfetto_base/logging.h"
namespace perfetto {