Index: chromeos/dbus/arc_trace_agent.h |
diff --git a/chromeos/dbus/arc_trace_agent.h b/chromeos/dbus/arc_trace_agent.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e54536a33cc60585e4504acf02de550ca86757fd |
--- /dev/null |
+++ b/chromeos/dbus/arc_trace_agent.h |
@@ -0,0 +1,74 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROMEOS_DBUS_ARC_TRACE_AGENT_H_ |
+#define CHROMEOS_DBUS_ARC_TRACE_AGENT_H_ |
+ |
+#include <string> |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/task_runner.h" |
+#include "base/trace_event/trace_event.h" |
+#include "base/trace_event/tracing_agent.h" |
+#include "chromeos/dbus/dbus_client.h" |
+#include "chromeos/dbus/pipe_reader.h" |
+#include "dbus/object_proxy.h" |
+ |
+namespace chromeos { |
+ |
+// A wrapper for controlling system tracing on Chrome OS. |
+class ArcTraceAgent |
+ : public base::trace_event::TracingAgent, |
+ public DBusClient { |
+ public: |
+ 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.
|
+ public: |
+ virtual void StartTracing( |
+ const base::trace_event::TraceConfig& trace_config) = 0; |
+ |
+ virtual void StopTracing() = 0; |
+ }; |
+ |
+ ~ArcTraceAgent(); |
+ |
+ void SetArcTraceBridge(ArcTraceBridge* bridge); |
+ |
+ // 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.
|
+ std::string GetTracingAgentName() override; |
+ |
+ std::string GetTraceEventLabel() override; |
+ |
+ void StopAgentTracing(const StopAgentTracingCallback& callback) override; |
+ |
+ void StartAgentTracing(const base::trace_event::TraceConfig& trace_config, |
+ const StartAgentTracingCallback& callback) override; |
+ |
+ void SetStopAgentTracingTaskRunner( |
+ scoped_refptr<base::TaskRunner> task_runner); |
+ |
+ 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.
|
+ |
+ static ArcTraceAgent* Create(); |
+ |
+ private: |
+ ArcTraceAgent(); |
+ |
+ 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.
|
+ |
+ void OnStartMethod(dbus::Response* response); |
+ void OnIOComplete(); |
+ void OnStopAgentTracing(dbus::Response* response); |
+ |
+ 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.
|
+ dbus::ObjectProxy* debugdaemon_proxy_; |
+ std::unique_ptr<PipeReaderForString> pipe_reader_; |
+ 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.
|
+ scoped_refptr<base::TaskRunner> stop_agent_tracing_task_runner_; |
+ StopAgentTracingCallback callback_; |
Luis Héctor Chávez
2016/12/27 19:16:00
nit: stop_callback_
shunhsingou
2016/12/28 09:15:16
Done.
|
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROMEOS_DBUS_ARC_TRACE_AGENT_H_ |