privacy_filtering_check.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2019 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. #ifndef SERVICES_TRACING_PERFETTO_PRIVACY_FILTERING_CHECK_H_
  5. #define SERVICES_TRACING_PERFETTO_PRIVACY_FILTERING_CHECK_H_
  6. #include <string>
  7. namespace tracing {
  8. class PrivacyFilteringCheck {
  9. public:
  10. struct TraceStats {
  11. size_t track_event = 0;
  12. size_t process_desc = 0;
  13. size_t thread_desc = 0;
  14. bool has_interned_names = false;
  15. bool has_interned_categories = false;
  16. bool has_interned_source_locations = false;
  17. bool has_interned_log_messages = false;
  18. };
  19. PrivacyFilteringCheck();
  20. PrivacyFilteringCheck(const PrivacyFilteringCheck&) = delete;
  21. PrivacyFilteringCheck& operator=(const PrivacyFilteringCheck&) = delete;
  22. ~PrivacyFilteringCheck();
  23. // Removes disallowed fields from the trace.
  24. static void RemoveBlockedFields(std::string& serialized_trace_proto);
  25. void CheckProtoForUnexpectedFields(const std::string& serialized_trace_proto);
  26. const TraceStats& stats() const { return stats_; }
  27. private:
  28. TraceStats stats_;
  29. };
  30. } // namespace tracing
  31. #endif // SERVICES_TRACING_PERFETTO_PRIVACY_FILTERING_CHECK_H_