OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_ | 5 #ifndef CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_ |
6 #define CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_ | 6 #define CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_ |
7 | 7 |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 | 10 |
| 11 namespace base { |
11 template <typename Type> | 12 template <typename Type> |
12 struct DefaultSingletonTraits; | 13 struct DefaultSingletonTraits; |
| 14 } // namespace base |
13 | 15 |
14 namespace content { | 16 namespace content { |
15 | 17 |
16 class BattorPowerTraceProvider; | 18 class BattorPowerTraceProvider; |
17 | 19 |
18 class PowerTracingAgent { | 20 class PowerTracingAgent { |
19 public: | 21 public: |
20 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> | 22 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> |
21 OutputCallback; | 23 OutputCallback; |
22 | 24 |
23 bool StartTracing(); | 25 bool StartTracing(); |
24 void StopTracing(const OutputCallback& callback); | 26 void StopTracing(const OutputCallback& callback); |
25 | 27 |
26 // Retrieve the singleton instance. | 28 // Retrieve the singleton instance. |
27 static PowerTracingAgent* GetInstance(); | 29 static PowerTracingAgent* GetInstance(); |
28 | 30 |
29 private: | 31 private: |
30 // This allows constructor and destructor to be private and usable only | 32 // This allows constructor and destructor to be private and usable only |
31 // by the Singleton class. | 33 // by the Singleton class. |
32 friend struct DefaultSingletonTraits<PowerTracingAgent>; | 34 friend struct base::DefaultSingletonTraits<PowerTracingAgent>; |
33 | 35 |
34 // Constructor. | 36 // Constructor. |
35 PowerTracingAgent(); | 37 PowerTracingAgent(); |
36 virtual ~PowerTracingAgent(); | 38 virtual ~PowerTracingAgent(); |
37 | 39 |
38 void OnStopTracingDone(const OutputCallback& callback, | 40 void OnStopTracingDone(const OutputCallback& callback, |
39 const scoped_refptr<base::RefCountedString>& result); | 41 const scoped_refptr<base::RefCountedString>& result); |
40 | 42 |
41 void FlushOnThread(const OutputCallback& callback); | 43 void FlushOnThread(const OutputCallback& callback); |
42 | 44 |
43 scoped_ptr<BattorPowerTraceProvider> battor_trace_provider_; | 45 scoped_ptr<BattorPowerTraceProvider> battor_trace_provider_; |
44 bool is_tracing_; | 46 bool is_tracing_; |
45 | 47 |
46 DISALLOW_COPY_AND_ASSIGN(PowerTracingAgent); | 48 DISALLOW_COPY_AND_ASSIGN(PowerTracingAgent); |
47 }; | 49 }; |
48 | 50 |
49 } // namespace content | 51 } // namespace content |
50 | 52 |
51 #endif // CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_ | 53 #endif // CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_ |
OLD | NEW |