Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: services/tracing/tracing_app.h

Issue 1932843002: Add TraceProviderRegistry and implementation in tracing service/application. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/interface_ptr_set.h" 12 #include "mojo/common/interface_ptr_set.h"
12 #include "mojo/public/cpp/application/application_delegate.h" 13 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/public/cpp/application/application_impl.h" 14 #include "mojo/public/cpp/application/application_impl.h"
14 #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"
15 #include "mojo/services/tracing/interfaces/tracing.mojom.h" 17 #include "mojo/services/tracing/interfaces/tracing.mojom.h"
16 #include "services/tracing/trace_data_sink.h" 18 #include "services/tracing/trace_data_sink.h"
17 #include "services/tracing/trace_recorder_impl.h" 19 #include "services/tracing/trace_recorder_impl.h"
18 20
19 namespace tracing { 21 namespace tracing {
20 22
21 class TracingApp : public mojo::ApplicationDelegate, 23 class TracingApp : public mojo::ApplicationDelegate,
22 public mojo::InterfaceFactory<TraceCollector>, 24 public mojo::InterfaceFactory<TraceCollector>,
23 public TraceCollector { 25 public mojo::InterfaceFactory<TraceProviderRegistry>,
26 public TraceCollector,
27 public TraceProviderRegistry {
24 public: 28 public:
25 TracingApp(); 29 TracingApp();
26 ~TracingApp() override; 30 ~TracingApp() override;
27 31
28 private: 32 private:
29 // mojo::ApplicationDelegate implementation. 33 // mojo::ApplicationDelegate implementation.
30 bool ConfigureIncomingConnection( 34 bool ConfigureIncomingConnection(
31 mojo::ApplicationConnection* connection) override; 35 mojo::ApplicationConnection* connection) override;
32 36
33 // mojo::InterfaceFactory<TraceCollector> implementation. 37 // mojo::InterfaceFactory<TraceCollector> implementation.
34 void Create(mojo::ApplicationConnection* connection, 38 void Create(mojo::ApplicationConnection* connection,
35 mojo::InterfaceRequest<TraceCollector> request) override; 39 mojo::InterfaceRequest<TraceCollector> request) override;
36 40
37 // tracing::TraceCollector implementation. 41 // mojo::InterfaceFactory<TraceProviderRegistry> implementation.
42 void Create(mojo::ApplicationConnection* connection,
43 mojo::InterfaceRequest<TraceProviderRegistry> request) override;
44
45 // TraceCollector implementation.
38 void Start(mojo::ScopedDataPipeProducerHandle stream, 46 void Start(mojo::ScopedDataPipeProducerHandle stream,
39 const mojo::String& categories) override; 47 const mojo::String& categories) override;
40 void StopAndFlush() override; 48 void StopAndFlush() override;
41 49
50 // TraceProviderRegistry implementation.
51 void RegisterTraceProvider(
52 mojo::InterfaceHandle<TraceProvider> trace_provider) override;
53
42 void AllDataCollected(); 54 void AllDataCollected();
43 55
44 scoped_ptr<TraceDataSink> sink_; 56 scoped_ptr<TraceDataSink> sink_;
45 ScopedVector<TraceRecorderImpl> recorder_impls_; 57 ScopedVector<TraceRecorderImpl> recorder_impls_;
46 mojo::InterfacePtrSet<TraceProvider> provider_ptrs_; 58 mojo::InterfacePtrSet<TraceProvider> provider_ptrs_;
47 mojo::Binding<TraceCollector> collector_binding_; 59 mojo::Binding<TraceCollector> collector_binding_;
60 mojo::BindingSet<TraceProviderRegistry> provider_registry_bindings_;
48 bool tracing_active_; 61 bool tracing_active_;
49 mojo::String tracing_categories_; 62 mojo::String tracing_categories_;
50 63
51 DISALLOW_COPY_AND_ASSIGN(TracingApp); 64 DISALLOW_COPY_AND_ASSIGN(TracingApp);
52 }; 65 };
53 66
54 } // namespace tracing 67 } // namespace tracing
55 68
56 #endif // SERVICES_TRACING_TRACING_APP_H_ 69 #endif // SERVICES_TRACING_TRACING_APP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698