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

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

Issue 2623743002: DevTools: extract modules (non-extensions) (Closed)
Patch Set: rebaseline 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 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 * @param {!Timeline.TimelineCategory=} selfCategory 1453 * @param {!Timeline.TimelineCategory=} selfCategory
1454 * @param {number=} selfTime 1454 * @param {number=} selfTime
1455 * @return {!Element} 1455 * @return {!Element}
1456 */ 1456 */
1457 static generatePieChart(aggregatedStats, selfCategory, selfTime) { 1457 static generatePieChart(aggregatedStats, selfCategory, selfTime) {
1458 var total = 0; 1458 var total = 0;
1459 for (var categoryName in aggregatedStats) 1459 for (var categoryName in aggregatedStats)
1460 total += aggregatedStats[categoryName]; 1460 total += aggregatedStats[categoryName];
1461 1461
1462 var element = createElementWithClass('div', 'timeline-details-view-pie-chart -wrapper hbox'); 1462 var element = createElementWithClass('div', 'timeline-details-view-pie-chart -wrapper hbox');
1463 var pieChart = new UI.PieChart(100); 1463 var pieChart = new PerfUI.PieChart(100);
1464 pieChart.element.classList.add('timeline-details-view-pie-chart'); 1464 pieChart.element.classList.add('timeline-details-view-pie-chart');
1465 pieChart.setTotal(total); 1465 pieChart.setTotal(total);
1466 var pieChartContainer = element.createChild('div', 'vbox'); 1466 var pieChartContainer = element.createChild('div', 'vbox');
1467 pieChartContainer.appendChild(pieChart.element); 1467 pieChartContainer.appendChild(pieChart.element);
1468 pieChartContainer.createChild('div', 'timeline-details-view-pie-chart-total' ).textContent = 1468 pieChartContainer.createChild('div', 'timeline-details-view-pie-chart-total' ).textContent =
1469 Common.UIString('Total: %s', Number.millisToString(total, true)); 1469 Common.UIString('Total: %s', Number.millisToString(total, true));
1470 var footerElement = element.createChild('div', 'timeline-aggregated-info-leg end'); 1470 var footerElement = element.createChild('div', 'timeline-aggregated-info-leg end');
1471 1471
1472 /** 1472 /**
1473 * @param {string} name 1473 * @param {string} name
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 if (category === selfCategory) 1507 if (category === selfCategory)
1508 continue; 1508 continue;
1509 appendLegendRow(category.name, category.title, aggregatedStats[category.na me], category.childColor); 1509 appendLegendRow(category.name, category.title, aggregatedStats[category.na me], category.childColor);
1510 } 1510 }
1511 return element; 1511 return element;
1512 } 1512 }
1513 1513
1514 /** 1514 /**
1515 * @param {!TimelineModel.TimelineFrameModel} frameModel 1515 * @param {!TimelineModel.TimelineFrameModel} frameModel
1516 * @param {!TimelineModel.TimelineFrame} frame 1516 * @param {!TimelineModel.TimelineFrame} frame
1517 * @param {?Components.FilmStripModel.Frame} filmStripFrame 1517 * @param {?SDK.FilmStripModel.Frame} filmStripFrame
1518 * @return {!Element} 1518 * @return {!Element}
1519 */ 1519 */
1520 static generateDetailsContentForFrame(frameModel, frame, filmStripFrame) { 1520 static generateDetailsContentForFrame(frameModel, frame, filmStripFrame) {
1521 var contentHelper = new Timeline.TimelineDetailsContentHelper(null, null); 1521 var contentHelper = new Timeline.TimelineDetailsContentHelper(null, null);
1522 contentHelper.addSection(Common.UIString('Frame')); 1522 contentHelper.addSection(Common.UIString('Frame'));
1523 1523
1524 var duration = Timeline.TimelineUIUtils.frameDuration(frame); 1524 var duration = Timeline.TimelineUIUtils.frameDuration(frame);
1525 contentHelper.appendElementRow(Common.UIString('Duration'), duration, frame. hasWarnings()); 1525 contentHelper.appendElementRow(Common.UIString('Duration'), duration, frame. hasWarnings());
1526 if (filmStripFrame) { 1526 if (filmStripFrame) {
1527 var filmStripPreview = createElementWithClass('img', 'timeline-filmstrip-p review'); 1527 var filmStripPreview = createElementWithClass('img', 'timeline-filmstrip-p review');
(...skipping 14 matching lines...) Expand all
1542 /** 1542 /**
1543 * @param {!Element} image 1543 * @param {!Element} image
1544 * @param {?string} data 1544 * @param {?string} data
1545 */ 1545 */
1546 function onGotImageData(image, data) { 1546 function onGotImageData(image, data) {
1547 if (data) 1547 if (data)
1548 image.src = 'data:image/jpg;base64,' + data; 1548 image.src = 'data:image/jpg;base64,' + data;
1549 } 1549 }
1550 1550
1551 /** 1551 /**
1552 * @param {!Components.FilmStripModel.Frame} filmStripFrame 1552 * @param {!SDK.FilmStripModel.Frame} filmStripFrame
1553 */ 1553 */
1554 function frameClicked(filmStripFrame) { 1554 function frameClicked(filmStripFrame) {
1555 new Components.FilmStripView.Dialog(filmStripFrame, 0); 1555 new PerfUI.FilmStripView.Dialog(filmStripFrame, 0);
1556 } 1556 }
1557 1557
1558 return contentHelper.fragment; 1558 return contentHelper.fragment;
1559 } 1559 }
1560 1560
1561 /** 1561 /**
1562 * @param {!TimelineModel.TimelineFrame} frame 1562 * @param {!TimelineModel.TimelineFrame} frame
1563 * @return {!Element} 1563 * @return {!Element}
1564 */ 1564 */
1565 static frameDuration(frame) { 1565 static frameDuration(frame) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 }; 1705 };
1706 } 1706 }
1707 1707
1708 /** 1708 /**
1709 * @param {string} url 1709 * @param {string} url
1710 * @return {string} 1710 * @return {string}
1711 */ 1711 */
1712 static colorForURL(url) { 1712 static colorForURL(url) {
1713 if (!Timeline.TimelineUIUtils.colorForURL._colorGenerator) { 1713 if (!Timeline.TimelineUIUtils.colorForURL._colorGenerator) {
1714 Timeline.TimelineUIUtils.colorForURL._colorGenerator = 1714 Timeline.TimelineUIUtils.colorForURL._colorGenerator =
1715 new UI.FlameChart.ColorGenerator({min: 30, max: 330}, {min: 50, max: 8 0, count: 3}, 85); 1715 new PerfUI.FlameChart.ColorGenerator({min: 30, max: 330}, {min: 50, ma x: 80, count: 3}, 85);
1716 } 1716 }
1717 return Timeline.TimelineUIUtils.colorForURL._colorGenerator.colorForID(url); 1717 return Timeline.TimelineUIUtils.colorForURL._colorGenerator.colorForID(url);
1718 } 1718 }
1719 1719
1720 /** 1720 /**
1721 * @param {!SDK.TracingModel.Event} event 1721 * @param {!SDK.TracingModel.Event} event
1722 * @param {string=} warningType 1722 * @param {string=} warningType
1723 * @return {?Element} 1723 * @return {?Element}
1724 */ 1724 */
1725 static eventWarning(event, warningType) { 1725 static eventWarning(event, warningType) {
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 /** 2245 /**
2246 * @param {!SDK.TracingModel.Event} event 2246 * @param {!SDK.TracingModel.Event} event
2247 * @param {string=} warningType 2247 * @param {string=} warningType
2248 */ 2248 */
2249 appendWarningRow(event, warningType) { 2249 appendWarningRow(event, warningType) {
2250 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); 2250 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType);
2251 if (warning) 2251 if (warning)
2252 this.appendElementRow(Common.UIString('Warning'), warning, true); 2252 this.appendElementRow(Common.UIString('Warning'), warning, true);
2253 } 2253 }
2254 }; 2254 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698