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

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..39ef21abbe2501e2db7d0e888e7f61e1a347161f 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,34 @@ 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) {
+ 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))
+ return defaultColor;
+ }
+ color = name ? ProductRegistry.BadgePool.colorForEntryName(name) : defaultColor;
+ urlToColorCache.set(url, color);
+ }
+ return color;
+ }
+
+ /**
* @param {!SDK.TracingModel.Event} event
* @return {string}
*/

Powered by Google App Engine
This is Rietveld 408576698