| Index: Source/devtools/front_end/layers/PaintProfilerView.js
|
| diff --git a/Source/devtools/front_end/layers/PaintProfilerView.js b/Source/devtools/front_end/layers/PaintProfilerView.js
|
| index 99282c122866e40842b2eb1140e0a5aa78637702..e78d17e6ad4e90ba714298f5a532379d0aedd838 100644
|
| --- a/Source/devtools/front_end/layers/PaintProfilerView.js
|
| +++ b/Source/devtools/front_end/layers/PaintProfilerView.js
|
| @@ -32,19 +32,20 @@
|
| * @constructor
|
| * @param {!WebInspector.LayerTreeModel} model
|
| * @param {!WebInspector.Layers3DView} layers3DView
|
| - * @extends {WebInspector.VBox}
|
| + * @extends {WebInspector.PanelWithSidebarTree}
|
| */
|
| WebInspector.PaintProfilerView = function(model, layers3DView)
|
| {
|
| - WebInspector.VBox.call(this);
|
| - this.element.classList.add("paint-profiler-view");
|
| + WebInspector.PanelWithSidebarTree.call(this, "paint-profiler-view", 225);
|
| + this.sidebarElement().classList.add("outline-disclosure");
|
| + this._panelSplitView.addEventListener(WebInspector.SplitView.Events.SidebarSizeChanged, this.onResize, this);
|
|
|
| this._model = model;
|
| this._layers3DView = layers3DView;
|
|
|
| - this._canvas = this.element.createChild("canvas", "fill");
|
| + this._canvas = this.mainElement().createChild("canvas", "fill");
|
| this._context = this._canvas.getContext("2d");
|
| - this._selectionWindow = new WebInspector.OverviewGrid.Window(this.element, this.element);
|
| + this._selectionWindow = new WebInspector.OverviewGrid.Window(this.mainElement(), this.mainElement());
|
| this._selectionWindow.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged, this._onWindowChanged, this);
|
|
|
| this._innerBarWidth = 4 * window.devicePixelRatio;
|
| @@ -63,8 +64,8 @@ WebInspector.PaintProfilerView.prototype = {
|
|
|
| _update: function()
|
| {
|
| - this._canvas.width = this.element.clientWidth * window.devicePixelRatio;
|
| - this._canvas.height = this.element.clientHeight * window.devicePixelRatio;
|
| + this._canvas.width = this.mainElement().clientWidth * window.devicePixelRatio;
|
| + this._canvas.height = this.mainElement().clientHeight * window.devicePixelRatio;
|
| this._samplesPerBar = 0;
|
| if (!this._profiles || !this._profiles.length)
|
| return;
|
| @@ -130,6 +131,16 @@ WebInspector.PaintProfilerView.prototype = {
|
| var stepLeft = Math.max(0, barLeft * this._samplesPerBar);
|
| var stepRight = Math.min(barRight * this._samplesPerBar, this._profiles[0].length);
|
| this._snapshot.requestImage(stepLeft, stepRight, this._layers3DView.showImageForLayer.bind(this._layers3DView, this._layer));
|
| + this._snapshot.commandLog(stepLeft, stepRight, this._updateLog.bind(this));
|
| + },
|
| +
|
| + _updateLog: function(log)
|
| + {
|
| + this.sidebarTree.removeChildren();
|
| + for (var i = 0; i < log.length; ++i) {
|
| + var node = new WebInspector.LogTreeElement(log[i]);
|
| + this.sidebarTree.appendChild(node);
|
| + }
|
| },
|
|
|
| _reset: function()
|
| @@ -161,19 +172,91 @@ WebInspector.PaintProfilerView.prototype = {
|
| return;
|
| }
|
| snapshot.requestImage(null, null, this._layers3DView.showImageForLayer.bind(this._layers3DView, this._layer));
|
| - snapshot.profile(onProfileDone.bind(this));
|
| + snapshot.profile(onProfileDone.bind(this, snapshot));
|
| }
|
|
|
| /**
|
| + * @param {!WebInspector.PaintProfilerSnapshot=} snapshot
|
| * @param {!Array.<!LayerTreeAgent.PaintProfile>=} profiles
|
| * @this {WebInspector.PaintProfilerView}
|
| */
|
| - function onProfileDone(profiles)
|
| + function onProfileDone(snapshot, profiles)
|
| {
|
| this._profiles = profiles;
|
| + snapshot.commandLog(null, null, onCommandLogDone.bind(this));
|
| + }
|
| +
|
| + /**
|
| + * @param {!Array.<!Object>=} log
|
| + * @this {WebInspector.PaintProfilerView}
|
| + */
|
| + function onCommandLogDone(log)
|
| + {
|
| + this._updateLog(log);
|
| this._update();
|
| }
|
| },
|
|
|
| - __proto__: WebInspector.VBox.prototype
|
| + __proto__: WebInspector.PanelWithSidebarTree.prototype
|
| +};
|
| +
|
| +/**
|
| + * @constructor
|
| + * @param {!Object} logItem
|
| + * @extends {TreeElement}
|
| + */
|
| +WebInspector.LogTreeElement = function(logItem)
|
| +{
|
| + TreeElement.call(this, "", logItem);
|
| + this._update();
|
| +}
|
| +
|
| +WebInspector.LogTreeElement.prototype = {
|
| + /**
|
| + * @param {!Object} param
|
| + * @param {string} name
|
| + * @return {string}
|
| + */
|
| + _paramToString: function(param, name)
|
| + {
|
| + if (typeof param !== "object")
|
| + return typeof param === "string" && param.length > 100 ? name : JSON.stringify(param);
|
| + var str = "";
|
| + var keyCount = 0;
|
| + for (var key in param) {
|
| + if (++keyCount > 4 || typeof param[key] === "object" || (typeof param[key] === "string" && param[key].length > 100))
|
| + return name;
|
| + if (str)
|
| + str += ", ";
|
| + str += param[key];
|
| + }
|
| + return str;
|
| + },
|
| +
|
| + /**
|
| + * @param {!Object} params
|
| + * @return {string}
|
| + */
|
| + _paramsToString: function(params)
|
| + {
|
| + var str = "";
|
| + for (var key in params) {
|
| + if (str)
|
| + str += ", ";
|
| + str += this._paramToString(params[key], key);
|
| + }
|
| + return str;
|
| + },
|
| +
|
| + _update: function()
|
| + {
|
| + var logItem = (this.representedObject);
|
| + var title = document.createDocumentFragment();
|
| + title.textContent = logItem.method;
|
| + if (logItem.params)
|
| + title.textContent += "(" + this._paramsToString(logItem.params) + ")";
|
| + this.title = title;
|
| + },
|
| +
|
| + __proto__: TreeElement.prototype
|
| };
|
|
|