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

Unified Diff: Source/devtools/front_end/timeline/TimelineFlameChart.js

Issue 1293903002: DevTools: Nuke timeline costly functions flamechart experiment (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update the test Created 5 years, 4 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/front_end/main/Main.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TimelineFlameChart.js
diff --git a/Source/devtools/front_end/timeline/TimelineFlameChart.js b/Source/devtools/front_end/timeline/TimelineFlameChart.js
index c71740310b8eeccd13e29dc3b298e73b8947ce1e..2e9073c84e0a2aa447e05ee5f7ea34d8a1ddbc8e 100644
--- a/Source/devtools/front_end/timeline/TimelineFlameChart.js
+++ b/Source/devtools/front_end/timeline/TimelineFlameChart.js
@@ -1002,167 +1002,6 @@ WebInspector.TimelineFlameChartNetworkDataProvider.prototype = {
/**
* @constructor
- * @extends {WebInspector.TimelineFlameChartDataProviderBase}
- * @param {!WebInspector.TimelineModel} model
- */
-WebInspector.TimelineFlameChartBottomUpDataProvider = function(model)
-{
- WebInspector.TimelineFlameChartDataProviderBase.call(this, model);
-}
-
-WebInspector.TimelineFlameChartBottomUpDataProvider.prototype = {
- /**
- * @override
- * @return {!WebInspector.FlameChart.TimelineData}
- */
- timelineData: function()
- {
- if (this._timelineData)
- return this._timelineData;
- this._entries = [];
- this._timelineData = new WebInspector.FlameChart.TimelineData([], [], []);
- this._appendTimelineData(this._model.mainThreadEvents());
- return this._timelineData;
- },
-
- /**
- * @override
- */
- reset: function()
- {
- WebInspector.TimelineFlameChartDataProviderBase.prototype.reset.call(this);
- this._entries = [];
- },
-
- /**
- * @param {number} startTime
- * @param {number} endTime
- */
- setWindowTimes: function(startTime, endTime)
- {
- this._startTime = startTime;
- this._endTime = endTime;
- this.reset();
- },
-
- /**
- * @override
- * @param {number} index
- * @return {string}
- */
- entryTitle: function(index)
- {
- return this._entries[index].name;
- },
-
- /**
- * @override
- * @param {number} entryIndex
- * @return {string}
- */
- entryColor: function(entryIndex)
- {
- var entry = this._entries[entryIndex];
- if (entry.color)
- return entry.color;
- var event = entry.event;
- if (!event)
- return "#aaa";
- if (event.name === WebInspector.TimelineModel.RecordType.JSFrame)
- return WebInspector.TimelineUIUtils.colorForURL(event.args["data"]["url"]);
- return WebInspector.TimelineUIUtils.eventStyle(event).category.fillColorStop1;
- },
-
- /**
- * @param {!Array.<!WebInspector.TracingModel.Event>} events
- */
- _appendTimelineData: function(events)
- {
- /**
- * @param {!WebInspector.TracingModel.Event} e
- * @return {string}
- */
- function eventId(e)
- {
- if (e.name === WebInspector.TimelineModel.RecordType.JSFrame) {
- var data = e.args["data"];
- return "f:" + (data["CallUID"] || (data["functionName"] + "@" + data["url"]));
- }
- return e.name;
- }
- var categoryGroupNodes = new Map();
- /**
- * @param {!WebInspector.TimelineModel.ProfileTreeNode} node
- * @return {!WebInspector.TimelineModel.ProfileTreeNode}
- */
- function groupNode(node)
- {
- var category = WebInspector.TimelineUIUtils.eventStyle(node.event).category;
- var groupNode = categoryGroupNodes.get(category.title);
- if (!groupNode) {
- groupNode = new WebInspector.TimelineModel.ProfileTreeNode();
- groupNode.totalTime = 0;
- groupNode.name = category.title;
- groupNode.color = category.fillColorStop1;
- categoryGroupNodes.set(category.title, groupNode);
- }
- return groupNode;
- }
- var topDownTree = WebInspector.TimelineUIUtils.buildTopDownTree(events, this._startTime, this._endTime, this._filters, eventId);
- var bottomUpTree = WebInspector.TimelineUIUtils.buildBottomUpTree(topDownTree, groupNode);
- for (var group of categoryGroupNodes) {
- bottomUpTree.children.set(group[0], group[1]);
- bottomUpTree.totalTime += group[1].totalTime;
- }
- this._flowEventIndexById = {};
- this._minimumBoundary = 0;
- this._currentLevel = 0;
- this._timeSpan = appendTree.call(this, 0, 0, bottomUpTree);
-
- /**
- * @param {number} level
- * @param {number} position
- * @param {!WebInspector.TimelineModel.ProfileTreeNode} node
- * @this {!WebInspector.TimelineFlameChartBottomUpDataProvider}
- */
- function appendTree(level, position, node)
- {
- /**
- * @param {!WebInspector.TimelineModel.ProfileTreeNode} a
- * @param {!WebInspector.TimelineModel.ProfileTreeNode} b
- * @return {number}
- */
- function sortFunction(a, b)
- {
- return b.totalTime - a.totalTime;
- }
- this._currentLevel = Math.max(this._currentLevel, level);
- this._appendNode(node, level, position);
- if (node.children)
- Array.from(node.children.values()).sort(sortFunction).reduce(appendTree.bind(this, level + 1), position);
- return position + node.totalTime;
- }
- },
-
- /**
- * @param {!WebInspector.TimelineModel.ProfileTreeNode} node
- * @param {number} level
- * @param {number} position
- */
- _appendNode: function(node, level, position)
- {
- var index = this._entries.length;
- this._entries.push(node);
- this._timelineData.entryLevels[index] = level;
- this._timelineData.entryTotalTimes[index] = node.totalTime;
- this._timelineData.entryStartTimes[index] = position;
- },
-
- __proto__: WebInspector.TimelineFlameChartDataProviderBase.prototype
-}
-
-/**
- * @constructor
* @implements {WebInspector.FlameChartMarker}
* @param {number} startTime
* @param {number} startOffset
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698