Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / content / browser / tracing / power_tracing_agent.h
blobf29918ccabf669fc044c1c7a4e41654f6e511b49
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 template <typename Type>
12 struct DefaultSingletonTraits;
14 namespace content {
16 class BattorPowerTraceProvider;
18 class PowerTracingAgent {
19 public:
20 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)>
21 OutputCallback;
23 bool StartTracing();
24 void StopTracing(const OutputCallback& callback);
26 // Retrieve the singleton instance.
27 static PowerTracingAgent* GetInstance();
29 private:
30 // This allows constructor and destructor to be private and usable only
31 // by the Singleton class.
32 friend struct DefaultSingletonTraits<PowerTracingAgent>;
34 // Constructor.
35 PowerTracingAgent();
36 virtual ~PowerTracingAgent();
38 void OnStopTracingDone(const OutputCallback& callback,
39 const scoped_refptr<base::RefCountedString>& result);
41 void FlushOnThread(const OutputCallback& callback);
43 scoped_ptr<BattorPowerTraceProvider> battor_trace_provider_;
44 bool is_tracing_;
46 DISALLOW_COPY_AND_ASSIGN(PowerTracingAgent);
49 } // namespace content
51 #endif // CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_