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_DART_DART_TRACING_H_ | 5 #ifndef SERVICES_DART_DART_TRACING_H_ |
6 #define SERVICES_DART_DART_TRACING_H_ | 6 #define SERVICES_DART_DART_TRACING_H_ |
7 | 7 |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "mojo/common/tracing_impl.h" | 9 #include "mojo/common/tracing_impl.h" |
10 #include "mojo/public/cpp/application/service_provider_impl.h" | |
11 #include "mojo/public/cpp/bindings/interface_request.h" | 10 #include "mojo/public/cpp/bindings/interface_request.h" |
12 #include "mojo/services/tracing/interfaces/tracing.mojom.h" | 11 #include "mojo/services/tracing/interfaces/tracing.mojom.h" |
13 | 12 |
14 namespace dart { | 13 namespace dart { |
15 | 14 |
16 class DartTimelineController { | 15 class DartTimelineController { |
17 public: | 16 public: |
18 static void Enable(const mojo::String& categories); | 17 static void Enable(const mojo::String& categories); |
19 static void EnableAll(); | 18 static void EnableAll(); |
20 static void Disable(); | 19 static void Disable(); |
(...skipping 14 matching lines...) Expand all Loading... |
35 void StopTracing() override; | 34 void StopTracing() override; |
36 | 35 |
37 void SplitAndRecord(char* data, size_t length); | 36 void SplitAndRecord(char* data, size_t length); |
38 | 37 |
39 mojo::Binding<tracing::TraceProvider> binding_; | 38 mojo::Binding<tracing::TraceProvider> binding_; |
40 tracing::TraceRecorderPtr recorder_; | 39 tracing::TraceRecorderPtr recorder_; |
41 | 40 |
42 DISALLOW_COPY_AND_ASSIGN(DartTraceProvider); | 41 DISALLOW_COPY_AND_ASSIGN(DartTraceProvider); |
43 }; | 42 }; |
44 | 43 |
45 class DartTracingImpl : | 44 class DartTracingImpl { |
46 public mojo::InterfaceFactory<tracing::TraceProvider> { | |
47 public: | 45 public: |
48 DartTracingImpl(); | 46 DartTracingImpl(); |
49 ~DartTracingImpl() override; | 47 ~DartTracingImpl(); |
50 | 48 |
51 // This connects to the tracing service and registers ourselves to provide | 49 // This connects to the tracing service and registers ourselves to provide |
52 // tracing data on demand. | 50 // tracing data on demand. |
53 void Initialize(mojo::ApplicationImpl* app); | 51 void Initialize(mojo::ApplicationImpl* app); |
54 | 52 |
55 private: | |
56 // InterfaceFactory<tracing::TraceProvider> implementation. | |
57 void Create(mojo::ApplicationConnection* connection, | |
58 mojo::InterfaceRequest<tracing::TraceProvider> request) override; | |
59 private: | 53 private: |
60 // Used to provide services *to* mojo:tracing. | |
61 mojo::ServiceProviderImpl outgoing_sp_for_tracing_service_; | |
62 | |
63 DartTraceProvider provider_impl_; | 54 DartTraceProvider provider_impl_; |
64 | 55 |
65 DISALLOW_COPY_AND_ASSIGN(DartTracingImpl); | 56 DISALLOW_COPY_AND_ASSIGN(DartTracingImpl); |
66 }; | 57 }; |
67 | 58 |
68 } // namespace dart | 59 } // namespace dart |
69 | 60 |
70 #endif // SERVICES_DART_DART_TRACING_H_ | 61 #endif // SERVICES_DART_DART_TRACING_H_ |
OLD | NEW |