| 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 #include "content/common/content_export.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // A wrapper for controlling tracing in ARC container. |
| 17 // The overriden Stop/StartAgentTracing functions are implemented by the |
| 18 // Delegate object to interact with ARC bridge. All the functions are expected |
| 19 // to be called on the browser's UI thread. |
| 20 class CONTENT_EXPORT ArcTracingAgent : public base::trace_event::TracingAgent { |
| 21 public: |
| 22 class Delegate { |
| 23 public: |
| 24 // Callback for StartTracing, takes one boolean argument to indicate |
| 25 // success or failure. |
| 26 using StartTracingCallback = base::Callback<void(bool)>; |
| 27 // Callback for StopTracing, takes one boolean argument to indicate |
| 28 // success or failure. |
| 29 using StopTracingCallback = base::Callback<void(bool)>; |
| 30 |
| 31 virtual ~Delegate(); |
| 32 |
| 33 // Starts tracing in ARC container. |
| 34 virtual void StartTracing( |
| 35 const base::trace_event::TraceConfig& trace_config, |
| 36 const StartTracingCallback& callback) = 0; |
| 37 |
| 38 // Stops tracing in ARC container. |
| 39 virtual void StopTracing(const StopTracingCallback& callback) = 0; |
| 40 }; |
| 41 |
| 42 ArcTracingAgent(); |
| 43 ~ArcTracingAgent() override; |
| 44 |
| 45 static ArcTracingAgent* GetInstance(); |
| 46 |
| 47 // Sets Delegate instance, which should implement the communication |
| 48 // using ARC bridge. If set to nullptr, calling of Start/StopAgentTracing |
| 49 // does nothing. Ownership of |delegate| remains with the caller. |
| 50 virtual void SetDelegate(Delegate* delegate) = 0; |
| 51 |
| 52 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(ArcTracingAgent); |
| 54 }; |
| 55 |
| 56 } // namespace content |
| 57 |
| 58 #endif // CONTENT_BROWSER_TRACING_ARC_TRACING_AGENT_H_ |
| OLD | NEW |