OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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_DEVTOOLS_POWER_PROFILER_HOST_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_POWER_PROFILER_HOST_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/values.h" |
| 12 #include "content/browser/power_profiler/power_profiler_host.h" |
| 13 |
| 14 #if defined(OS_WIN) |
| 15 #define ENABLE_POWER_PROFILER 1 |
| 16 #else |
| 17 #undef ENABLE_POWER_PROFILE |
| 18 #endif // !OS_WIN |
| 19 |
| 20 namespace content { |
| 21 |
| 22 class DevToolsFrontendHost; |
| 23 class WeakPtr; |
| 24 |
| 25 // A class used to monitor the power usage and tell profiler the power data |
| 26 class DevToolsPowerProfilerHost : public PowerProfilerHost { |
| 27 public: |
| 28 DevToolsPowerProfilerHost(const base::WeakPtr<DevToolsFrontendHost>& host); |
| 29 ~DevToolsPowerProfilerHost() {} |
| 30 virtual void Send(PowerEvent*, int); |
| 31 |
| 32 virtual bool Register() OVERRIDE; |
| 33 |
| 34 private: |
| 35 void SendWrapper(const std::string& message); |
| 36 double convertMonotonicTimeToWallTime(base::TimeTicks&); |
| 37 void convertPowerValueToJSONObject(base::DictionaryValue*, PowerEvent*); |
| 38 base::WeakPtr<DevToolsFrontendHost> frontend_host_; |
| 39 double reference_wall_time_; |
| 40 base::TimeTicks reference_monotonic_time_; |
| 41 DISALLOW_COPY_AND_ASSIGN(DevToolsPowerProfilerHost); |
| 42 }; |
| 43 |
| 44 } // namespace content |
| 45 |
| 46 #endif // CONTENT_BROWSER_DEVTOOLS_POWER_PROFILER_HOST_H_ |
OLD | NEW |