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

Unified Diff: Source/devtools/front_end/PowerProfiler.js

Issue 104523002: [DevTools] Add power profiler and power overview in timeline panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/PowerProfiler.js
diff --git a/Source/devtools/front_end/PowerProfiler.js b/Source/devtools/front_end/PowerProfiler.js
new file mode 100644
index 0000000000000000000000000000000000000000..bae2e99f53fd322029e0ac8a5e3a329bb5cca3fb
--- /dev/null
+++ b/Source/devtools/front_end/PowerProfiler.js
@@ -0,0 +1,55 @@
+// Copyright 2014 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.
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ */
+WebInspector.PowerProfiler = function()
+{
+ WebInspector.Object.call(this);
+ this._dispatcher = new WebInspector.PowerDispatcher(this);
+}
+
+WebInspector.PowerProfiler.EventTypes = {
+ PowerEventRecorded: "PowerEventRecorded"
+}
+
+WebInspector.PowerProfiler.prototype = {
+
+ startProfile: function ()
+ {
+ PowerAgent.start();
+ },
+
+ stopProfile: function ()
+ {
+ PowerAgent.end();
+ },
+
+ __proto__: WebInspector.Object.prototype
+}
+
+/**
+ * @constructor
+ * @implements {WebInspector.PowerEventDispatcher}
+ */
+WebInspector.PowerDispatcher = function(profiler)
+{
+ this._profiler = profiler;
+ InspectorBackend.registerPowerDispatcher(this);
+}
+
+WebInspector.PowerDispatcher.prototype = {
+ dataAvailable: function(events)
+ {
+ for (var i in events)
+ this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.EventTypes.PowerEventRecorded, events[i]);
+ }
+}
+
+/**
+ * @type {!WebInspector.PowerProfiler}
+ */
+WebInspector.powerProfiler;
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698