OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_COMMON_TRACING_IMPL_H_ | 5 #ifndef MOJO_COMMON_TRACING_IMPL_H_ |
6 #define MOJO_COMMON_TRACING_IMPL_H_ | 6 #define MOJO_COMMON_TRACING_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/macros.h" |
9 #include "base/files/file_path.h" | 9 #include "mojo/public/cpp/application/interface_factory.h" |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/memory/ref_counted_memory.h" | |
12 #include "mojo/public/cpp/bindings/strong_binding.h" | |
13 #include "services/tracing/tracing.mojom.h" | 10 #include "services/tracing/tracing.mojom.h" |
14 | 11 |
15 namespace mojo { | 12 namespace mojo { |
16 | 13 |
17 class ApplicationImpl; | 14 class ApplicationImpl; |
18 | 15 |
19 class TracingImpl : public tracing::TraceController { | 16 class TracingImpl : public InterfaceFactory<tracing::TraceController> { |
20 public: | 17 public: |
21 // This constructs a TracingImpl and connects to the tracing service. The | 18 TracingImpl(); |
22 // lifetime of the TracingImpl is bound to the connection to the tracing | 19 ~TracingImpl() override; |
23 // service. | |
24 static void Create(ApplicationImpl* app); | |
25 | 20 |
26 // This constructs a TracingImpl around a tracing::TraceDataCollectorPtr | 21 // This connects to the tracing service and registers ourselves to provide |
27 // already bound to the service. | 22 // tracing data on demand. |
28 static void Create(tracing::TraceDataCollectorPtr ptr); | 23 void Initialize(ApplicationImpl* app); |
29 | |
30 virtual ~TracingImpl(); | |
31 | 24 |
32 private: | 25 private: |
33 explicit TracingImpl(ApplicationImpl* app); | 26 // InterfaceFactory<tracing::TraceController> implementation. |
34 explicit TracingImpl(tracing::TraceDataCollectorPtr ptr); | 27 void Create(ApplicationConnection* connection, |
35 | 28 InterfaceRequest<tracing::TraceController> request) override; |
36 // Overridden from tracing::TraceController: | |
37 void StartTracing(const String& categories) override; | |
38 void StopTracing() override; | |
39 | |
40 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str, | |
41 bool has_more_events); | |
42 | |
43 StrongBinding<tracing::TraceController> binding_; | |
44 | 29 |
45 DISALLOW_COPY_AND_ASSIGN(TracingImpl); | 30 DISALLOW_COPY_AND_ASSIGN(TracingImpl); |
46 }; | 31 }; |
47 | 32 |
48 } // namespace mojo | 33 } // namespace mojo |
49 | 34 |
50 #endif // MOJO_COMMON_TRACING_IMPL_H_ | 35 #endif // MOJO_COMMON_TRACING_IMPL_H_ |
OLD | NEW |