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

Unified Diff: Source/devtools/front_end/components/FlameChart.js

Issue 319363002: DevTools: CPUFlameChart: stick function entry color to the function name and url. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « no previous file | Source/devtools/front_end/profiler/CPUProfileFlameChart.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/components/FlameChart.js
diff --git a/Source/devtools/front_end/components/FlameChart.js b/Source/devtools/front_end/components/FlameChart.js
index 1d2415f0752a3cca7bc881e2d0b9f49a729fd750..474b14cf7c23e3a478b521e0cb15b928de6c0709 100644
--- a/Source/devtools/front_end/components/FlameChart.js
+++ b/Source/devtools/front_end/components/FlameChart.js
@@ -232,7 +232,6 @@ WebInspector.FlameChart.ColorGenerator = function(hueSpace, satSpace, lightnessS
this._satSpace = satSpace || 67;
this._lightnessSpace = lightnessSpace || 80;
this._colors = {};
- this._currentColorIndex = 0;
}
WebInspector.FlameChart.ColorGenerator.prototype = {
@@ -253,18 +252,22 @@ WebInspector.FlameChart.ColorGenerator.prototype = {
{
var color = this._colors[id];
if (!color) {
- color = this._createColor(this._currentColorIndex++);
+ color = this._generateColorForID(id);
this._colors[id] = color;
}
return color;
},
/**
- * @param {number} index
+ * @param {string} id
* @return {string}
*/
- _createColor: function(index)
+ _generateColorForID: function(id)
{
+ var index = 0;
+ var pow = 1;
+ for (var i = 0; i < id.length; ++i)
alph 2014/06/07 13:28:22 index = id.hashCode();
+ index += id.charCodeAt(i);
var h = this._indexToValueInSpace(index, this._hueSpace);
var s = this._indexToValueInSpace(index, this._satSpace);
var l = this._indexToValueInSpace(index, this._lightnessSpace);
@@ -281,7 +284,7 @@ WebInspector.FlameChart.ColorGenerator.prototype = {
if (typeof space === "number")
return space;
index %= space.count;
- return space.min + index / space.count * (space.max - space.min);
+ return space.min + Math.floor(index / space.count * (space.max - space.min));
}
}
« no previous file with comments | « no previous file | Source/devtools/front_end/profiler/CPUProfileFlameChart.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698