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

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

Issue 2608043002: DevTools: extract modules (with extensions) (Closed)
Patch Set: fixes Created 3 years, 11 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
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 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 * @param {!Timeline.TimelineCategory=} selfCategory 1446 * @param {!Timeline.TimelineCategory=} selfCategory
1447 * @param {number=} selfTime 1447 * @param {number=} selfTime
1448 * @return {!Element} 1448 * @return {!Element}
1449 */ 1449 */
1450 static generatePieChart(aggregatedStats, selfCategory, selfTime) { 1450 static generatePieChart(aggregatedStats, selfCategory, selfTime) {
1451 var total = 0; 1451 var total = 0;
1452 for (var categoryName in aggregatedStats) 1452 for (var categoryName in aggregatedStats)
1453 total += aggregatedStats[categoryName]; 1453 total += aggregatedStats[categoryName];
1454 1454
1455 var element = createElementWithClass('div', 'timeline-details-view-pie-chart -wrapper hbox'); 1455 var element = createElementWithClass('div', 'timeline-details-view-pie-chart -wrapper hbox');
1456 var pieChart = new UI.PieChart(100); 1456 var pieChart = new Perf_UI.PieChart(100);
1457 pieChart.element.classList.add('timeline-details-view-pie-chart'); 1457 pieChart.element.classList.add('timeline-details-view-pie-chart');
1458 pieChart.setTotal(total); 1458 pieChart.setTotal(total);
1459 var pieChartContainer = element.createChild('div', 'vbox'); 1459 var pieChartContainer = element.createChild('div', 'vbox');
1460 pieChartContainer.appendChild(pieChart.element); 1460 pieChartContainer.appendChild(pieChart.element);
1461 pieChartContainer.createChild('div', 'timeline-details-view-pie-chart-total' ).textContent = 1461 pieChartContainer.createChild('div', 'timeline-details-view-pie-chart-total' ).textContent =
1462 Common.UIString('Total: %s', Number.millisToString(total, true)); 1462 Common.UIString('Total: %s', Number.millisToString(total, true));
1463 var footerElement = element.createChild('div', 'timeline-aggregated-info-leg end'); 1463 var footerElement = element.createChild('div', 'timeline-aggregated-info-leg end');
1464 1464
1465 /** 1465 /**
1466 * @param {string} name 1466 * @param {string} name
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 if (category === selfCategory) 1500 if (category === selfCategory)
1501 continue; 1501 continue;
1502 appendLegendRow(category.name, category.title, aggregatedStats[category.na me], category.childColor); 1502 appendLegendRow(category.name, category.title, aggregatedStats[category.na me], category.childColor);
1503 } 1503 }
1504 return element; 1504 return element;
1505 } 1505 }
1506 1506
1507 /** 1507 /**
1508 * @param {!TimelineModel.TimelineFrameModel} frameModel 1508 * @param {!TimelineModel.TimelineFrameModel} frameModel
1509 * @param {!TimelineModel.TimelineFrame} frame 1509 * @param {!TimelineModel.TimelineFrame} frame
1510 * @param {?Components.FilmStripModel.Frame} filmStripFrame 1510 * @param {?SDK.FilmStripModel.Frame} filmStripFrame
1511 * @return {!Element} 1511 * @return {!Element}
1512 */ 1512 */
1513 static generateDetailsContentForFrame(frameModel, frame, filmStripFrame) { 1513 static generateDetailsContentForFrame(frameModel, frame, filmStripFrame) {
1514 var contentHelper = new Timeline.TimelineDetailsContentHelper(null, null); 1514 var contentHelper = new Timeline.TimelineDetailsContentHelper(null, null);
1515 contentHelper.addSection(Common.UIString('Frame')); 1515 contentHelper.addSection(Common.UIString('Frame'));
1516 1516
1517 var duration = Timeline.TimelineUIUtils.frameDuration(frame); 1517 var duration = Timeline.TimelineUIUtils.frameDuration(frame);
1518 contentHelper.appendElementRow(Common.UIString('Duration'), duration, frame. hasWarnings()); 1518 contentHelper.appendElementRow(Common.UIString('Duration'), duration, frame. hasWarnings());
1519 if (filmStripFrame) { 1519 if (filmStripFrame) {
1520 var filmStripPreview = createElementWithClass('img', 'timeline-filmstrip-p review'); 1520 var filmStripPreview = createElementWithClass('img', 'timeline-filmstrip-p review');
(...skipping 14 matching lines...) Expand all
1535 /** 1535 /**
1536 * @param {!Element} image 1536 * @param {!Element} image
1537 * @param {?string} data 1537 * @param {?string} data
1538 */ 1538 */
1539 function onGotImageData(image, data) { 1539 function onGotImageData(image, data) {
1540 if (data) 1540 if (data)
1541 image.src = 'data:image/jpg;base64,' + data; 1541 image.src = 'data:image/jpg;base64,' + data;
1542 } 1542 }
1543 1543
1544 /** 1544 /**
1545 * @param {!Components.FilmStripModel.Frame} filmStripFrame 1545 * @param {!SDK.FilmStripModel.Frame} filmStripFrame
1546 */ 1546 */
1547 function frameClicked(filmStripFrame) { 1547 function frameClicked(filmStripFrame) {
1548 new Components.FilmStripView.Dialog(filmStripFrame, 0); 1548 new Components.FilmStripView.Dialog(filmStripFrame, 0);
1549 } 1549 }
1550 1550
1551 return contentHelper.fragment; 1551 return contentHelper.fragment;
1552 } 1552 }
1553 1553
1554 /** 1554 /**
1555 * @param {!TimelineModel.TimelineFrame} frame 1555 * @param {!TimelineModel.TimelineFrame} frame
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 }; 1698 };
1699 } 1699 }
1700 1700
1701 /** 1701 /**
1702 * @param {string} url 1702 * @param {string} url
1703 * @return {string} 1703 * @return {string}
1704 */ 1704 */
1705 static colorForURL(url) { 1705 static colorForURL(url) {
1706 if (!Timeline.TimelineUIUtils.colorForURL._colorGenerator) { 1706 if (!Timeline.TimelineUIUtils.colorForURL._colorGenerator) {
1707 Timeline.TimelineUIUtils.colorForURL._colorGenerator = 1707 Timeline.TimelineUIUtils.colorForURL._colorGenerator =
1708 new UI.FlameChart.ColorGenerator({min: 30, max: 330}, {min: 50, max: 8 0, count: 3}, 85); 1708 new Perf_UI.FlameChart.ColorGenerator({min: 30, max: 330}, {min: 50, m ax: 80, count: 3}, 85);
1709 } 1709 }
1710 return Timeline.TimelineUIUtils.colorForURL._colorGenerator.colorForID(url); 1710 return Timeline.TimelineUIUtils.colorForURL._colorGenerator.colorForID(url);
1711 } 1711 }
1712 1712
1713 /** 1713 /**
1714 * @param {!SDK.TracingModel.Event} event 1714 * @param {!SDK.TracingModel.Event} event
1715 * @param {string=} warningType 1715 * @param {string=} warningType
1716 * @return {?Element} 1716 * @return {?Element}
1717 */ 1717 */
1718 static eventWarning(event, warningType) { 1718 static eventWarning(event, warningType) {
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 /** 2238 /**
2239 * @param {!SDK.TracingModel.Event} event 2239 * @param {!SDK.TracingModel.Event} event
2240 * @param {string=} warningType 2240 * @param {string=} warningType
2241 */ 2241 */
2242 appendWarningRow(event, warningType) { 2242 appendWarningRow(event, warningType) {
2243 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); 2243 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType);
2244 if (warning) 2244 if (warning)
2245 this.appendElementRow(Common.UIString('Warning'), warning, true); 2245 this.appendElementRow(Common.UIString('Warning'), warning, true);
2246 } 2246 }
2247 }; 2247 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698