Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: chromeos/trace/arc_trace_agent.h

Issue 2699833003: arc: enable Android tracing from chrome://tracing in dev mode (Closed)
Patch Set: Fix according to the comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/trace/arc_trace_agent.h
diff --git a/chromeos/trace/arc_trace_agent.h b/chromeos/trace/arc_trace_agent.h
new file mode 100644
index 0000000000000000000000000000000000000000..32e8fed8da82f9534531e262f544b785b80f16d1
--- /dev/null
+++ b/chromeos/trace/arc_trace_agent.h
@@ -0,0 +1,47 @@
+// Copyright 2017 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_TRACE_ARC_TRACE_AGENT_H_
+#define CHROMEOS_TRACE_ARC_TRACE_AGENT_H_
+
+#include "base/callback_forward.h"
+#include "base/trace_event/trace_event.h"
+#include "base/trace_event/tracing_agent.h"
+#include "chromeos/chromeos_export.h"
+
+namespace chromeos {
+
+// A wrapper for controlling tracing in ARC container.
+// The overriden Stop/StartAgentTracing functions are implemented by the
+// Delegate object to interact with ARC bridge. All the functions are expected
+// to be called on the brower's UI thread.
+class CHROMEOS_EXPORT ArcTraceAgent : public base::trace_event::TracingAgent {
Daniel Erat 2017/03/08 02:58:40 this should probably be named ArcTracingAgent inst
Earl Ou 2017/03/08 05:03:04 Done.
+ public:
+ class Delegate {
+ public:
+ using StartTracingCallback = base::Callback<void(bool)>;
Daniel Erat 2017/03/07 15:53:22 document parameters
Earl Ou 2017/03/08 05:03:04 Done.
+ using StopTracingCallback = base::Callback<void(bool)>;
+
+ virtual ~Delegate();
+
+ virtual void StartTracing(
Daniel Erat 2017/03/07 15:53:21 please add method-level comments documenting what
Earl Ou 2017/03/08 05:03:04 Done.
+ const base::trace_event::TraceConfig& trace_config,
+ const StartTracingCallback& callback) = 0;
+
+ virtual void StopTracing(const StopTracingCallback& callback) = 0;
+ };
+
+ virtual ~ArcTraceAgent();
Daniel Erat 2017/03/07 15:53:22 use 'override' instead of 'virtual' here, i think
Earl Ou 2017/03/08 05:03:04 We actually implement this class in a subclass, an
Daniel Erat 2017/03/08 05:21:07 i think it should have 'override' since it's overr
Earl Ou 2017/03/08 07:59:28 You're right. I need to take some c++ course :)
+
+ static ArcTraceAgent* GetInstance();
Daniel Erat 2017/03/07 15:53:21 does this actually need to be a singleton? if not,
Earl Ou 2017/03/08 05:03:04 This is related to the dependency issue. The insta
+
+ // Sets Delegate instance, which should implement the communication
+ // using ARC bridge. If set to nullptr, calling of Start/StopAgentTracing
+ // does nothing.
+ virtual void SetDelegate(Delegate* delegate) = 0;
Daniel Erat 2017/03/07 15:53:21 if ownership of |delegate| is transferred, it shou
Earl Ou 2017/03/08 05:03:04 It's owned by ArcServiceLauncher, I added comments
+};
Daniel Erat 2017/03/07 15:53:22 DISALLOW_COPY_AND_ASSIGN
Earl Ou 2017/03/08 05:03:04 Done.
+
+} // namespace chromeos
+
+#endif // CHROMEOS_TRACE_ARC_TRACE_AGENT_H_

Powered by Google App Engine
This is Rietveld 408576698