| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SERVICES_TRACING_SERVICE_H_ | 5 #ifndef SERVICES_TRACING_SERVICE_H_ |
| 6 #define SERVICES_TRACING_SERVICE_H_ | 6 #define SERVICES_TRACING_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "mojo/public/cpp/bindings/binding_set.h" | 14 #include "mojo/public/cpp/bindings/binding_set.h" |
| 15 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | 15 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
| 16 #include "mojo/public/cpp/bindings/strong_binding.h" | 16 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 17 #include "services/service_manager/public/cpp/binder_registry.h" |
| 17 #include "services/service_manager/public/cpp/interface_factory.h" | 18 #include "services/service_manager/public/cpp/interface_factory.h" |
| 18 #include "services/service_manager/public/cpp/service.h" | 19 #include "services/service_manager/public/cpp/service.h" |
| 19 #include "services/tracing/data_sink.h" | 20 #include "services/tracing/data_sink.h" |
| 20 #include "services/tracing/public/interfaces/tracing.mojom.h" | 21 #include "services/tracing/public/interfaces/tracing.mojom.h" |
| 21 #include "services/tracing/recorder.h" | 22 #include "services/tracing/recorder.h" |
| 22 | 23 |
| 23 namespace tracing { | 24 namespace tracing { |
| 24 | 25 |
| 25 class Service : public service_manager::Service, | 26 class Service : public service_manager::Service, |
| 26 public service_manager::InterfaceFactory<mojom::Factory>, | 27 public service_manager::InterfaceFactory<mojom::Factory>, |
| 27 public service_manager::InterfaceFactory<mojom::Collector>, | 28 public service_manager::InterfaceFactory<mojom::Collector>, |
| 28 public service_manager::InterfaceFactory< | 29 public service_manager::InterfaceFactory< |
| 29 mojom::StartupPerformanceDataCollector>, | 30 mojom::StartupPerformanceDataCollector>, |
| 30 public mojom::Factory, | 31 public mojom::Factory, |
| 31 public mojom::Collector, | 32 public mojom::Collector, |
| 32 public mojom::StartupPerformanceDataCollector { | 33 public mojom::StartupPerformanceDataCollector { |
| 33 public: | 34 public: |
| 34 Service(); | 35 Service(); |
| 35 ~Service() override; | 36 ~Service() override; |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 // service_manager::Service implementation. | 39 // service_manager::Service implementation. |
| 39 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 40 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
| 40 service_manager::InterfaceRegistry* registry) override; | 41 const std::string& interface_name, |
| 42 mojo::ScopedMessagePipeHandle interface_pipe) override; |
| 41 bool OnServiceManagerConnectionLost() override; | 43 bool OnServiceManagerConnectionLost() override; |
| 42 | 44 |
| 43 // service_manager::InterfaceFactory<mojom::Factory>: | 45 // service_manager::InterfaceFactory<mojom::Factory>: |
| 44 void Create(const service_manager::Identity& remote_identity, | 46 void Create(const service_manager::Identity& remote_identity, |
| 45 mojom::FactoryRequest request) override; | 47 mojom::FactoryRequest request) override; |
| 46 | 48 |
| 47 // service_manager::InterfaceFactory<mojom::Collector>: | 49 // service_manager::InterfaceFactory<mojom::Collector>: |
| 48 void Create(const service_manager::Identity& remote_identity, | 50 void Create(const service_manager::Identity& remote_identity, |
| 49 mojom::CollectorRequest request) override; | 51 mojom::CollectorRequest request) override; |
| 50 | 52 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 66 void SetBrowserMessageLoopStartTicks(int64_t ticks) override; | 68 void SetBrowserMessageLoopStartTicks(int64_t ticks) override; |
| 67 void SetBrowserWindowDisplayTicks(int64_t ticks) override; | 69 void SetBrowserWindowDisplayTicks(int64_t ticks) override; |
| 68 void SetBrowserOpenTabsTimeDelta(int64_t delta) override; | 70 void SetBrowserOpenTabsTimeDelta(int64_t delta) override; |
| 69 void SetFirstWebContentsMainFrameLoadTicks(int64_t ticks) override; | 71 void SetFirstWebContentsMainFrameLoadTicks(int64_t ticks) override; |
| 70 void SetFirstVisuallyNonEmptyLayoutTicks(int64_t ticks) override; | 72 void SetFirstVisuallyNonEmptyLayoutTicks(int64_t ticks) override; |
| 71 void GetStartupPerformanceTimes( | 73 void GetStartupPerformanceTimes( |
| 72 const GetStartupPerformanceTimesCallback& callback) override; | 74 const GetStartupPerformanceTimesCallback& callback) override; |
| 73 | 75 |
| 74 void AllDataCollected(); | 76 void AllDataCollected(); |
| 75 | 77 |
| 78 service_manager::BinderRegistry registry_; |
| 76 mojo::BindingSet<mojom::Factory> bindings_; | 79 mojo::BindingSet<mojom::Factory> bindings_; |
| 77 std::unique_ptr<DataSink> sink_; | 80 std::unique_ptr<DataSink> sink_; |
| 78 std::vector<std::unique_ptr<Recorder>> recorder_impls_; | 81 std::vector<std::unique_ptr<Recorder>> recorder_impls_; |
| 79 mojo::InterfacePtrSet<mojom::Provider> provider_ptrs_; | 82 mojo::InterfacePtrSet<mojom::Provider> provider_ptrs_; |
| 80 mojo::Binding<mojom::Collector> collector_binding_; | 83 mojo::Binding<mojom::Collector> collector_binding_; |
| 81 mojo::BindingSet<mojom::StartupPerformanceDataCollector> | 84 mojo::BindingSet<mojom::StartupPerformanceDataCollector> |
| 82 startup_performance_data_collector_bindings_; | 85 startup_performance_data_collector_bindings_; |
| 83 mojom::StartupPerformanceTimes startup_performance_times_; | 86 mojom::StartupPerformanceTimes startup_performance_times_; |
| 84 bool tracing_active_; | 87 bool tracing_active_; |
| 85 std::string tracing_categories_; | 88 std::string tracing_categories_; |
| 86 | 89 |
| 87 DISALLOW_COPY_AND_ASSIGN(Service); | 90 DISALLOW_COPY_AND_ASSIGN(Service); |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 } // namespace tracing | 93 } // namespace tracing |
| 91 | 94 |
| 92 #endif // SERVICES_TRACING_SERVICE_H_ | 95 #endif // SERVICES_TRACING_SERVICE_H_ |
| OLD | NEW |