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

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

Issue 1296453003: DevTools: [timeline tree view] expose human-readable names for chrome extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TimelineTreeView.js
diff --git a/Source/devtools/front_end/timeline/TimelineTreeView.js b/Source/devtools/front_end/timeline/TimelineTreeView.js
index c8d8f1c369694cb21a57ea3271c8bd6338ac8306..611769ecd0fb2865c247010b4ec13b14ed3c553c 100644
--- a/Source/devtools/front_end/timeline/TimelineTreeView.js
+++ b/Source/devtools/front_end/timeline/TimelineTreeView.js
@@ -183,34 +183,38 @@ WebInspector.TimelineTreeView.prototype = {
}
/**
+ * @param {boolean} groupSubdomains
* @param {!WebInspector.TimelineModel.ProfileTreeNode} node
* @return {string}
*/
- function groupByDomain(node)
- {
- var parsedURL = (WebInspector.TimelineTreeView.eventURL(node.event) || "").asParsedURL();
- return parsedURL && parsedURL.host || "";
- }
-
- /**
- * @param {!WebInspector.TimelineModel.ProfileTreeNode} node
- * @return {string}
- */
- function groupByDomainSecondLevel(node)
+ function groupByDomain(groupSubdomains, node)
{
var parsedURL = (WebInspector.TimelineTreeView.eventURL(node.event) || "").asParsedURL();
if (!parsedURL)
return "";
+ if (parsedURL.scheme === "chrome-extension") {
+ var url = parsedURL.scheme + "://" + parsedURL.host;
+ var displayName = executionContextNamesByOrigin.get(url);
+ return displayName ? WebInspector.UIString("Chrome Extension: %s", displayName) : url;
+ }
+ if (!groupSubdomains)
+ return parsedURL.host;
if (/^[.0-9]+$/.test(parsedURL.host))
return parsedURL.host;
var domainMatch = /([^.]*\.)?[^.]*$/.exec(parsedURL.host);
return domainMatch && domainMatch[0] || "";
}
+ var executionContextNamesByOrigin = new Map();
+ var mainTarget = WebInspector.targetManager.mainTarget();
+ if (mainTarget) {
+ for (var context of mainTarget.runtimeModel.executionContexts())
+ executionContextNamesByOrigin.set(context.origin, context.name);
+ }
var groupByMap = /** @type {!Map<!WebInspector.TimelineTreeView.GroupBy,?function(!WebInspector.TimelineModel.ProfileTreeNode):string>} */ (new Map([
[WebInspector.TimelineTreeView.GroupBy.None, null],
- [WebInspector.TimelineTreeView.GroupBy.Domain, groupByDomain],
- [WebInspector.TimelineTreeView.GroupBy.DomainSecondLevel, groupByDomainSecondLevel],
+ [WebInspector.TimelineTreeView.GroupBy.Domain, groupByDomain.bind(null, false)],
+ [WebInspector.TimelineTreeView.GroupBy.DomainSecondLevel, groupByDomain.bind(null, true)],
[WebInspector.TimelineTreeView.GroupBy.URL, groupByURL]
]));
return groupByMap.get(this._groupBySetting.get()) || null;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698