[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / tracing / power_tracing_agent.h
blob3c897d6753df931394354bfeca13814d668feac0
1 // Copyright 2015 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.
5 #ifndef CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_
6 #define CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_
8 #include "base/memory/ref_counted_memory.h"
9 #include "base/threading/thread.h"
11 namespace base {
12 template <typename Type>
13 struct DefaultSingletonTraits;
14 } // namespace base
16 namespace content {
18 class BattorPowerTraceProvider;
20 class PowerTracingAgent {
21 public:
22 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)>
23 OutputCallback;
25 bool StartTracing();
26 void StopTracing(const OutputCallback& callback);
28 // Retrieve the singleton instance.
29 static PowerTracingAgent* GetInstance();
31 private:
32 // This allows constructor and destructor to be private and usable only
33 // by the Singleton class.
34 friend struct base::DefaultSingletonTraits<PowerTracingAgent>;
36 // Constructor.
37 PowerTracingAgent();
38 virtual ~PowerTracingAgent();
40 void OnStopTracingDone(const OutputCallback& callback,
41 const scoped_refptr<base::RefCountedString>& result);
43 void FlushOnThread(const OutputCallback& callback);
45 scoped_ptr<BattorPowerTraceProvider> battor_trace_provider_;
46 bool is_tracing_;
48 DISALLOW_COPY_AND_ASSIGN(PowerTracingAgent);
51 } // namespace content
53 #endif // CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_