| Index: content/browser/power_profiler/devtools_power_profiler_host.h
|
| diff --git a/content/browser/power_profiler/devtools_power_profiler_host.h b/content/browser/power_profiler/devtools_power_profiler_host.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..129307864d6a99e2ba305d506a396093b0d7607a
|
| --- /dev/null
|
| +++ b/content/browser/power_profiler/devtools_power_profiler_host.h
|
| @@ -0,0 +1,46 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_BROWSER_DEVTOOLS_POWER_PROFILER_HOST_H_
|
| +#define CONTENT_BROWSER_DEVTOOLS_POWER_PROFILER_HOST_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "base/values.h"
|
| +#include "content/browser/power_profiler/power_profiler_host.h"
|
| +
|
| +#if defined(OS_WIN)
|
| +#define ENABLE_POWER_PROFILER 1
|
| +#else
|
| +#undef ENABLE_POWER_PROFILE
|
| +#endif // !OS_WIN
|
| +
|
| +namespace content {
|
| +
|
| +class DevToolsFrontendHost;
|
| +class WeakPtr;
|
| +
|
| +// A class used to monitor the power usage and tell profiler the power data
|
| +class DevToolsPowerProfilerHost : public PowerProfilerHost {
|
| + public:
|
| + DevToolsPowerProfilerHost(const base::WeakPtr<DevToolsFrontendHost>& host);
|
| + ~DevToolsPowerProfilerHost() {}
|
| + virtual void Send(PowerEvent*, int);
|
| +
|
| + virtual bool Register() OVERRIDE;
|
| +
|
| + private:
|
| + void SendWrapper(const std::string& message);
|
| + double convertMonotonicTimeToWallTime(base::TimeTicks&);
|
| + void convertPowerValueToJSONObject(base::DictionaryValue*, PowerEvent*);
|
| + base::WeakPtr<DevToolsFrontendHost> frontend_host_;
|
| + double reference_wall_time_;
|
| + base::TimeTicks reference_monotonic_time_;
|
| + DISALLOW_COPY_AND_ASSIGN(DevToolsPowerProfilerHost);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_DEVTOOLS_POWER_PROFILER_HOST_H_
|
|
|