| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 | |
| 5 #ifndef SERVICES_TRACING_SERVICE_H_ | |
| 6 #define SERVICES_TRACING_SERVICE_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/macros.h" | |
| 14 #include "mojo/public/cpp/bindings/binding_set.h" | |
| 15 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | |
| 16 #include "mojo/public/cpp/bindings/strong_binding.h" | |
| 17 #include "services/service_manager/public/cpp/binder_registry.h" | |
| 18 #include "services/service_manager/public/cpp/interface_factory.h" | |
| 19 #include "services/service_manager/public/cpp/service.h" | |
| 20 #include "services/tracing/data_sink.h" | |
| 21 #include "services/tracing/public/interfaces/tracing.mojom.h" | |
| 22 #include "services/tracing/recorder.h" | |
| 23 | |
| 24 namespace tracing { | |
| 25 | |
| 26 class Service : public service_manager::Service, | |
| 27 public service_manager::InterfaceFactory<mojom::Factory>, | |
| 28 public service_manager::InterfaceFactory<mojom::Collector>, | |
| 29 public service_manager::InterfaceFactory< | |
| 30 mojom::StartupPerformanceDataCollector>, | |
| 31 public mojom::Factory, | |
| 32 public mojom::Collector, | |
| 33 public mojom::StartupPerformanceDataCollector { | |
| 34 public: | |
| 35 Service(); | |
| 36 ~Service() override; | |
| 37 | |
| 38 private: | |
| 39 // service_manager::Service implementation. | |
| 40 void OnBindInterface(const service_manager::ServiceInfo& source_info, | |
| 41 const std::string& interface_name, | |
| 42 mojo::ScopedMessagePipeHandle interface_pipe) override; | |
| 43 bool OnServiceManagerConnectionLost() override; | |
| 44 | |
| 45 // service_manager::InterfaceFactory<mojom::Factory>: | |
| 46 void Create(const service_manager::Identity& remote_identity, | |
| 47 mojom::FactoryRequest request) override; | |
| 48 | |
| 49 // service_manager::InterfaceFactory<mojom::Collector>: | |
| 50 void Create(const service_manager::Identity& remote_identity, | |
| 51 mojom::CollectorRequest request) override; | |
| 52 | |
| 53 // service_manager::InterfaceFactory<mojom::StartupPerformanceDataCollector>: | |
| 54 void Create(const service_manager::Identity& remote_identity, | |
| 55 mojom::StartupPerformanceDataCollectorRequest request) override; | |
| 56 | |
| 57 // mojom::Factory: | |
| 58 void CreateRecorder(mojom::ProviderPtr provider) override; | |
| 59 | |
| 60 // mojom::Collector: | |
| 61 void Start(mojo::ScopedDataPipeProducerHandle stream, | |
| 62 const std::string& categories) override; | |
| 63 void StopAndFlush() override; | |
| 64 | |
| 65 // mojom::StartupPerformanceDataCollector: | |
| 66 void SetServiceManagerProcessCreationTime(int64_t time) override; | |
| 67 void SetServiceManagerMainEntryPointTime(int64_t time) override; | |
| 68 void SetBrowserMessageLoopStartTicks(int64_t ticks) override; | |
| 69 void SetBrowserWindowDisplayTicks(int64_t ticks) override; | |
| 70 void SetBrowserOpenTabsTimeDelta(int64_t delta) override; | |
| 71 void SetFirstWebContentsMainFrameLoadTicks(int64_t ticks) override; | |
| 72 void SetFirstVisuallyNonEmptyLayoutTicks(int64_t ticks) override; | |
| 73 void GetStartupPerformanceTimes( | |
| 74 const GetStartupPerformanceTimesCallback& callback) override; | |
| 75 | |
| 76 void AllDataCollected(); | |
| 77 | |
| 78 service_manager::BinderRegistry registry_; | |
| 79 mojo::BindingSet<mojom::Factory> bindings_; | |
| 80 std::unique_ptr<DataSink> sink_; | |
| 81 std::vector<std::unique_ptr<Recorder>> recorder_impls_; | |
| 82 mojo::InterfacePtrSet<mojom::Provider> provider_ptrs_; | |
| 83 mojo::Binding<mojom::Collector> collector_binding_; | |
| 84 mojo::BindingSet<mojom::StartupPerformanceDataCollector> | |
| 85 startup_performance_data_collector_bindings_; | |
| 86 mojom::StartupPerformanceTimes startup_performance_times_; | |
| 87 bool tracing_active_; | |
| 88 std::string tracing_categories_; | |
| 89 | |
| 90 DISALLOW_COPY_AND_ASSIGN(Service); | |
| 91 }; | |
| 92 | |
| 93 } // namespace tracing | |
| 94 | |
| 95 #endif // SERVICES_TRACING_SERVICE_H_ | |
| OLD | NEW |