| 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 CONTENT_BROWSER_TRACING_ARC_TRACING_AGENT_H_ | |
| 6 #define CONTENT_BROWSER_TRACING_ARC_TRACING_AGENT_H_ | |
| 7 | |
| 8 #include "base/callback_forward.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/trace_event/trace_event.h" | |
| 11 #include "base/trace_event/tracing_agent.h" | |
| 12 | |
| 13 namespace content { | |
| 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 browser's UI thread. | |
| 19 class ArcTracingAgent : public base::trace_event::TracingAgent { | |
| 20 public: | |
| 21 class Delegate { | |
| 22 public: | |
| 23 // Callback for StartTracing, takes one boolean argument to indicate | |
| 24 // success or failure. | |
| 25 using StartTracingCallback = base::Callback<void(bool)>; | |
| 26 // Callback for StopTracing, takes one boolean argument to indicate | |
| 27 // success or failure. | |
| 28 using StopTracingCallback = base::Callback<void(bool)>; | |
| 29 | |
| 30 virtual ~Delegate(); | |
| 31 | |
| 32 // Starts tracing in ARC container. | |
| 33 virtual void StartTracing( | |
| 34 const base::trace_event::TraceConfig& trace_config, | |
| 35 const StartTracingCallback& callback) = 0; | |
| 36 | |
| 37 // Stops tracing in ARC container. | |
| 38 virtual void StopTracing(const StopTracingCallback& callback) = 0; | |
| 39 }; | |
| 40 | |
| 41 ArcTracingAgent(); | |
| 42 ~ArcTracingAgent() override; | |
| 43 | |
| 44 static ArcTracingAgent* GetInstance(); | |
| 45 | |
| 46 // Sets Delegate instance, which should implement the communication | |
| 47 // using ARC bridge. If set to nullptr, calling of Start/StopAgentTracing | |
| 48 // does nothing. Ownership of |delegate| remains with the caller. | |
| 49 virtual void SetDelegate(Delegate* delegate) = 0; | |
| 50 | |
| 51 private: | |
| 52 DISALLOW_COPY_AND_ASSIGN(ArcTracingAgent); | |
| 53 }; | |
| 54 | |
| 55 } // namespace content | |
| 56 | |
| 57 #endif // CONTENT_BROWSER_TRACING_ARC_TRACING_AGENT_H_ | |
| OLD | NEW |