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

Unified Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js

Issue 2470593002: [Devtools] New network canvas timeline now properly shows initiators (Closed)
Patch Set: changes Created 4 years, 1 month 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
Index: third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js
index 741c7d4dd20c41c1328436d21393b97615da0ff8..a551bb5555d3019cc059980bf696916806424587 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js
@@ -38,6 +38,8 @@ WebInspector.NetworkTimelineColumn = function(rowHeight, calculator)
/** @type {?WebInspector.NetworkRequest} */
this._hoveredRequest = null;
+ /** @type {?WebInspector.NetworkRequest.InitiatorGraph} */
+ this._initiatorGraph = null;
/** @type {?WebInspector.NetworkRequest} */
this._navigationRequest = null;
@@ -49,6 +51,8 @@ WebInspector.NetworkTimelineColumn = function(rowHeight, calculator)
this._rowNavigationRequestColor = WebInspector.themeSupport.patchColor("#def", colorUsage.Background);
this._rowStripeColor = WebInspector.themeSupport.patchColor("#f5f5f5", colorUsage.Background);
this._rowHoverColor = WebInspector.themeSupport.patchColor("#ebf2fc", /** @type {!WebInspector.ThemeSupport.ColorUsage} */ (colorUsage.Background | colorUsage.Selection));
+ this._parentInitiatorColor = WebInspector.themeSupport.patchColor("hsla(120, 68%, 54%, 0.2)", colorUsage.Background);
+ this._initiatedColor = WebInspector.themeSupport.patchColor("hsla(0, 68%, 54%, 0.2)", colorUsage.Background);
/** @type {!Map<!WebInspector.ResourceType, string>} */
this._borderColorsForResourceTypeCache = new Map();
@@ -132,10 +136,12 @@ WebInspector.NetworkTimelineColumn.prototype = {
/**
* @param {?WebInspector.NetworkRequest} request
+ * @param {boolean} highlightInitiatorChain
*/
- setHoveredRequest: function(request)
+ setHoveredRequest: function(request, highlightInitiatorChain)
{
this._hoveredRequest = request;
+ this._initiatorGraph = (highlightInitiatorChain && request) ? request.initiatorGraph() : null;
this.update();
},
@@ -600,20 +606,39 @@ WebInspector.NetworkTimelineColumn.prototype = {
*/
_decorateRow: function(context, request, rowNumber, y)
{
- if (rowNumber % 2 === 1 && this._hoveredRequest !== request && this._navigationRequest !== request)
+ if (rowNumber % 2 === 1 && this._hoveredRequest !== request && this._navigationRequest !== request && !this._initiatorGraph)
+ return;
+
+ var color = getRowColor.call(this);
+ if (color === "transparent")
return;
context.save();
context.beginPath();
- var color = this._rowStripeColor;
- if (this._hoveredRequest === request)
- color = this._rowHoverColor;
- else if (this._navigationRequest === request)
- color = this._rowNavigationRequestColor;
-
context.fillStyle = color;
context.rect(0, y, this._offsetWidth, this._rowHeight);
context.fill();
context.restore();
+
+ /**
+ * @return {string}
+ * @this {WebInspector.NetworkTimelineColumn}
+ */
+ function getRowColor()
+ {
+ if (this._hoveredRequest === request)
+ return this._rowHoverColor;
+ if (this._initiatorGraph) {
+ if (this._initiatorGraph.initiators.has(request))
+ return this._parentInitiatorColor;
+ if (this._initiatorGraph.initiated.has(request))
+ return this._initiatedColor;
+ }
+ if (this._navigationRequest === request)
+ return this._rowNavigationRequestColor;
+ if (rowNumber % 2 === 1)
+ return "transparent";
+ return this._rowStripeColor;
+ }
},
__proto__: WebInspector.VBox.prototype

Powered by Google App Engine
This is Rietveld 408576698