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

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

Issue 2863293002: DevTools: Support color by Product on timeline flamechart. (Closed)
Patch Set: addressing comments 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 305 }
306 306
307 /** 307 /**
308 * @param {!SDK.TracingModel.Event} event 308 * @param {!SDK.TracingModel.Event} event
309 * @return {string} 309 * @return {string}
310 */ 310 */
311 static eventColor(event) { 311 static eventColor(event) {
312 if (event.name === TimelineModel.TimelineModel.RecordType.JSFrame) { 312 if (event.name === TimelineModel.TimelineModel.RecordType.JSFrame) {
313 var frame = event.args['data']; 313 var frame = event.args['data'];
314 if (Timeline.TimelineUIUtils.isUserFrame(frame)) 314 if (Timeline.TimelineUIUtils.isUserFrame(frame))
315 return Timeline.TimelineUIUtils.colorForURL(frame.url); 315 return Timeline.TimelineUIUtils.colorForId(frame.url);
316 } 316 }
317 return Timeline.TimelineUIUtils.eventStyle(event).category.color; 317 return Timeline.TimelineUIUtils.eventStyle(event).category.color;
318 } 318 }
319 319
320 /** 320 /**
321 * @param {!SDK.TracingModel.Event} event 321 * @param {!SDK.TracingModel.Event} event
322 * @return {string} 322 * @return {string}
323 */ 323 */
324 static eventTitle(event) { 324 static eventTitle(event) {
325 const recordType = TimelineModel.TimelineModel.RecordType; 325 const recordType = TimelineModel.TimelineModel.RecordType;
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 title: Common.UIString('Frame'), 1721 title: Common.UIString('Frame'),
1722 color: 'rgba(100, 100, 100, 0.4)', 1722 color: 'rgba(100, 100, 100, 0.4)',
1723 lineWidth: 3, 1723 lineWidth: 3,
1724 dashStyle: [3], 1724 dashStyle: [3],
1725 tall: true, 1725 tall: true,
1726 lowPriority: true 1726 lowPriority: true
1727 }; 1727 };
1728 } 1728 }
1729 1729
1730 /** 1730 /**
1731 * @param {string} url 1731 * @param {string} id
1732 * @return {string} 1732 * @return {string}
1733 */ 1733 */
1734 static colorForURL(url) { 1734 static colorForId(id) {
1735 if (!Timeline.TimelineUIUtils.colorForURL._colorGenerator) { 1735 if (!Timeline.TimelineUIUtils.colorForId._colorGenerator) {
1736 Timeline.TimelineUIUtils.colorForURL._colorGenerator = 1736 Timeline.TimelineUIUtils.colorForId._colorGenerator =
1737 new PerfUI.FlameChart.ColorGenerator({min: 30, max: 330}, {min: 50, ma x: 80, count: 3}, 85); 1737 new PerfUI.FlameChart.ColorGenerator({min: 30, max: 330}, {min: 50, ma x: 80, count: 3}, 85);
1738 } 1738 }
1739 return Timeline.TimelineUIUtils.colorForURL._colorGenerator.colorForID(url); 1739 return Timeline.TimelineUIUtils.colorForId._colorGenerator.colorForID(id);
1740 } 1740 }
1741 1741
1742 /** 1742 /**
1743 * @param {!SDK.TracingModel.Event} event 1743 * @param {!SDK.TracingModel.Event} event
1744 * @param {string=} warningType 1744 * @param {string=} warningType
1745 * @return {?Element} 1745 * @return {?Element}
1746 */ 1746 */
1747 static eventWarning(event, warningType) { 1747 static eventWarning(event, warningType) {
1748 var timelineData = TimelineModel.TimelineData.forEvent(event); 1748 var timelineData = TimelineModel.TimelineData.forEvent(event);
1749 var warning = warningType || timelineData.warning; 1749 var warning = warningType || timelineData.warning;
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 * @param {string=} warningType 2269 * @param {string=} warningType
2270 */ 2270 */
2271 appendWarningRow(event, warningType) { 2271 appendWarningRow(event, warningType) {
2272 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); 2272 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType);
2273 if (warning) 2273 if (warning)
2274 this.appendElementRow(Common.UIString('Warning'), warning, true); 2274 this.appendElementRow(Common.UIString('Warning'), warning, true);
2275 } 2275 }
2276 }; 2276 };
2277 2277
2278 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo wnCache'); 2278 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo wnCache');
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698