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

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js

Issue 2892333002: DevTools: Render third-party badges in timeline tree view (Closed)
Patch Set: . Created 3 years, 7 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
Index: third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
index 9202ce2b689124bea4772458b3189c5749e921c8..3dcbdab9f2acd1dcc15816219a4e3514fadcef85 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
@@ -333,6 +333,35 @@ Timeline.TimelineUIUtils = class {
}
/**
+ * @param {!ProductRegistry.Registry} productRegistry
+ * @param {!TimelineModel.TimelineModel} model
+ * @param {!Map<string, string>} urlToColorCache
+ * @param {!SDK.TracingModel.Event} event
+ * @return {string}
+ */
+ static eventColorByProduct(productRegistry, model, urlToColorCache, event) {
+ var url = Timeline.TimelineUIUtils.eventURL(event) || '';
+ var color = urlToColorCache.get(url);
+ if (color)
+ return color;
+ var defaultColor = '#f2ecdc';
+ var parsedURL = url.asParsedURL();
+ if (!parsedURL)
+ return defaultColor;
+ var name = productRegistry && productRegistry.nameForUrl(parsedURL);
+ if (!name) {
+ name = parsedURL.host;
+ var rootFrames = model.rootFrames();
+ if (rootFrames.some(pageFrame => new Common.ParsedURL(pageFrame.url).host === name))
+ color = defaultColor;
+ }
+ if (!color)
+ color = name ? ProductRegistry.BadgePool.colorForEntryName(name) : defaultColor;
+ urlToColorCache.set(url, color);
+ return color;
+ }
+
+ /**
* @param {!SDK.TracingModel.Event} event
* @return {string}
*/
@@ -955,7 +984,7 @@ Timeline.TimelineUIUtils = class {
static _maybeAppendProductToDetails(contentHelper, badgePool, url) {
var parsedURL = url ? url.asParsedURL() : null;
if (parsedURL)
- contentHelper.appendElementRow('', badgePool.badgeForURL(parsedURL, true));
+ contentHelper.appendElementRow('', badgePool.badgeForURL(parsedURL));
}
/**

Powered by Google App Engine
This is Rietveld 408576698