summaryrefslogtreecommitdiff
path: root/chromium/services/tracing/perfetto
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/services/tracing/perfetto')
-rw-r--r--chromium/services/tracing/perfetto/consumer_host.cc10
-rw-r--r--chromium/services/tracing/perfetto/perfetto_service.h1
-rw-r--r--chromium/services/tracing/perfetto/privacy_filtered_fields-inl.h25
-rw-r--r--chromium/services/tracing/perfetto/system_perfetto_unittest.cc79
4 files changed, 101 insertions, 14 deletions
diff --git a/chromium/services/tracing/perfetto/consumer_host.cc b/chromium/services/tracing/perfetto/consumer_host.cc
index f6cb275cf51..67a3d1b0e0f 100644
--- a/chromium/services/tracing/perfetto/consumer_host.cc
+++ b/chromium/services/tracing/perfetto/consumer_host.cc
@@ -26,7 +26,7 @@
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/system/wait.h"
#include "services/tracing/perfetto/perfetto_service.h"
-#include "services/tracing/public/cpp/trace_event_args_whitelist.h"
+#include "services/tracing/public/cpp/trace_event_args_allowlist.h"
#include "third_party/perfetto/include/perfetto/ext/trace_processor/export_json.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/observable_events.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/slice.h"
@@ -382,9 +382,9 @@ void ConsumerHost::TracingSession::DisableTracingAndEmitJson(
base::SequencedTaskRunnerHandle::Get());
if (privacy_filtering_enabled) {
- // For filtering/whitelisting to be possible at JSON export time,
+ // For filtering/allowlisting to be possible at JSON export time,
// filtering must not have been enabled during proto emission time
- // (or there's nothing to pass through the whitelist).
+ // (or there's nothing to pass through the allowlist).
DCHECK(!privacy_filtering_enabled_);
privacy_filtering_enabled_ = true;
}
@@ -408,9 +408,9 @@ void ConsumerHost::TracingSession::ExportJson() {
->GetArgumentFilterPredicate()
.is_null()) {
base::trace_event::TraceLog::GetInstance()->SetArgumentFilterPredicate(
- base::BindRepeating(&IsTraceEventArgsWhitelisted));
+ base::BindRepeating(&IsTraceEventArgsAllowlisted));
base::trace_event::TraceLog::GetInstance()->SetMetadataFilterPredicate(
- base::BindRepeating(&IsMetadataWhitelisted));
+ base::BindRepeating(&IsMetadataAllowlisted));
}
perfetto::trace_processor::json::ArgumentFilterPredicate argument_filter;
diff --git a/chromium/services/tracing/perfetto/perfetto_service.h b/chromium/services/tracing/perfetto/perfetto_service.h
index a54618ff0e8..edba7d6ab58 100644
--- a/chromium/services/tracing/perfetto/perfetto_service.h
+++ b/chromium/services/tracing/perfetto/perfetto_service.h
@@ -11,7 +11,6 @@
#include "base/macros.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
-#include "mojo/public/cpp/bindings/strong_binding_set.h"
#include "mojo/public/cpp/bindings/unique_receiver_set.h"
#include "services/tracing/perfetto/consumer_host.h"
#include "services/tracing/public/cpp/perfetto/task_runner.h"
diff --git a/chromium/services/tracing/perfetto/privacy_filtered_fields-inl.h b/chromium/services/tracing/perfetto/privacy_filtered_fields-inl.h
index d7433465e08..3982a6823fb 100644
--- a/chromium/services/tracing/perfetto/privacy_filtered_fields-inl.h
+++ b/chromium/services/tracing/perfetto/privacy_filtered_fields-inl.h
@@ -30,8 +30,10 @@ constexpr int kClockIndices[] = {1, 2, 3, 4, -1};
constexpr MessageInfo kClock = {kClockIndices, nullptr};
// Proto Message: ClockSnapshot
-constexpr int kClockSnapshotIndices[] = {1, -1};
-constexpr MessageInfo const* kClockSnapshotComplexMessages[] = {&kClock};
+// Manually allowlisted: 2 (primary_trace_clock).
+constexpr int kClockSnapshotIndices[] = {1, 2, -1};
+constexpr MessageInfo const* kClockSnapshotComplexMessages[] = {&kClock,
+ nullptr};
constexpr MessageInfo kClockSnapshot = {kClockSnapshotIndices,
kClockSnapshotComplexMessages};
@@ -154,15 +156,21 @@ constexpr int kComponentInfoIndices[] = {1, 2, -1};
constexpr MessageInfo kComponentInfo = {kComponentInfoIndices, nullptr};
// Proto Message: ChromeLatencyInfo
-constexpr int kChromeLatencyInfoIndices[] = {1, 2, 3, 4, 5, -1};
+constexpr int kChromeLatencyInfoIndices[] = {1, 2, 3, 4, 5, 6, -1};
constexpr MessageInfo const* kChromeLatencyInfoComplexMessages[] = {
- nullptr, nullptr, nullptr, &kComponentInfo, nullptr};
+ nullptr, nullptr, nullptr, &kComponentInfo, nullptr, nullptr};
constexpr MessageInfo kChromeLatencyInfo = {kChromeLatencyInfoIndices,
kChromeLatencyInfoComplexMessages};
+// Proto Message: ChromeFrameReporter
+constexpr int kChromeFrameReporterIndices[] = {1, 2, 3, 4, -1};
+constexpr MessageInfo kChromeFrameReporter = {kChromeFrameReporterIndices,
+ nullptr};
+
// Proto Message: TrackEvent
-constexpr int kTrackEventIndices[] = {1, 2, 3, 5, 6, 9, 10, 11, 12, 16,
- 17, 24, 25, 26, 27, 28, 29, 30, 31, -1};
+constexpr int kTrackEventIndices[] = {1, 2, 3, 5, 6, 9, 10,
+ 11, 12, 16, 17, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, -1};
constexpr MessageInfo const* kTrackEventComplexMessages[] = {
nullptr,
nullptr,
@@ -182,7 +190,8 @@ constexpr MessageInfo const* kTrackEventComplexMessages[] = {
&kChromeHistogramSample,
&kChromeLatencyInfo,
nullptr,
- nullptr};
+ nullptr,
+ &kChromeFrameReporter};
constexpr MessageInfo kTrackEvent = {kTrackEventIndices,
kTrackEventComplexMessages};
@@ -344,7 +353,7 @@ constexpr MessageInfo kTrackDescriptor = {kTrackDescriptorIndices,
kTrackDescriptorComplexMessages};
// Proto Message: TracePacket
-// EDIT: Manually whitelisted: 3 (trusted_uid).
+// EDIT: Manually allowlisted: 3 (trusted_uid).
constexpr int kTracePacketIndices[] = {3, 6, 8, 10, 11, 12, 13, 35, 36, 41,
42, 43, 44, 51, 54, 56, 58, 59, 60, -1};
constexpr MessageInfo const* kTracePacketComplexMessages[] = {
diff --git a/chromium/services/tracing/perfetto/system_perfetto_unittest.cc b/chromium/services/tracing/perfetto/system_perfetto_unittest.cc
index 1e660c1a21f..f217e6d0103 100644
--- a/chromium/services/tracing/perfetto/system_perfetto_unittest.cc
+++ b/chromium/services/tracing/perfetto/system_perfetto_unittest.cc
@@ -933,5 +933,84 @@ TEST_F(SystemPerfettoTest, RespectsFeatureList) {
->IsDummySystemProducerForTesting());
}
}
+
+#if defined(OS_ANDROID)
+TEST_F(SystemPerfettoTest, RespectsFeaturePreAndroidPie) {
+ if (base::android::BuildInfo::GetInstance()->sdk_int() >=
+ base::android::SDK_VERSION_P) {
+ return;
+ }
+
+ auto run_test = [this](bool enable_feature) {
+ PerfettoTracedProcess::Get()->ClearDataSourcesForTesting();
+
+ base::test::ScopedFeatureList feature_list;
+ if (enable_feature) {
+ feature_list.InitAndEnableFeature(features::kEnablePerfettoSystemTracing);
+ } else {
+ feature_list.InitAndDisableFeature(
+ features::kEnablePerfettoSystemTracing);
+ }
+ PerfettoTracedProcess::ReconstructForTesting(producer_socket_.c_str());
+
+ std::string data_source_name = "temp_name";
+
+ base::RunLoop data_source_started_runloop;
+ std::unique_ptr<TestDataSource> data_source =
+ TestDataSource::CreateAndRegisterDataSource(data_source_name, 1);
+ data_source->set_start_tracing_callback(
+ data_source_started_runloop.QuitClosure());
+
+ auto system_service = CreateMockSystemService();
+
+ base::RunLoop system_no_more_packets_runloop;
+ MockConsumer system_consumer(
+ {data_source_name}, system_service->GetService(),
+ [&system_no_more_packets_runloop](bool has_more) {
+ if (!has_more) {
+ system_no_more_packets_runloop.Quit();
+ }
+ });
+
+ base::RunLoop system_data_source_enabled_runloop;
+ base::RunLoop system_data_source_disabled_runloop;
+ auto system_producer = CreateMockPosixSystemProducer(
+ system_service.get(),
+ /* num_data_sources = */ 1, &system_data_source_enabled_runloop,
+ &system_data_source_disabled_runloop, /* check_sdk_level = */ true);
+ PerfettoTracedProcess::GetTaskRunner()->PostTask(
+ [&system_producer]() { system_producer->ConnectToSystemService(); });
+
+ if (enable_feature) {
+ system_data_source_enabled_runloop.Run();
+ data_source_started_runloop.Run();
+ system_consumer.WaitForAllDataSourcesStarted();
+ }
+
+ // Post the task to ensure that the data will have been written and
+ // committed if any tracing is being done.
+ base::RunLoop stop_tracing;
+ PerfettoTracedProcess::GetTaskRunner()->PostTask(
+ [&system_consumer, &stop_tracing]() {
+ system_consumer.StopTracing();
+ stop_tracing.Quit();
+ });
+ stop_tracing.Run();
+
+ if (enable_feature) {
+ system_data_source_disabled_runloop.Run();
+ system_consumer.WaitForAllDataSourcesStopped();
+ }
+ system_no_more_packets_runloop.Run();
+
+ PerfettoProducer::DeleteSoonForTesting(std::move(system_producer));
+ return system_consumer.received_test_packets();
+ };
+
+ EXPECT_EQ(1u, run_test(/* enable_feature = */ true));
+ EXPECT_EQ(0u, run_test(/* enable_feature = */ false));
+}
+#endif // defined(OS_ANDROID)
+
} // namespace
} // namespace tracing