| 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_TRACING_APP_H_ | 5 #ifndef SERVICES_TRACING_TRACING_APP_H_ |
| 6 #define SERVICES_TRACING_TRACING_APP_H_ | 6 #define SERVICES_TRACING_TRACING_APP_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 11 #include "mojo/common/binding_set.h" | 11 #include "mojo/common/binding_set.h" |
| 12 #include "mojo/common/interface_ptr_set.h" | 12 #include "mojo/common/interface_ptr_set.h" |
| 13 #include "mojo/public/cpp/application/application_delegate.h" | 13 #include "mojo/public/cpp/application/application_delegate.h" |
| 14 #include "mojo/public/cpp/application/application_impl.h" | 14 #include "mojo/public/cpp/application/application_impl.h" |
| 15 #include "mojo/public/cpp/bindings/strong_binding.h" | 15 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 16 #include "mojo/services/tracing/interfaces/trace_provider_registry.mojom.h" | 16 #include "mojo/services/tracing/interfaces/trace_provider_registry.mojom.h" |
| 17 #include "mojo/services/tracing/interfaces/tracing.mojom.h" | 17 #include "mojo/services/tracing/interfaces/tracing.mojom.h" |
| 18 #include "services/tracing/trace_data_sink.h" | 18 #include "services/tracing/trace_data_sink.h" |
| 19 #include "services/tracing/trace_recorder_impl.h" | 19 #include "services/tracing/trace_recorder_impl.h" |
| 20 | 20 |
| 21 namespace tracing { | 21 namespace tracing { |
| 22 | 22 |
| 23 class TracingApp : public mojo::ApplicationDelegate, | 23 class TracingApp : public mojo::ApplicationDelegate, |
| 24 public mojo::InterfaceFactory<TraceCollector>, | |
| 25 public mojo::InterfaceFactory<TraceProviderRegistry>, | |
| 26 public TraceCollector, | 24 public TraceCollector, |
| 27 public TraceProviderRegistry { | 25 public TraceProviderRegistry { |
| 28 public: | 26 public: |
| 29 TracingApp(); | 27 TracingApp(); |
| 30 ~TracingApp() override; | 28 ~TracingApp() override; |
| 31 | 29 |
| 32 private: | 30 private: |
| 33 // mojo::ApplicationDelegate implementation. | 31 // mojo::ApplicationDelegate implementation. |
| 34 bool ConfigureIncomingConnection( | 32 bool ConfigureIncomingConnection( |
| 35 mojo::ApplicationConnection* connection) override; | 33 mojo::ApplicationConnection* connection) override; |
| 36 | 34 |
| 37 // mojo::InterfaceFactory<TraceCollector> implementation. | |
| 38 void Create(const mojo::ConnectionContext& connection_context, | |
| 39 mojo::InterfaceRequest<TraceCollector> request) override; | |
| 40 | |
| 41 // mojo::InterfaceFactory<TraceProviderRegistry> implementation. | |
| 42 void Create(const mojo::ConnectionContext& connection_context, | |
| 43 mojo::InterfaceRequest<TraceProviderRegistry> request) override; | |
| 44 | |
| 45 // TraceCollector implementation. | 35 // TraceCollector implementation. |
| 46 void Start(mojo::ScopedDataPipeProducerHandle stream, | 36 void Start(mojo::ScopedDataPipeProducerHandle stream, |
| 47 const mojo::String& categories) override; | 37 const mojo::String& categories) override; |
| 48 void StopAndFlush() override; | 38 void StopAndFlush() override; |
| 49 | 39 |
| 50 // TraceProviderRegistry implementation. | 40 // TraceProviderRegistry implementation. |
| 51 void RegisterTraceProvider( | 41 void RegisterTraceProvider( |
| 52 mojo::InterfaceHandle<TraceProvider> trace_provider) override; | 42 mojo::InterfaceHandle<TraceProvider> trace_provider) override; |
| 53 | 43 |
| 54 void AllDataCollected(); | 44 void AllDataCollected(); |
| 55 | 45 |
| 56 scoped_ptr<TraceDataSink> sink_; | 46 scoped_ptr<TraceDataSink> sink_; |
| 57 ScopedVector<TraceRecorderImpl> recorder_impls_; | 47 ScopedVector<TraceRecorderImpl> recorder_impls_; |
| 58 mojo::InterfacePtrSet<TraceProvider> provider_ptrs_; | 48 mojo::InterfacePtrSet<TraceProvider> provider_ptrs_; |
| 59 mojo::Binding<TraceCollector> collector_binding_; | 49 mojo::Binding<TraceCollector> collector_binding_; |
| 60 mojo::BindingSet<TraceProviderRegistry> provider_registry_bindings_; | 50 mojo::BindingSet<TraceProviderRegistry> provider_registry_bindings_; |
| 61 bool tracing_active_; | 51 bool tracing_active_; |
| 62 mojo::String tracing_categories_; | 52 mojo::String tracing_categories_; |
| 63 | 53 |
| 64 DISALLOW_COPY_AND_ASSIGN(TracingApp); | 54 DISALLOW_COPY_AND_ASSIGN(TracingApp); |
| 65 }; | 55 }; |
| 66 | 56 |
| 67 } // namespace tracing | 57 } // namespace tracing |
| 68 | 58 |
| 69 #endif // SERVICES_TRACING_TRACING_APP_H_ | 59 #endif // SERVICES_TRACING_TRACING_APP_H_ |
| OLD | NEW |