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/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "mojo/common/tracing.mojom.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/ref_counted_memory.h" |
11 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 13 #include "services/tracing/tracing.mojom.h" |
12 | 14 |
13 namespace mojo { | 15 namespace mojo { |
14 | 16 |
15 class TracingImpl : public Tracing { | 17 class ApplicationImpl; |
| 18 |
| 19 class TracingImpl : public tracing::TraceController { |
16 public: | 20 public: |
17 TracingImpl(InterfaceRequest<Tracing> request, | 21 // This constructs a TracingImpl and connects to the tracing service. The |
18 base::FilePath::StringType base_name); | 22 // lifetime of the TracingImpl is bound to the connection to the tracing |
| 23 // service. |
| 24 static void Create(ApplicationImpl* app); |
| 25 |
| 26 // This constructs a TracingImpl around a tracing::TraceDataCollectorPtr |
| 27 // already bound to the service. |
| 28 static void Create(tracing::TraceDataCollectorPtr ptr); |
| 29 |
19 virtual ~TracingImpl(); | 30 virtual ~TracingImpl(); |
20 | 31 |
21 private: | 32 private: |
22 // Overridden from Tracing: | 33 explicit TracingImpl(ApplicationImpl* app); |
23 void Start() override; | 34 explicit TracingImpl(tracing::TraceDataCollectorPtr ptr); |
24 void Stop() override; | |
25 | 35 |
26 base::FilePath::StringType base_name_; | 36 // Overridden from tracing::TraceController: |
27 StrongBinding<Tracing> binding_; | 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_; |
28 | 44 |
29 DISALLOW_COPY_AND_ASSIGN(TracingImpl); | 45 DISALLOW_COPY_AND_ASSIGN(TracingImpl); |
30 }; | 46 }; |
31 | 47 |
32 } // namespace mojo | 48 } // namespace mojo |
33 | 49 |
34 #endif // MOJO_COMMON_TRACING_IMPL_H_ | 50 #endif // MOJO_COMMON_TRACING_IMPL_H_ |
OLD | NEW |