Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: content/public/browser/power_data_provider.h

Issue 106223002: chrome power profiler chrome side changes (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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_POWER_DATA_PROVIDER_H_
6 #define CONTENT_BROWSER_POWER_DATA_PROVIDER_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h"
11
12 namespace content {
13
14 // A class used to monitor the power usage and tell profiler the power data
qsr 2014/01/22 15:30:01 The comment seems not to apply to this object. Thi
15 struct PowerEvent {
16 enum Type {
17 // Total power of SoC. including CPU, GT and others on the chip
18 SOC_PACKAGE,
19
20 // Count the number of known PowerEvent
21 ID_COUNT
22 };
23
24 Type type;
25 base::TimeTicks time;
26 double value; // power
27 };
28
29 // A class used to GET power usage
qsr 2014/01/22 15:30:01 No need for uppercase.
30 class PowerDataProvider {
31 public:
32 virtual ~PowerDataProvider() { }
33
34 // Return true when success
qsr 2014/01/22 15:30:01 Can you be more precise and what this method those
35 virtual bool GetData(PowerEvent*) = 0;
36
37 virtual bool IsDummy() const { return false; }
qsr 2014/01/22 15:30:01 You might not nee a dummy provider in fact, and so
38
39 protected:
40 PowerDataProvider() { }
qsr 2014/01/22 15:30:01 I'm not sure you want to protect this. When writin
41
42 private:
43 friend class PowerDataProviderFactory;
44 DISALLOW_COPY_AND_ASSIGN(PowerDataProvider);
45 };
46
47 // A dummy data provider
48 class PowerDataProviderDummy : public PowerDataProvider {
49 public:
50 virtual ~PowerDataProviderDummy() { }
51
52 virtual bool IsDummy() const OVERRIDE { return true; }
53
54 virtual bool GetData(PowerEvent* data) OVERRIDE {
55 return false;
56 }
57
58 protected:
59 PowerDataProviderDummy() { }
60
61 private:
62 friend class PowerDataProviderFactory;
63 DISALLOW_COPY_AND_ASSIGN(PowerDataProviderDummy);
64 };
65
66 class PowerDataProviderFactory {
67 public:
68 static PowerDataProvider* Create();
qsr 2014/01/22 15:30:01 You can return a scoped_ptr<PowerDataProvider> her
69
70 private:
71 PowerDataProviderFactory() { }
72 DISALLOW_COPY_AND_ASSIGN(PowerDataProviderFactory);
73 };
74
75 } // namespace content
76
77 #endif // CONTENT_BROWSER_POWER_DATA_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698