tracing_service.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2018 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_TRACING_SERVICE_H_
  5. #define SERVICES_TRACING_TRACING_SERVICE_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "build/build_config.h"
  8. #include "mojo/public/cpp/bindings/pending_receiver.h"
  9. #include "mojo/public/cpp/bindings/receiver.h"
  10. #include "services/tracing/public/mojom/tracing_service.mojom.h"
  11. namespace tracing {
  12. class PerfettoService;
  13. class TracingService : public mojom::TracingService {
  14. public:
  15. explicit TracingService(PerfettoService* = nullptr);
  16. explicit TracingService(
  17. mojo::PendingReceiver<mojom::TracingService> receiver);
  18. TracingService(const TracingService&) = delete;
  19. ~TracingService() override;
  20. TracingService& operator=(const TracingService&) = delete;
  21. // mojom::TracingService implementation:
  22. void Initialize(std::vector<mojom::ClientInfoPtr> clients) override;
  23. void AddClient(mojom::ClientInfoPtr client) override;
  24. #if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_IOS)
  25. void BindConsumerHost(
  26. mojo::PendingReceiver<mojom::ConsumerHost> receiver) override;
  27. #endif
  28. private:
  29. mojo::Receiver<mojom::TracingService> receiver_{this};
  30. raw_ptr<PerfettoService> perfetto_service_;
  31. };
  32. } // namespace tracing
  33. #endif // SERVICES_TRACING_TRACING_SERVICE_H_