Diff
Modified: trunk/Source/WebCore/ChangeLog (140677 => 140678)
--- trunk/Source/WebCore/ChangeLog 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/ChangeLog 2013-01-24 13:42:53 UTC (rev 140678)
@@ -1,3 +1,55 @@
+2013-01-23 Andrey Adaikin <[email protected]>
+
+ Web Inspector: [Canvas] UI: add a selector to capture a single canvas frame vs consecutive frames
+ https://bugs.webkit.org/show_bug.cgi?id=107688
+
+ Reviewed by Pavel Feldman.
+
+ Allow capturing several canvas frames in a row.
+
+ * English.lproj/localizedStrings.js:
+ * inspector/InjectedScriptCanvasModule.cpp:
+ (WebCore::InjectedScriptCanvasModule::traceLog):
+ * inspector/InjectedScriptCanvasModule.h:
+ (InjectedScriptCanvasModule):
+ * inspector/InjectedScriptCanvasModuleSource.js:
+ (.):
+ * inspector/Inspector.json:
+ * inspector/InspectorCanvasAgent.cpp:
+ (WebCore::InspectorCanvasAgent::getTraceLog):
+ * inspector/InspectorCanvasAgent.h:
+ (InspectorCanvasAgent):
+ * inspector/front-end/CanvasProfileView.js:
+ (WebInspector.CanvasProfileView):
+ (WebInspector.CanvasProfileView.prototype._didReceiveTraceLog):
+ (WebInspector.CanvasProfileView.prototype._requestTraceLog):
+ (WebInspector.CanvasProfileType):
+ (WebInspector.CanvasProfileType.prototype.get statusBarItems):
+ (WebInspector.CanvasProfileType.prototype.get buttonTooltip):
+ (WebInspector.CanvasProfileType.prototype.buttonClicked):
+ (WebInspector.CanvasProfileType.prototype._runSingleFrameCapturing):
+ (WebInspector.CanvasProfileType.prototype._startFrameCapturing):
+ (WebInspector.CanvasProfileType.prototype._stopFrameCapturing.didStopCapturing):
+ (WebInspector.CanvasProfileType.prototype._stopFrameCapturing):
+ (WebInspector.CanvasProfileType.prototype._didStartCapturingFrame):
+ (WebInspector.CanvasProfileType.prototype.setRecordingProfile):
+ (WebInspector.CanvasProfileType.prototype._isSingleFrameMode):
+ (WebInspector.CanvasProfileHeader):
+ (WebInspector.CanvasProfileHeader.prototype._updateCapturingStatus):
+ (WebInspector.CanvasProfileHeader.prototype._requestCapturingStatus):
+ * inspector/front-end/ProfileLauncherView.js:
+ (WebInspector.ProfileLauncherView):
+ * inspector/front-end/ProfilesPanel.js:
+ (WebInspector.ProfileType.prototype.get statusBarItems):
+ (WebInspector.ProfilesPanel):
+ (WebInspector.ProfilesPanel.prototype.get statusBarItems):
+ (WebInspector.ProfilesPanel.prototype._onProfileTypeSelected):
+ (WebInspector.ProfilesPanel.prototype._reset):
+ (WebInspector.ProfilesPanel.prototype._showLauncherView):
+ (WebInspector.ProfilesPanel.prototype.showProfile):
+ (WebInspector.ProfilesPanel.prototype._updateInterface):
+ (WebInspector.ProfilesPanel.prototype._resize):
+
2013-01-24 Andreas Kling <[email protected]>
Add CSSSelectorList::isValid().
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (140677 => 140678)
--- trunk/Source/WebCore/English.lproj/localizedStrings.js 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js 2013-01-24 13:42:53 UTC (rev 140678)
@@ -774,11 +774,15 @@
localizedStrings["Drag"] = "Drag";
localizedStrings["Toggle breakpoint"] = "Toggle breakpoint";
localizedStrings["Capture Canvas Frame"] = "Capture Canvas Frame";
-localizedStrings["Capture Canvas Frame."] = "Capture Canvas Frame.";
+localizedStrings["Capture next canvas frame."] = "Capture next canvas frame.";
+localizedStrings["Stop capturing canvas frames."] = "Stop capturing canvas frames.";
+localizedStrings["Start capturing canvas frames."] = "Start capturing canvas frames.";
localizedStrings["Trace Log %d"] = "Trace Log %d";
localizedStrings["CANVAS PROFILE"] = "CANVAS PROFILE";
localizedStrings["Canvas calls instrumentation"] = "Canvas calls instrumentation";
localizedStrings["Capturing\u2026"] = "Capturing\u2026";
+localizedStrings["Capturing\u2026 %d calls"] = "Capturing\u2026 %d calls";
+localizedStrings["Captured %d calls"] = "Captured %d calls";
localizedStrings["There is an uninstrumented canvas on the page. Reload the page to instrument it."] = "There is an uninstrumented canvas on the page. Reload the page to instrument it.";
localizedStrings["First call."] = "First call.";
localizedStrings["Previous call."] = "Previous call.";
Modified: trunk/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp (140677 => 140678)
--- trunk/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp 2013-01-24 13:42:53 UTC (rev 140678)
@@ -124,12 +124,14 @@
*errorString = "Internal error: " + functionName;
}
-void InjectedScriptCanvasModule::traceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, RefPtr<TypeBuilder::Canvas::TraceLog>* traceLog)
+void InjectedScriptCanvasModule::traceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, const int* maxLength, RefPtr<TypeBuilder::Canvas::TraceLog>* traceLog)
{
ScriptFunctionCall function(injectedScriptObject(), "traceLog");
function.appendArgument(traceLogId);
if (startOffset)
function.appendArgument(*startOffset);
+ if (maxLength)
+ function.appendArgument(*maxLength);
RefPtr<InspectorValue> resultValue;
makeCall(function, &resultValue);
if (!resultValue || resultValue->type() != InspectorValue::TypeObject) {
Modified: trunk/Source/WebCore/inspector/InjectedScriptCanvasModule.h (140677 => 140678)
--- trunk/Source/WebCore/inspector/InjectedScriptCanvasModule.h 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/inspector/InjectedScriptCanvasModule.h 2013-01-24 13:42:53 UTC (rev 140678)
@@ -59,7 +59,7 @@
void startCapturing(ErrorString*, String*);
void stopCapturing(ErrorString*, const String&);
void dropTraceLog(ErrorString*, const String&);
- void traceLog(ErrorString*, const String&, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>*);
+ void traceLog(ErrorString*, const String&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>*);
void replayTraceLog(ErrorString*, const String&, int, RefPtr<TypeBuilder::Canvas::ResourceState>*);
void resourceInfo(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::ResourceInfo>*);
void resourceState(ErrorString*, const String&, const String&, RefPtr<TypeBuilder::Canvas::ResourceState>*);
Modified: trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js (140677 => 140678)
--- trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js 2013-01-24 13:42:53 UTC (rev 140678)
@@ -3053,25 +3053,35 @@
/**
* @param {CanvasAgent.TraceLogId} id
* @param {number=} startOffset
+ * @param {number=} maxLength
* @return {!CanvasAgent.TraceLog|string}
*/
- traceLog: function(id, startOffset)
+ traceLog: function(id, startOffset, maxLength)
{
var traceLog = this._traceLogs[id];
if (!traceLog)
return "Error: Trace log with the given ID not found.";
- startOffset = Math.max(0, startOffset || 0);
+
+ var replayableCalls = traceLog.replayableCalls();
+ if (typeof startOffset !== "number")
+ startOffset = 0;
+ if (typeof maxLength !== "number")
+ maxLength = replayableCalls.length;
+
+ var fromIndex = Math.max(0, startOffset);
+ var toIndex = Math.min(replayableCalls.length - 1, fromIndex + maxLength - 1);
+
var alive = this._manager.capturing() && this._manager.lastTraceLog() === traceLog;
var result = {
id: id,
/** @type {Array.<CanvasAgent.Call>} */
calls: [],
alive: alive,
- startOffset: startOffset
+ startOffset: fromIndex,
+ totalAvailableCalls: replayableCalls.length
};
- var calls = traceLog.replayableCalls();
- for (var i = startOffset, n = calls.length; i < n; ++i) {
- var call = calls[i];
+ for (var i = fromIndex; i <= toIndex; ++i) {
+ var call = replayableCalls[i];
var contextResource = call.replayableResource().replayableContextResource();
var stackTrace = call.stackTrace();
var callFrame = stackTrace ? stackTrace.callFrame(0) || {} : {};
Modified: trunk/Source/WebCore/inspector/Inspector.json (140677 => 140678)
--- trunk/Source/WebCore/inspector/Inspector.json 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/inspector/Inspector.json 2013-01-24 13:42:53 UTC (rev 140678)
@@ -3282,8 +3282,9 @@
"properties": [
{ "name": "id", "$ref": "TraceLogId" },
{ "name": "calls", "type": "array", "items": { "$ref": "Call" } },
- { "name": "startOffset", "type": "integer", "optional": true },
- { "name": "alive", "type": "boolean", "optional": true }
+ { "name": "startOffset", "type": "integer" },
+ { "name": "alive", "type": "boolean" },
+ { "name": "totalAvailableCalls", "type": "number" }
]
}
],
@@ -3331,7 +3332,8 @@
"name": "getTraceLog",
"parameters": [
{ "name": "traceLogId", "$ref": "TraceLogId" },
- { "name": "startOffset", "type": "integer", "optional": true }
+ { "name": "startOffset", "type": "integer", "optional": true },
+ { "name": "maxLength", "type": "integer", "optional": true }
],
"returns": [
{ "name": "traceLog", "$ref": "TraceLog" }
Modified: trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp (140677 => 140678)
--- trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/inspector/InspectorCanvasAgent.cpp 2013-01-24 13:42:53 UTC (rev 140678)
@@ -155,13 +155,13 @@
module.stopCapturing(errorString, traceLogId);
}
-void InspectorCanvasAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, RefPtr<TypeBuilder::Canvas::TraceLog>& traceLog)
+void InspectorCanvasAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, const int* maxLength, RefPtr<TypeBuilder::Canvas::TraceLog>& traceLog)
{
if (!checkIsEnabled(errorString))
return;
InjectedScriptCanvasModule module = injectedScriptCanvasModuleForTraceLogId(errorString, traceLogId);
if (!module.hasNoValue())
- module.traceLog(errorString, traceLogId, startOffset, &traceLog);
+ module.traceLog(errorString, traceLogId, startOffset, maxLength, &traceLog);
}
void InspectorCanvasAgent::replayTraceLog(ErrorString* errorString, const String& traceLogId, int stepNo, RefPtr<TypeBuilder::Canvas::ResourceState>& result)
Modified: trunk/Source/WebCore/inspector/InspectorCanvasAgent.h (140677 => 140678)
--- trunk/Source/WebCore/inspector/InspectorCanvasAgent.h 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/inspector/InspectorCanvasAgent.h 2013-01-24 13:42:53 UTC (rev 140678)
@@ -83,7 +83,7 @@
virtual void captureFrame(ErrorString*, String*);
virtual void startCapturing(ErrorString*, String*);
virtual void stopCapturing(ErrorString*, const String&);
- virtual void getTraceLog(ErrorString*, const String&, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&);
+ virtual void getTraceLog(ErrorString*, const String&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&);
virtual void replayTraceLog(ErrorString*, const String&, int, RefPtr<TypeBuilder::Canvas::ResourceState>&);
virtual void getResourceInfo(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::ResourceInfo>&);
virtual void getResourceState(ErrorString*, const String&, const String&, RefPtr<TypeBuilder::Canvas::ResourceState>&);
Modified: trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js (140677 => 140678)
--- trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js 2013-01-24 13:42:53 UTC (rev 140678)
@@ -31,6 +31,7 @@
/**
* @constructor
* @extends {WebInspector.View}
+ * @param {!WebInspector.CanvasProfileHeader} profile
*/
WebInspector.CanvasProfileView = function(profile)
{
@@ -88,11 +89,15 @@
this._logGridNodes = [];
this._splitView.show(this.element);
-
- this._enableWaitIcon(true);
- CanvasAgent.getTraceLog(this._traceLogId, 0, this._didReceiveTraceLog.bind(this));
+ this._requestTraceLog();
}
+/**
+ * @const
+ * @type {number}
+ */
+WebInspector.CanvasProfileView.TraceLogPollingInterval = 500;
+
WebInspector.CanvasProfileView.prototype = {
dispose: function()
{
@@ -283,14 +288,24 @@
for (var i = 0, n = calls.length; i < n; ++i) {
var call = calls[i];
this._requestReplayContextInfo(call.contextId);
- var gridNode = this._createCallNode(i, call);
+ var index = traceLog.startOffset + i;
+ var gridNode = this._createCallNode(index, call);
this._logGrid.rootNode().appendChild(gridNode);
lastNode = gridNode;
}
if (lastNode)
lastNode.revealAndSelect();
+ if (traceLog.alive)
+ setTimeout(this._requestTraceLog.bind(this), WebInspector.CanvasProfileView.TraceLogPollingInterval);
+ this._profile._updateCapturingStatus(traceLog);
},
+ _requestTraceLog: function()
+ {
+ this._enableWaitIcon(true);
+ CanvasAgent.getTraceLog(this._traceLogId, this._logGridNodes.length, undefined, this._didReceiveTraceLog.bind(this));
+ },
+
/**
* @param {string} contextId
*/
@@ -362,7 +377,14 @@
{
WebInspector.ProfileType.call(this, WebInspector.CanvasProfileType.TypeId, WebInspector.UIString("Capture Canvas Frame"));
this._nextProfileUid = 1;
+ this._recording = false;
+ this._lastProfileHeader = null;
+ this._capturingModeSelector = new WebInspector.StatusBarComboBox(null);
+ this._capturingModeSelector.element.title = WebInspector.UIString("Canvas capture mode.");
+ this._capturingModeSelector.createOption(WebInspector.UIString("Single Frame"), WebInspector.UIString("Capture a single canvas frame."), "");
+ this._capturingModeSelector.createOption(WebInspector.UIString("Consecutive Frames"), WebInspector.UIString("Capture consecutive canvas frames."), "1");
+
this._decorationElement = document.createElement("div");
this._decorationElement.addStyleClass("profile-canvas-decoration");
this._decorationElement.addStyleClass("hidden");
@@ -380,9 +402,17 @@
WebInspector.CanvasProfileType.TypeId = "CANVAS_PROFILE";
WebInspector.CanvasProfileType.prototype = {
+ get statusBarItems()
+ {
+ return [this._capturingModeSelector.element];
+ },
+
get buttonTooltip()
{
- return WebInspector.UIString("Capture Canvas Frame.");
+ if (this._isSingleFrameMode())
+ return WebInspector.UIString("Capture next canvas frame.");
+ else
+ return this._recording ? WebInspector.UIString("Stop capturing canvas frames.") : WebInspector.UIString("Start capturing canvas frames.");
},
/**
@@ -392,19 +422,66 @@
*/
buttonClicked: function(profilesPanel)
{
- var profileHeader = new WebInspector.CanvasProfileHeader(this, WebInspector.UIString("Trace Log %d", this._nextProfileUid), this._nextProfileUid);
- ++this._nextProfileUid;
- profileHeader.isTemporary = true;
- profilesPanel.addProfileHeader(profileHeader);
- function didStartCapturingFrame(error, traceLogId)
+ if (this._recording) {
+ this._recording = false;
+ this._stopFrameCapturing();
+ } else if (this._isSingleFrameMode()) {
+ this._recording = false;
+ this._runSingleFrameCapturing(profilesPanel);
+ } else {
+ this._recording = true;
+ this._startFrameCapturing(profilesPanel);
+ }
+ profilesPanel.setRecordingProfile(WebInspector.CanvasProfileType.TypeId, this._recording);
+ return this._recording;
+ },
+
+ /**
+ * @param {WebInspector.ProfilesPanel} profilesPanel
+ */
+ _runSingleFrameCapturing: function(profilesPanel)
+ {
+ CanvasAgent.captureFrame(this._didStartCapturingFrame.bind(this, profilesPanel));
+ },
+
+ /**
+ * @param {WebInspector.ProfilesPanel} profilesPanel
+ */
+ _startFrameCapturing: function(profilesPanel)
+ {
+ CanvasAgent.startCapturing(this._didStartCapturingFrame.bind(this, profilesPanel));
+ },
+
+ _stopFrameCapturing: function()
+ {
+ if (!this._lastProfileHeader)
+ return;
+ var profileHeader = this._lastProfileHeader;
+ var traceLogId = profileHeader.traceLogId();
+ this._lastProfileHeader = null;
+ function didStopCapturing()
{
- profileHeader._traceLogId = traceLogId;
- profileHeader.isTemporary = false;
+ profileHeader._updateCapturingStatus();
}
- CanvasAgent.captureFrame(didStartCapturingFrame.bind(this));
- return false;
+ CanvasAgent.stopCapturing(traceLogId, didStopCapturing.bind(this));
},
+ /**
+ * @param {WebInspector.ProfilesPanel} profilesPanel
+ * @param {?Protocol.Error} error
+ * @param {CanvasAgent.TraceLogId} traceLogId
+ */
+ _didStartCapturingFrame: function(profilesPanel, error, traceLogId)
+ {
+ if (error || this._lastProfileHeader && this._lastProfileHeader.traceLogId() === traceLogId)
+ return;
+ var profileHeader = new WebInspector.CanvasProfileHeader(this, WebInspector.UIString("Trace Log %d", this._nextProfileUid), this._nextProfileUid, traceLogId);
+ ++this._nextProfileUid;
+ this._lastProfileHeader = profileHeader;
+ profilesPanel.addProfileHeader(profileHeader);
+ profileHeader._updateCapturingStatus();
+ },
+
get treeItemTitle()
{
return WebInspector.UIString("CANVAS PROFILE");
@@ -432,6 +509,11 @@
this._nextProfileUid = 1;
},
+ setRecordingProfile: function(isProfiling)
+ {
+ this._recording = isProfiling;
+ },
+
/**
* @override
* @param {string=} title
@@ -455,6 +537,10 @@
_updateDecorationElement: function()
{
+ /**
+ * @param {?Protocol.Error} error
+ * @param {boolean} result
+ */
function callback(error, result)
{
var hideWarning = (error || !result);
@@ -471,6 +557,14 @@
PageAgent.reload(event.shiftKey);
},
+ /**
+ * @return {boolean}
+ */
+ _isSingleFrameMode: function()
+ {
+ return !this._capturingModeSelector.selectedOption().value;
+ },
+
__proto__: WebInspector.ProfileType.prototype
}
@@ -480,20 +574,20 @@
* @param {!WebInspector.CanvasProfileType} type
* @param {string} title
* @param {number=} uid
+ * @param {CanvasAgent.TraceLogId=} traceLogId
*/
-WebInspector.CanvasProfileHeader = function(type, title, uid)
+WebInspector.CanvasProfileHeader = function(type, title, uid, traceLogId)
{
WebInspector.ProfileHeader.call(this, type, title, uid);
-
- /**
- * @type {string?}
- */
- this._traceLogId = null;
+ /** @type {CanvasAgent.TraceLogId} */
+ this._traceLogId = traceLogId || "";
+ this._alive = true;
+ this._traceLogSize = 0;
}
WebInspector.CanvasProfileHeader.prototype = {
/**
- * @return {string?}
+ * @return {CanvasAgent.TraceLogId}
*/
traceLogId: function()
{
@@ -517,5 +611,44 @@
return new WebInspector.CanvasProfileView(this);
},
+ /**
+ * @param {CanvasAgent.TraceLog=} traceLog
+ */
+ _updateCapturingStatus: function(traceLog)
+ {
+ if (!this.sidebarElement || !this._traceLogId)
+ return;
+
+ if (traceLog) {
+ this._alive = traceLog.alive;
+ this._traceLogSize = traceLog.totalAvailableCalls;
+ }
+
+ this.sidebarElement.subtitle = this._alive ? WebInspector.UIString("Capturing\u2026 %d calls", this._traceLogSize) : WebInspector.UIString("Captured %d calls", this._traceLogSize);
+ this.sidebarElement.wait = this._alive;
+
+ if (this._alive) {
+ clearTimeout(this._requestStatusTimer);
+ this._requestStatusTimer = setTimeout(this._requestCapturingStatus.bind(this), WebInspector.CanvasProfileView.TraceLogPollingInterval);
+ }
+ },
+
+ _requestCapturingStatus: function()
+ {
+ /**
+ * @param {?Protocol.Error} error
+ * @param {CanvasAgent.TraceLog} traceLog
+ */
+ function didReceiveTraceLog(error, traceLog)
+ {
+ if (error)
+ return;
+ this._alive = traceLog.alive;
+ this._traceLogSize = traceLog.totalAvailableCalls;
+ this._updateCapturingStatus();
+ }
+ CanvasAgent.getTraceLog(this._traceLogId, 0, 0, didReceiveTraceLog.bind(this));
+ },
+
__proto__: WebInspector.ProfileHeader.prototype
}
Modified: trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js (140677 => 140678)
--- trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js 2013-01-24 13:42:53 UTC (rev 140678)
@@ -42,9 +42,7 @@
this.element.addStyleClass("profile-launcher-view");
this.element.addStyleClass("panel-enabler-view");
- this._contentElement = document.createElement("div");
- this._contentElement.className = "profile-launcher-view-content";
- this.element.appendChild(this._contentElement);
+ this._contentElement = this.element.createChild("div", "profile-launcher-view-content");
var header = this._contentElement.createChild("h1");
header.textContent = WebInspector.UIString("Select profiling type");
@@ -52,8 +50,7 @@
this._profileTypeSelectorForm = this._contentElement.createChild("form");
if (WebInspector.experimentsSettings.liveNativeMemoryChart.isEnabled()) {
- this._nativeMemoryElement = document.createElement("div");
- this._contentElement.appendChild(this._nativeMemoryElement);
+ this._nativeMemoryElement = this._contentElement.createChild("div");
this._nativeMemoryLiveChart = new WebInspector.NativeMemoryBarChart();
this._nativeMemoryLiveChart.show(this._nativeMemoryElement);
}
Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (140677 => 140678)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2013-01-24 13:14:04 UTC (rev 140677)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2013-01-24 13:42:53 UTC (rev 140678)
@@ -41,6 +41,11 @@
}
WebInspector.ProfileType.prototype = {
+ get statusBarItems()
+ {
+ return [];
+ },
+
get buttonTooltip()
{
return "";
@@ -246,9 +251,12 @@
this._statusBarButtons.push(this.garbageCollectButton);
}
- this.profileViewStatusBarItemsContainer = document.createElement("div");
- this.profileViewStatusBarItemsContainer.className = "status-bar-items";
+ this._profileTypeStatusBarItemsContainer = document.createElement("div");
+ this._profileTypeStatusBarItemsContainer.className = "status-bar-items";
+ this._profileViewStatusBarItemsContainer = document.createElement("div");
+ this._profileViewStatusBarItemsContainer.className = "status-bar-items";
+
this._profiles = [];
this._profilerEnabled = !Capabilities.profilerCausesRecompilation;
@@ -311,7 +319,7 @@
get statusBarItems()
{
- return this._statusBarButtons.select("element").concat([this.profileViewStatusBarItemsContainer]);
+ return this._statusBarButtons.select("element").concat(this._profileTypeStatusBarItemsContainer, this._profileViewStatusBarItemsContainer);
},
toggleRecordButton: function()
@@ -359,6 +367,14 @@
{
this._selectedProfileType = /** @type {!WebInspector.ProfileType} */ (event.data);
this.recordButton.title = this._selectedProfileType.buttonTooltip;
+
+ this._profileTypeStatusBarItemsContainer.removeChildren();
+ var statusBarItems = this._selectedProfileType.statusBarItems;
+ if (statusBarItems) {
+ for (var i = 0; i < statusBarItems.length; ++i)
+ this._profileTypeStatusBarItemsContainer.appendChild(statusBarItems[i]);
+ }
+ this._resize(this.splitView.sidebarWidth());
},
_reset: function()
@@ -399,7 +415,7 @@
this.sidebarTreeElement.removeStyleClass("some-expandable");
this.profileViews.removeChildren();
- this.profileViewStatusBarItemsContainer.removeChildren();
+ this._profileViewStatusBarItemsContainer.removeChildren();
this.removeAllListeners();
@@ -411,7 +427,7 @@
_showLauncherView: function()
{
this.closeVisibleView();
- this.profileViewStatusBarItemsContainer.removeChildren();
+ this._profileViewStatusBarItemsContainer.removeChildren();
this._launcherView.show(this.splitView.mainElement);
this.visibleView = this._launcherView;
},
@@ -606,12 +622,12 @@
this.visibleView = view;
- this.profileViewStatusBarItemsContainer.removeChildren();
+ this._profileViewStatusBarItemsContainer.removeChildren();
var statusBarItems = view.statusBarItems;
if (statusBarItems)
for (var i = 0; i < statusBarItems.length; ++i)
- this.profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
+ this._profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
},
/**
@@ -975,14 +991,14 @@
this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable.");
this.enableToggleButton.toggled = true;
this.recordButton.visible = true;
- this.profileViewStatusBarItemsContainer.removeStyleClass("hidden");
+ this._profileViewStatusBarItemsContainer.removeStyleClass("hidden");
this.clearResultsButton.element.removeStyleClass("hidden");
this.panelEnablerView.detach();
} else {
this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable.");
this.enableToggleButton.toggled = false;
this.recordButton.visible = false;
- this.profileViewStatusBarItemsContainer.addStyleClass("hidden");
+ this._profileViewStatusBarItemsContainer.addStyleClass("hidden");
this.clearResultsButton.element.addStyleClass("hidden");
this.panelEnablerView.show(this.element);
}
@@ -1074,8 +1090,10 @@
_resize: function(sidebarWidth)
{
var lastItemElement = this._statusBarButtons[this._statusBarButtons.length - 1].element;
- var minFloatingStatusBarItemsOffset = lastItemElement.totalOffsetLeft() + lastItemElement.offsetWidth;
- this.profileViewStatusBarItemsContainer.style.left = Math.max(minFloatingStatusBarItemsOffset, sidebarWidth) + "px";
+ var left = lastItemElement.totalOffsetLeft() + lastItemElement.offsetWidth;
+ this._profileTypeStatusBarItemsContainer.style.left = left + "px";
+ left += this._profileTypeStatusBarItemsContainer.offsetWidth - 1;
+ this._profileViewStatusBarItemsContainer.style.left = Math.max(left, sidebarWidth) + "px";
},
/**