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 MOJO_COMMON_TRACING_CONTROLLER_IMPL_H_ | 5 #ifndef MOJO_COMMON_TRACE_PROVIDER_IMPL_H_ |
6 #define MOJO_COMMON_TRACING_CONTROLLER_IMPL_H_ | 6 #define MOJO_COMMON_TRACE_PROVIDER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "mojo/public/cpp/bindings/interface_request.h" | 9 #include "mojo/public/cpp/bindings/interface_request.h" |
10 #include "mojo/public/cpp/bindings/strong_binding.h" | 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
11 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | 11 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 | 14 |
15 class TraceControllerImpl : public tracing::TraceController { | 15 class TraceProviderImpl : public tracing::TraceProvider { |
16 public: | 16 public: |
17 explicit TraceControllerImpl( | 17 explicit TraceProviderImpl(InterfaceRequest<tracing::TraceProvider> request); |
18 InterfaceRequest<tracing::TraceController> request); | 18 ~TraceProviderImpl() override; |
19 ~TraceControllerImpl() override; | |
20 | 19 |
21 // Set to true if base::trace_event::TraceLog is enabled externally to this | 20 // Set to true if base::trace_event::TraceLog is enabled externally to this |
22 // class. If this is set to true this class will save the collector but not | 21 // class. If this is set to true this class will save the collector but not |
23 // enable tracing when it receives a StartTracing message from the tracing | 22 // enable tracing when it receives a StartTracing message from the tracing |
24 // service. | 23 // service. |
25 void set_tracing_already_started(bool tracing_already_started) { | 24 void set_tracing_already_started(bool tracing_already_started) { |
26 tracing_already_started_ = tracing_already_started; | 25 tracing_already_started_ = tracing_already_started; |
27 } | 26 } |
28 | 27 |
29 private: | 28 private: |
30 // tracing::TraceController implementation: | 29 // tracing::TraceProvider implementation: |
31 void StartTracing(const String& categories, | 30 void StartTracing(const String& categories, |
32 tracing::TraceDataCollectorPtr collector) override; | 31 tracing::TraceRecorderPtr collector) override; |
33 void StopTracing() override; | 32 void StopTracing() override; |
34 | 33 |
35 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str, | 34 void SendChunk(const scoped_refptr<base::RefCountedString>& events_str, |
36 bool has_more_events); | 35 bool has_more_events); |
37 | 36 |
38 bool tracing_already_started_; | 37 bool tracing_already_started_; |
39 tracing::TraceDataCollectorPtr collector_; | 38 tracing::TraceRecorderPtr recorder_; |
40 StrongBinding<tracing::TraceController> binding_; | 39 StrongBinding<tracing::TraceProvider> binding_; |
41 | 40 |
42 DISALLOW_COPY_AND_ASSIGN(TraceControllerImpl); | 41 DISALLOW_COPY_AND_ASSIGN(TraceProviderImpl); |
43 }; | 42 }; |
44 | 43 |
45 } // namespace mojo | 44 } // namespace mojo |
46 | 45 |
47 #endif // MOJO_COMMON_TRACING_CONTROLLER_IMPL_H_ | 46 #endif // MOJO_COMMON_TRACE_PROVIDER_IMPL_H_ |
OLD | NEW |