--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1375,16 +1375,23 @@ pref("devtools.debugger.ui.panes-visible
pref("devtools.debugger.ui.variables-sorting-enabled", true);
pref("devtools.debugger.ui.variables-only-enum-visible", false);
pref("devtools.debugger.ui.variables-searchbox-visible", false);
// Enable the Profiler and the Timeline
pref("devtools.profiler.enabled", true);
pref("devtools.timeline.enabled", false);
+// Enable perftools via build command
+#ifdef MOZ_DEVTOOLS_PERFTOOLS
+ pref("devtools.performance_dev.enabled", true);
+#else
+ pref("devtools.performance_dev.enabled", false);
+#endif
+
// The default Profiler UI settings
pref("devtools.profiler.ui.show-platform-data", false);
// The default cache UI setting
pref("devtools.cache.disabled", false);
// Enable the Network Monitor
pref("devtools.netmonitor.enabled", true);
--- a/browser/devtools/jar.mn
+++ b/browser/devtools/jar.mn
@@ -81,16 +81,20 @@ browser.jar:
content/browser/devtools/webaudioeditor/controller.js (webaudioeditor/controller.js)
content/browser/devtools/webaudioeditor/views/utils.js (webaudioeditor/views/utils.js)
content/browser/devtools/webaudioeditor/views/context.js (webaudioeditor/views/context.js)
content/browser/devtools/webaudioeditor/views/inspector.js (webaudioeditor/views/inspector.js)
content/browser/devtools/profiler.xul (profiler/profiler.xul)
content/browser/devtools/profiler.js (profiler/profiler.js)
content/browser/devtools/ui-recordings.js (profiler/ui-recordings.js)
content/browser/devtools/ui-profile.js (profiler/ui-profile.js)
+#ifdef MOZ_DEVTOOLS_PERFTOOLS
+ content/browser/devtools/performance.xul (performance/performance.xul)
+ content/browser/devtools/performance.js (performance/performance.js)
+#endif
content/browser/devtools/responsivedesign/resize-commands.js (responsivedesign/resize-commands.js)
content/browser/devtools/commandline.css (commandline/commandline.css)
content/browser/devtools/commandlineoutput.xhtml (commandline/commandlineoutput.xhtml)
content/browser/devtools/commandlinetooltip.xhtml (commandline/commandlinetooltip.xhtml)
content/browser/devtools/commandline/commands-index.js (commandline/commands-index.js)
content/browser/devtools/framework/toolbox-window.xul (framework/toolbox-window.xul)
content/browser/devtools/framework/toolbox-options.xul (framework/toolbox-options.xul)
content/browser/devtools/framework/toolbox-options.js (framework/toolbox-options.js)
--- a/browser/devtools/main.js
+++ b/browser/devtools/main.js
@@ -26,16 +26,17 @@ loader.lazyGetter(this, "OptionsPanel",
loader.lazyGetter(this, "InspectorPanel", () => require("devtools/inspector/inspector-panel").InspectorPanel);
loader.lazyGetter(this, "WebConsolePanel", () => require("devtools/webconsole/panel").WebConsolePanel);
loader.lazyGetter(this, "DebuggerPanel", () => require("devtools/debugger/panel").DebuggerPanel);
loader.lazyGetter(this, "StyleEditorPanel", () => require("devtools/styleeditor/styleeditor-panel").StyleEditorPanel);
loader.lazyGetter(this, "ShaderEditorPanel", () => require("devtools/shadereditor/panel").ShaderEditorPanel);
loader.lazyGetter(this, "CanvasDebuggerPanel", () => require("devtools/canvasdebugger/panel").CanvasDebuggerPanel);
loader.lazyGetter(this, "WebAudioEditorPanel", () => require("devtools/webaudioeditor/panel").WebAudioEditorPanel);
loader.lazyGetter(this, "ProfilerPanel", () => require("devtools/profiler/panel").ProfilerPanel);
+loader.lazyGetter(this, "PerformancePanel", () => require("devtools/performance/panel").PerformancePanel);
loader.lazyGetter(this, "TimelinePanel", () => require("devtools/timeline/panel").TimelinePanel);
loader.lazyGetter(this, "NetMonitorPanel", () => require("devtools/netmonitor/panel").NetMonitorPanel);
loader.lazyGetter(this, "StoragePanel", () => require("devtools/storage/panel").StoragePanel);
loader.lazyGetter(this, "ScratchpadPanel", () => require("devtools/scratchpad/scratchpad-panel").ScratchpadPanel);
// Strings
const toolboxProps = "chrome://browser/locale/devtools/toolbox.properties";
const inspectorProps = "chrome://browser/locale/devtools/inspector.properties";
@@ -269,16 +270,42 @@ Tools.jsprofiler = {
return !target.isAddon && (!target.isApp || target.form.profilerActor);
},
build: function (frame, target) {
return new ProfilerPanel(frame, target);
}
};
+Tools.performance = {
+ id: "performance",
+ ordinal: 19,
+ icon: "chrome://browser/skin/devtools/tool-profiler.svg",
+ invertIconForLightTheme: true,
+ url: "chrome://browser/content/devtools/performance.xul",
+ // TODO bug 1082695 audit the Performance tools labels
+ label: "Performance++", //l10n("profiler.label2", profilerStrings),
+ panelLabel: "Performance++", //l10n("profiler.panelLabel2", profilerStrings),
+ tooltip: l10n("profiler.tooltip2", profilerStrings),
+ accesskey: l10n("profiler.accesskey", profilerStrings),
+ key: l10n("profiler.commandkey2", profilerStrings),
+ modifiers: "shift",
+ inMenu: true,
+
+ isTargetSupported: function (target) {
+ // Hide the profiler when debugging devices pre bug 1046394,
+ // that don't expose profiler actor in content processes.
+ return !target.isAddon && (!target.isApp || target.form.profilerActor);
+ },
+
+ build: function (frame, target) {
+ return new PerformancePanel(frame, target);
+ }
+};
+
Tools.timeline = {
id: "timeline",
ordinal: 8,
visibilityswitch: "devtools.timeline.enabled",
icon: "chrome://browser/skin/devtools/tool-network.svg",
invertIconForLightTheme: true,
url: "chrome://browser/content/devtools/timeline/timeline.xul",
label: l10n("timeline.label", timelineStrings),
@@ -399,16 +426,26 @@ let defaultTools = [
Tools.webAudioEditor,
Tools.jsprofiler,
Tools.timeline,
Tools.netMonitor,
Tools.storage,
Tools.scratchpad
];
+// Only enable in-development performance tools if `--enable-devtools-perf`
+// used in build, turning on `devtools.performance_dev.enabled`.
+// Add to normal `defaultTools` when ready for normal release,
+// pull out MOZ_DEVTOOLS_PERFTOOLS setting in `./configure.in`, and
+// leave config on in `./browser/app/profile/firefox.js`, and always
+// build in `./browser/devtools/moz.build`.
+if (Services.prefs.getBoolPref("devtools.performance_dev.enabled")) {
+ defaultTools.push(Tools.performance);
+}
+
exports.defaultTools = defaultTools;
for (let definition of defaultTools) {
gDevTools.registerTool(definition);
}
Tools.darkTheme = {
id: "dark",
--- a/browser/devtools/moz.build
+++ b/browser/devtools/moz.build
@@ -28,16 +28,19 @@ DIRS += [
'styleinspector',
'tilt',
'timeline',
'webaudioeditor',
'webconsole',
'webide',
]
+if CONFIG['MOZ_DEVTOOLS_PERFTOOLS']:
+ DIRS += ['performance']
+
EXTRA_COMPONENTS += [
'devtools-clhandler.js',
'devtools-clhandler.manifest',
]
JAR_MANIFESTS += ['jar.mn']
EXTRA_JS_MODULES.devtools += [
new file mode 100644
--- /dev/null
+++ b/browser/devtools/performance/moz.build
@@ -0,0 +1,8 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+EXTRA_JS_MODULES.devtools.performance += [
+ 'panel.js'
+]
new file mode 100644
--- /dev/null
+++ b/browser/devtools/performance/panel.js
@@ -0,0 +1,62 @@
+/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+const {Cc, Ci, Cu, Cr} = require("chrome");
+
+Cu.import("resource://gre/modules/Task.jsm");
+
+loader.lazyRequireGetter(this, "promise");
+loader.lazyRequireGetter(this, "EventEmitter",
+ "devtools/toolkit/event-emitter");
+
+function PerformancePanel(iframeWindow, toolbox) {
+ this.panelWin = iframeWindow;
+ this._toolbox = toolbox;
+
+ EventEmitter.decorate(this);
+}
+
+exports.PerformancePanel = PerformancePanel;
+
+PerformancePanel.prototype = {
+ /**
+ * Open is effectively an asynchronous constructor.
+ *
+ * @return object
+ * A promise that is resolved when the Profiler completes opening.
+ */
+ open: Task.async(function*() {
+ this.panelWin.gToolbox = this._toolbox;
+ this.panelWin.gTarget = this.target;
+
+ // Mock Front for now
+ let gFront = {};
+ EventEmitter.decorate(gFront);
+ this.panelWin.gFront = gFront;
+
+ yield this.panelWin.startupPerformance();
+
+ this.isReady = true;
+ this.emit("ready");
+ return this;
+ }),
+
+ // DevToolPanel API
+
+ get target() this._toolbox.target,
+
+ destroy: Task.async(function*() {
+ // Make sure this panel is not already destroyed.
+ if (this._destroyed) {
+ return;
+ }
+
+ yield this.panelWin.shutdownPerformance();
+ this.emit("destroyed");
+ this._destroyed = true;
+ })
+};
new file mode 100644
--- /dev/null
+++ b/browser/devtools/performance/performance.js
@@ -0,0 +1,97 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
+
+Cu.import("resource://gre/modules/Task.jsm");
+Cu.import("resource://gre/modules/devtools/Loader.jsm");
+Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
+
+devtools.lazyRequireGetter(this, "Services");
+devtools.lazyRequireGetter(this, "promise");
+devtools.lazyRequireGetter(this, "EventEmitter",
+ "devtools/toolkit/event-emitter");
+devtools.lazyRequireGetter(this, "DevToolsUtils",
+ "devtools/toolkit/DevToolsUtils");
+
+/**
+ * The current target and the profiler connection, set by this tool's host.
+ */
+let gToolbox, gTarget, gFront;
+
+/**
+ * Initializes the profiler controller and views.
+ */
+let startupPerformance = Task.async(function*() {
+ yield promise.all([
+ PrefObserver.register(),
+ EventsHandler.initialize()
+ ]);
+});
+
+/**
+ * Destroys the profiler controller and views.
+ */
+let shutdownPerformance = Task.async(function*() {
+ yield promise.all([
+ PrefObserver.unregister(),
+ EventsHandler.destroy()
+ ]);
+});
+
+/**
+ * Observes pref changes on the devtools.profiler branch and triggers the
+ * required frontend modifications.
+ */
+let PrefObserver = {
+ register: function() {
+ this.branch = Services.prefs.getBranch("devtools.profiler.");
+ this.branch.addObserver("", this, false);
+ },
+ unregister: function() {
+ this.branch.removeObserver("", this);
+ },
+ observe: function(subject, topic, pref) {
+ Prefs.refresh();
+ }
+};
+
+/**
+ * Functions handling target-related lifetime events.
+ */
+let EventsHandler = {
+ /**
+ * Listen for events emitted by the current tab target.
+ */
+ initialize: function() {
+ },
+
+ /**
+ * Remove events emitted by the current tab target.
+ */
+ destroy: function() {
+ }
+};
+
+/**
+ * Shortcuts for accessing various profiler preferences.
+ */
+const Prefs = new ViewHelpers.Prefs("devtools.profiler", {
+});
+
+/**
+ * Convenient way of emitting events from the panel window.
+ */
+EventEmitter.decorate(this);
+
+/**
+ * DOM query helpers.
+ */
+function $(selector, target = document) {
+ return target.querySelector(selector);
+}
+function $$(selector, target = document) {
+ return target.querySelectorAll(selector);
+}
new file mode 100644
--- /dev/null
+++ b/browser/devtools/performance/performance.xul
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/content/devtools/widgets.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/devtools/common.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/devtools/widgets.css" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/devtools/performance.css" type="text/css"?>
+<!DOCTYPE window [
+ <!ENTITY % profilerDTD SYSTEM "chrome://browser/locale/devtools/profiler.dtd">
+ %profilerDTD;
+]>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://browser/content/devtools/theme-switching.js"/>
+ <script type="application/javascript" src="performance.js"/>
+
+ <vbox class="theme-body" flex="1">
+ <toolbar id="performance-toolbar" class="devtools-toolbar">
+ <hbox id="performance-toolbar-controls-recordings" class="devtools-toolbarbutton-group">
+ <toolbarbutton id="record-button"
+ class="devtools-toolbarbutton"
+ tooltiptext="&profilerUI.recordButton.tooltip;"/>
+ <toolbarbutton id="clear-button"
+ class="devtools-toolbarbutton"
+ label="&profilerUI.clearButton;"/>
+ </hbox>
+ <spacer flex="1"></spacer>
+ <hbox id="performance-toolbar-controls-storage" class="devtools-toolbarbutton-group">
+ <toolbarbutton id="import-button"
+ class="devtools-toolbarbutton"
+ label="&profilerUI.importButton;"/>
+ </hbox>
+ </toolbar>
+ <splitter class="devtools-horizontal-splitter" />
+ <box id="overview-pane"
+ class="devtools-responsive-container"
+ flex="1">
+ </box>
+ <splitter class="devtools-horizontal-splitter" />
+ <box id="details-pane"
+ class="devtools-responsive-container"
+ flex="1">
+ </box>
+ </vbox>
+</window>
new file mode 100644
--- /dev/null
+++ b/browser/themes/linux/devtools/performance.css
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+%include ../../shared/devtools/performance.inc.css
--- a/browser/themes/linux/jar.mn
+++ b/browser/themes/linux/jar.mn
@@ -247,16 +247,17 @@ browser.jar:
skin/classic/browser/devtools/breadcrumbs-divider@2x.png (../shared/devtools/images/breadcrumbs-divider@2x.png)
skin/classic/browser/devtools/breadcrumbs-scrollbutton.png (../shared/devtools/images/breadcrumbs-scrollbutton.png)
skin/classic/browser/devtools/breadcrumbs-scrollbutton@2x.png (../shared/devtools/images/breadcrumbs-scrollbutton@2x.png)
* skin/classic/browser/devtools/canvasdebugger.css (devtools/canvasdebugger.css)
* skin/classic/browser/devtools/debugger.css (devtools/debugger.css)
skin/classic/browser/devtools/eyedropper.css (../shared/devtools/eyedropper.css)
* skin/classic/browser/devtools/netmonitor.css (devtools/netmonitor.css)
* skin/classic/browser/devtools/profiler.css (devtools/profiler.css)
+* skin/classic/browser/devtools/performance.css (devtools/performance.css)
* skin/classic/browser/devtools/timeline.css (devtools/timeline.css)
* skin/classic/browser/devtools/scratchpad.css (devtools/scratchpad.css)
* skin/classic/browser/devtools/shadereditor.css (devtools/shadereditor.css)
* skin/classic/browser/devtools/splitview.css (../shared/devtools/splitview.css)
skin/classic/browser/devtools/styleeditor.css (../shared/devtools/styleeditor.css)
skin/classic/browser/devtools/storage.css (../shared/devtools/storage.css)
* skin/classic/browser/devtools/webaudioeditor.css (devtools/webaudioeditor.css)
skin/classic/browser/devtools/magnifying-glass.png (../shared/devtools/images/magnifying-glass.png)
new file mode 100644
--- /dev/null
+++ b/browser/themes/osx/devtools/performance.css
@@ -0,0 +1,6 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+%include ../shared.inc
+%include ../../shared/devtools/performance.inc.css
--- a/browser/themes/osx/jar.mn
+++ b/browser/themes/osx/jar.mn
@@ -377,16 +377,17 @@ browser.jar:
skin/classic/browser/devtools/breadcrumbs-divider@2x.png (../shared/devtools/images/breadcrumbs-divider@2x.png)
skin/classic/browser/devtools/breadcrumbs-scrollbutton.png (../shared/devtools/images/breadcrumbs-scrollbutton.png)
skin/classic/browser/devtools/breadcrumbs-scrollbutton@2x.png (../shared/devtools/images/breadcrumbs-scrollbutton@2x.png)
* skin/classic/browser/devtools/canvasdebugger.css (devtools/canvasdebugger.css)
* skin/classic/browser/devtools/debugger.css (devtools/debugger.css)
skin/classic/browser/devtools/eyedropper.css (../shared/devtools/eyedropper.css)
* skin/classic/browser/devtools/netmonitor.css (devtools/netmonitor.css)
* skin/classic/browser/devtools/profiler.css (devtools/profiler.css)
+* skin/classic/browser/devtools/performance.css (devtools/performance.css)
* skin/classic/browser/devtools/timeline.css (devtools/timeline.css)
* skin/classic/browser/devtools/scratchpad.css (devtools/scratchpad.css)
* skin/classic/browser/devtools/shadereditor.css (devtools/shadereditor.css)
* skin/classic/browser/devtools/splitview.css (../shared/devtools/splitview.css)
skin/classic/browser/devtools/styleeditor.css (../shared/devtools/styleeditor.css)
skin/classic/browser/devtools/storage.css (../shared/devtools/storage.css)
* skin/classic/browser/devtools/webaudioeditor.css (devtools/webaudioeditor.css)
skin/classic/browser/devtools/magnifying-glass.png (../shared/devtools/images/magnifying-glass.png)
new file mode 100644
--- /dev/null
+++ b/browser/themes/shared/devtools/performance.inc.css
@@ -0,0 +1,34 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* Toolbar */
+
+#performance-toolbar {
+ -moz-border-end: 1px solid;
+}
+
+.theme-dark #performance-toolbar > tabs,
+.theme-dark #performance-toolbar {
+ -moz-border-end-color: #000; /* Splitters */
+}
+
+.theme-light #performance-toolbar > tabs,
+.theme-light #performance-toolbar {
+ -moz-border-end-color: #aaa; /* Splitters */
+}
+
+/* Overview Panel */
+
+#record-button {
+ list-style-image: url(profiler-stopwatch.svg);
+}
+
+#record-button[checked] {
+ list-style-image: url(profiler-stopwatch-checked.svg);
+}
+
+#record-button[locked] {
+ pointer-events: none;
+}
new file mode 100644
--- /dev/null
+++ b/browser/themes/windows/devtools/performance.css
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+%include ../../shared/devtools/performance.inc.css
--- a/browser/themes/windows/jar.mn
+++ b/browser/themes/windows/jar.mn
@@ -284,16 +284,17 @@ browser.jar:
skin/classic/browser/devtools/breadcrumbs-divider@2x.png (../shared/devtools/images/breadcrumbs-divider@2x.png)
skin/classic/browser/devtools/breadcrumbs-scrollbutton.png (../shared/devtools/images/breadcrumbs-scrollbutton.png)
skin/classic/browser/devtools/breadcrumbs-scrollbutton@2x.png (../shared/devtools/images/breadcrumbs-scrollbutton@2x.png)
skin/classic/browser/devtools/eyedropper.css (../shared/devtools/eyedropper.css)
* skin/classic/browser/devtools/canvasdebugger.css (devtools/canvasdebugger.css)
* skin/classic/browser/devtools/debugger.css (devtools/debugger.css)
* skin/classic/browser/devtools/netmonitor.css (devtools/netmonitor.css)
* skin/classic/browser/devtools/profiler.css (devtools/profiler.css)
+* skin/classic/browser/devtools/performance.css (devtools/performance.css)
* skin/classic/browser/devtools/timeline.css (devtools/timeline.css)
* skin/classic/browser/devtools/scratchpad.css (devtools/scratchpad.css)
* skin/classic/browser/devtools/shadereditor.css (devtools/shadereditor.css)
skin/classic/browser/devtools/storage.css (../shared/devtools/storage.css)
* skin/classic/browser/devtools/splitview.css (../shared/devtools/splitview.css)
skin/classic/browser/devtools/styleeditor.css (../shared/devtools/styleeditor.css)
* skin/classic/browser/devtools/webaudioeditor.css (devtools/webaudioeditor.css)
skin/classic/browser/devtools/magnifying-glass.png (../shared/devtools/images/magnifying-glass.png)
--- a/configure.in
+++ b/configure.in
@@ -7705,16 +7705,29 @@ fi
if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
fi
dnl =========================================================
+dnl Enable support for revamped devtools Performance Tools
+dnl =========================================================
+
+MOZ_ARG_ENABLE_BOOL(devtools-perf,
+[ --enable-devtools-perf Set compile flags necessary for compiling devtools perftools],
+MOZ_DEVTOOLS_PERFTOOLS=1,
+MOZ_DEVTOOLS_PERFTOOLS= )
+if test -n "$MOZ_DEVTOOLS_PERFTOOLS"; then
+ AC_DEFINE(MOZ_DEVTOOLS_PERFTOOLS)
+fi
+AC_SUBST(MOZ_DEVTOOLS_PERFTOOLS)
+
+dnl =========================================================
dnl Omnijar packaging (bug 552121)
dnl =========================================================
dnl Omnijar packaging is compatible with flat packaging.
dnl In unpackaged builds, omnijar looks for files as if
dnl things were flat packaged. After packaging, all files
dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
dnl is set to flat since putting files into jars is only
dnl done during packaging with omnijar.