Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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_TRACE_ARC_TRACE_AGENT_H_ | |
| 6 #define CHROMEOS_TRACE_ARC_TRACE_AGENT_H_ | |
| 7 | |
| 8 #include "base/callback_forward.h" | |
| 9 #include "base/trace_event/trace_event.h" | |
| 10 #include "base/trace_event/tracing_agent.h" | |
| 11 #include "chromeos/chromeos_export.h" | |
| 12 | |
| 13 namespace chromeos { | |
| 14 | |
| 15 // A wrapper for controlling tracing in ARC container. | |
| 16 // The overriden Stop/StartAgentTracing functions are implemented by the | |
| 17 // Delegate object to interact with ARC bridge. All the functions are expected | |
| 18 // to be called on the brower's UI thread. | |
| 19 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.
| |
| 20 public: | |
| 21 class Delegate { | |
| 22 public: | |
| 23 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.
| |
| 24 using StopTracingCallback = base::Callback<void(bool)>; | |
| 25 | |
| 26 virtual ~Delegate(); | |
| 27 | |
| 28 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.
| |
| 29 const base::trace_event::TraceConfig& trace_config, | |
| 30 const StartTracingCallback& callback) = 0; | |
| 31 | |
| 32 virtual void StopTracing(const StopTracingCallback& callback) = 0; | |
| 33 }; | |
| 34 | |
| 35 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 :)
| |
| 36 | |
| 37 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
| |
| 38 | |
| 39 // Sets Delegate instance, which should implement the communication | |
| 40 // using ARC bridge. If set to nullptr, calling of Start/StopAgentTracing | |
| 41 // does nothing. | |
| 42 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
| |
| 43 }; | |
|
Daniel Erat
2017/03/07 15:53:22
DISALLOW_COPY_AND_ASSIGN
Earl Ou
2017/03/08 05:03:04
Done.
| |
| 44 | |
| 45 } // namespace chromeos | |
| 46 | |
| 47 #endif // CHROMEOS_TRACE_ARC_TRACE_AGENT_H_ | |
| OLD | NEW |