Bug 1077441 - create empty performance tool under build flag. r=vp

This commit is contained in:
Jordan Santell 2014-10-15 09:46:00 +02:00
parent 527c05ba02
commit 611b873bd3
16 changed files with 331 additions and 0 deletions

View File

@ -1380,6 +1380,13 @@ pref("devtools.debugger.ui.variables-searchbox-visible", false);
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);

View File

@ -86,6 +86,10 @@ browser.jar:
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)

View File

@ -31,6 +31,7 @@ loader.lazyGetter(this, "ShaderEditorPanel", () => require("devtools/shaderedito
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);
@ -274,6 +275,32 @@ Tools.jsprofiler = {
}
};
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,
@ -404,6 +431,16 @@ let defaultTools = [
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) {

View File

@ -33,6 +33,9 @@ DIRS += [
'webide',
]
if CONFIG['MOZ_DEVTOOLS_PERFTOOLS']:
DIRS += ['performance']
EXTRA_COMPONENTS += [
'devtools-clhandler.js',
'devtools-clhandler.manifest',

View File

@ -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'
]

View File

@ -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;
})
};

View File

@ -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);
}

View File

@ -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>

View File

@ -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

View File

@ -252,6 +252,7 @@ browser.jar:
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)

View File

@ -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

View File

@ -382,6 +382,7 @@ browser.jar:
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)

View File

@ -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;
}

View File

@ -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

View File

@ -289,6 +289,7 @@ browser.jar:
* 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)

View File

@ -7709,6 +7709,19 @@ if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
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 =========================================================