OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROMEOS_DBUS_ARC_TRACE_AGENT_H_ | |
6 #define CHROMEOS_DBUS_ARC_TRACE_AGENT_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/task_runner.h" | |
13 #include "base/trace_event/trace_event.h" | |
14 #include "base/trace_event/tracing_agent.h" | |
15 #include "chromeos/dbus/dbus_client.h" | |
16 #include "chromeos/dbus/pipe_reader.h" | |
17 #include "dbus/object_proxy.h" | |
18 | |
19 namespace chromeos { | |
20 | |
21 // A wrapper for controlling system tracing on Chrome OS. | |
22 class ArcTraceAgent | |
23 : public base::trace_event::TracingAgent, | |
24 public DBusClient { | |
25 public: | |
26 class ArcTraceBridge { | |
Luis Héctor Chávez
2016/12/27 19:16:00
This is a delegate, so maybe call it Delegate.
shunhsingou
2016/12/28 09:15:16
Done.
| |
27 public: | |
28 virtual void StartTracing( | |
29 const base::trace_event::TraceConfig& trace_config) = 0; | |
30 | |
31 virtual void StopTracing() = 0; | |
32 }; | |
33 | |
34 ~ArcTraceAgent(); | |
35 | |
36 void SetArcTraceBridge(ArcTraceBridge* bridge); | |
37 | |
38 // Overrides TracingAgent functions. | |
Luis Héctor Chávez
2016/12/27 19:16:00
// base::trace_event::TracingAgent overrides:
(an
shunhsingou
2016/12/28 09:15:16
Done.
| |
39 std::string GetTracingAgentName() override; | |
40 | |
41 std::string GetTraceEventLabel() override; | |
42 | |
43 void StopAgentTracing(const StopAgentTracingCallback& callback) override; | |
44 | |
45 void StartAgentTracing(const base::trace_event::TraceConfig& trace_config, | |
46 const StartAgentTracingCallback& callback) override; | |
47 | |
48 void SetStopAgentTracingTaskRunner( | |
49 scoped_refptr<base::TaskRunner> task_runner); | |
50 | |
51 void Init(dbus::Bus* bus) override; | |
Luis Héctor Chávez
2016/12/27 19:16:00
// DBusClient overrides:
shunhsingou
2016/12/28 09:15:16
Done.
| |
52 | |
53 static ArcTraceAgent* Create(); | |
54 | |
55 private: | |
56 ArcTraceAgent(); | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(ArcTraceAgent); | |
Luis Héctor Chávez
2016/12/27 19:16:00
This should be at the very end of a class.
shunhsingou
2016/12/28 09:15:16
Done.
| |
59 | |
60 void OnStartMethod(dbus::Response* response); | |
61 void OnIOComplete(); | |
62 void OnStopAgentTracing(dbus::Response* response); | |
63 | |
64 ArcTraceBridge* arc_trace_bridge_; | |
Luis Héctor Chávez
2016/12/27 19:16:00
Please note who owns all the raw pointers.
shunhsingou
2016/12/28 09:15:16
Done.
| |
65 dbus::ObjectProxy* debugdaemon_proxy_; | |
66 std::unique_ptr<PipeReaderForString> pipe_reader_; | |
67 base::WeakPtrFactory<ArcTraceAgent> weak_ptr_factory_; | |
Luis Héctor Chávez
2016/12/27 19:16:00
WeakPtrFactories should always be the very last en
shunhsingou
2016/12/28 09:15:16
Done.
| |
68 scoped_refptr<base::TaskRunner> stop_agent_tracing_task_runner_; | |
69 StopAgentTracingCallback callback_; | |
Luis Héctor Chávez
2016/12/27 19:16:00
nit: stop_callback_
shunhsingou
2016/12/28 09:15:16
Done.
| |
70 }; | |
71 | |
72 } // namespace chromeos | |
73 | |
74 #endif // CHROMEOS_DBUS_ARC_TRACE_AGENT_H_ | |
OLD | NEW |