/**
* @constructor
* @extends {WebInspector.Object}
+ * @param {!WebInspector.Target} target
*/
-WebInspector.PowerProfiler = function()
+WebInspector.PowerProfiler = function(target)
{
WebInspector.Object.call(this);
this._dispatcher = new WebInspector.PowerDispatcher(this);
+ this._target = target;
+ target.registerPowerDispatcher(this._dispatcher);
+ target.powerAgent().getAccuracyLevel(this._onAccuracyLevel.bind(this));
}
WebInspector.PowerProfiler.EventTypes = {
}
WebInspector.PowerProfiler.prototype = {
-
startProfile: function ()
{
- PowerAgent.start();
+ this._target.powerAgent().start();
},
stopProfile: function ()
{
- PowerAgent.end();
+ this._target.powerAgent().end();
+ },
+
+ /**
+ * @return {string}
+ */
+ getAccuracyLevel: function()
+ {
+ return this._accuracyLevel;
+ },
+
+ _onAccuracyLevel: function(error, result) {
+ this._accuracyLevel = "";
+ if (error) {
+ console.log("Unable to retrieve PowerProfiler accuracy level: " + error);
+ return;
+ }
+ this._accuracyLevel = result;
},
__proto__: WebInspector.Object.prototype
WebInspector.PowerDispatcher = function(profiler)
{
this._profiler = profiler;
- InspectorBackend.registerPowerDispatcher(this);
}
WebInspector.PowerDispatcher.prototype = {