Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Frames] = new Web Inspector.SidebarTreeElement("timeline-overview-sidebar-frames", | 60 this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Frames] = new Web Inspector.SidebarTreeElement("timeline-overview-sidebar-frames", |
| 61 WebInspector.UIString("Frames")); | 61 WebInspector.UIString("Frames")); |
| 62 this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Memory] = new Web Inspector.SidebarTreeElement("timeline-overview-sidebar-memory", | 62 this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Memory] = new Web Inspector.SidebarTreeElement("timeline-overview-sidebar-memory", |
| 63 WebInspector.UIString("Memory")); | 63 WebInspector.UIString("Memory")); |
| 64 | 64 |
| 65 for (var mode in this._overviewItems) { | 65 for (var mode in this._overviewItems) { |
| 66 var item = this._overviewItems[mode]; | 66 var item = this._overviewItems[mode]; |
| 67 item.onselect = this.setMode.bind(this, mode); | 67 item.onselect = this.setMode.bind(this, mode); |
| 68 topPaneSidebarTree.appendChild(item); | 68 topPaneSidebarTree.appendChild(item); |
| 69 } | 69 } |
| 70 | 70 |
| 71 this._overviewGrid = new WebInspector.OverviewGrid("timeline"); | 71 this._overviewGrid = new WebInspector.OverviewGrid("timeline"); |
| 72 this.element.appendChild(this._overviewGrid.element); | 72 this.element.appendChild(this._overviewGrid.element); |
| 73 | 73 |
| 74 this._innerSetMode(WebInspector.TimelineOverviewPane.Mode.Events); | 74 this._innerSetMode(WebInspector.TimelineOverviewPane.Mode.Events); |
| 75 | 75 |
| 76 var categories = WebInspector.TimelinePresentationModel.categories(); | 76 var categories = WebInspector.TimelinePresentationModel.categories(); |
| 77 for (var category in categories) | 77 for (var category in categories) |
| 78 categories[category].addEventListener(WebInspector.TimelineCategory.Even ts.VisibilityChanged, this._onCategoryVisibilityChanged, this); | 78 categories[category].addEventListener(WebInspector.TimelineCategory.Even ts.VisibilityChanged, this._onCategoryVisibilityChanged, this); |
| 79 | 79 |
| 80 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); | 80 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 for (var category in categories) | 544 for (var category in categories) |
| 545 this._fillStyles[category] = WebInspector.TimelinePresentationModel.crea teFillStyleForCategory(this._context, 0, WebInspector.TimelineEventOverview._str ipGradientHeight, categories[category]); | 545 this._fillStyles[category] = WebInspector.TimelinePresentationModel.crea teFillStyleForCategory(this._context, 0, WebInspector.TimelineEventOverview._str ipGradientHeight, categories[category]); |
| 546 | 546 |
| 547 this._disabledCategoryFillStyle = WebInspector.TimelinePresentationModel.cre ateFillStyle(this._context, 0, WebInspector.TimelineEventOverview._stripGradient Height, | 547 this._disabledCategoryFillStyle = WebInspector.TimelinePresentationModel.cre ateFillStyle(this._context, 0, WebInspector.TimelineEventOverview._stripGradient Height, |
| 548 "rgb(218, 218, 218)", "rgb(170, 170, 170)", "rgb(143, 143, 143)"); | 548 "rgb(218, 218, 218)", "rgb(170, 170, 170)", "rgb(143, 143, 143)"); |
| 549 | 549 |
| 550 this._disabledCategoryBorderStyle = "rgb(143, 143, 143)"; | 550 this._disabledCategoryBorderStyle = "rgb(143, 143, 143)"; |
| 551 } | 551 } |
| 552 | 552 |
| 553 /** @const */ | 553 /** @const */ |
| 554 WebInspector.TimelineEventOverview._numberOfStrips = 3; | |
| 555 | |
| 556 /** @const */ | |
| 557 WebInspector.TimelineEventOverview._stripGradientHeight = 120; | 554 WebInspector.TimelineEventOverview._stripGradientHeight = 120; |
| 558 | 555 |
| 559 WebInspector.TimelineEventOverview.prototype = { | 556 WebInspector.TimelineEventOverview.prototype = { |
| 560 update: function() | 557 update: function() |
| 561 { | 558 { |
| 562 this._resetCanvas(); | 559 this._resetCanvas(); |
| 563 | 560 |
| 564 var stripHeight = Math.round(this._canvas.height / WebInspector.Timelin eEventOverview._numberOfStrips); | 561 var numberOfStrips = 0; |
| 562 var categories = WebInspector.TimelinePresentationModel.categories(); | |
| 563 for (var category in categories) | |
| 564 numberOfStrips = Math.max(numberOfStrips, categories[category].overv iewStripGroupIndex); | |
| 565 ++numberOfStrips; | |
|
yurys
2013/10/31 15:06:52
Sounds like unrelated change.
alph
2013/10/31 16:58:00
Reverted.
| |
| 566 | |
| 567 var stripHeight = Math.round(this._canvas.height / numberOfStrips); | |
| 565 var timeOffset = this._model.minimumRecordTime(); | 568 var timeOffset = this._model.minimumRecordTime(); |
| 566 var timeSpan = this._model.maximumRecordTime() - timeOffset; | 569 var timeSpan = this._model.maximumRecordTime() - timeOffset; |
| 567 var scale = this._canvas.width / timeSpan; | 570 var scale = this._canvas.width / timeSpan; |
| 568 | 571 |
| 569 var lastBarByGroup = []; | 572 var lastBarByGroup = []; |
| 570 | 573 |
| 571 this._context.fillStyle = "rgba(0, 0, 0, 0.05)"; | 574 this._context.fillStyle = "rgba(0, 0, 0, 0.05)"; |
| 572 for (var i = 1; i < WebInspector.TimelineEventOverview._numberOfStrips; i += 2) | 575 for (var i = 1; i < numberOfStrips; i += 2) |
| 573 this._context.fillRect(0.5, i * stripHeight + 0.5, this._canvas.widt h, stripHeight); | 576 this._context.fillRect(0.5, i * stripHeight + 0.5, this._canvas.widt h, stripHeight); |
| 574 | 577 |
| 575 function appendRecord(record) | 578 function appendRecord(record) |
| 576 { | 579 { |
| 577 if (record.type === WebInspector.TimelineModel.RecordType.BeginFrame ) | 580 if (record.type === WebInspector.TimelineModel.RecordType.BeginFrame ) |
| 578 return; | 581 return; |
| 579 var recordStart = Math.floor((WebInspector.TimelineModel.startTimeIn Seconds(record) - timeOffset) * scale); | 582 var recordStart = Math.floor((WebInspector.TimelineModel.startTimeIn Seconds(record) - timeOffset) * scale); |
| 580 var recordEnd = Math.ceil((WebInspector.TimelineModel.endTimeInSecon ds(record) - timeOffset) * scale); | 583 var recordEnd = Math.ceil((WebInspector.TimelineModel.endTimeInSecon ds(record) - timeOffset) * scale); |
| 581 var category = WebInspector.TimelinePresentationModel.categoryForRec ord(record); | 584 var category = WebInspector.TimelinePresentationModel.categoryForRec ord(record); |
| 582 if (category.overviewStripGroupIndex < 0) | 585 if (category.overviewStripGroupIndex < 0) |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 606 }, | 609 }, |
| 607 | 610 |
| 608 /** | 611 /** |
| 609 * @param {number} begin | 612 * @param {number} begin |
| 610 * @param {number} end | 613 * @param {number} end |
| 611 * @param {number} height | 614 * @param {number} height |
| 612 * @param {WebInspector.TimelineCategory} category | 615 * @param {WebInspector.TimelineCategory} category |
| 613 */ | 616 */ |
| 614 _renderBar: function(begin, end, height, category) | 617 _renderBar: function(begin, end, height, category) |
| 615 { | 618 { |
| 616 const stripPadding = 4 * window.devicePixelRatio; | 619 const stripPadding = 3 * window.devicePixelRatio; |
| 617 const innerStripHeight = height - 2 * stripPadding; | 620 const innerStripHeight = height - 2 * stripPadding; |
| 618 | 621 |
| 619 var x = begin + 0.5; | 622 var x = begin + 0.5; |
| 620 var y = category.overviewStripGroupIndex * height + stripPadding + 0.5; | 623 var y = category.overviewStripGroupIndex * height + stripPadding + 0.5; |
| 621 var width = Math.max(end - begin, 1); | 624 var width = Math.max(end - begin, 1); |
| 622 | 625 |
| 623 this._context.save(); | 626 this._context.save(); |
| 624 this._context.translate(x, y); | 627 this._context.translate(x, y); |
| 625 this._context.scale(1, innerStripHeight / WebInspector.TimelineEventOver view._stripGradientHeight); | 628 this._context.scale(1, innerStripHeight / WebInspector.TimelineEventOver view._stripGradientHeight); |
| 626 this._context.fillStyle = category.hidden ? this._disabledCategoryFillSt yle : this._fillStyles[category.name]; | 629 this._context.fillStyle = category.hidden ? this._disabledCategoryFillSt yle : this._fillStyles[category.name]; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 836 this._context.fillRect(0, y, this._maxInnerBarWidth, Math.floor(heig ht)); | 839 this._context.fillRect(0, y, this._maxInnerBarWidth, Math.floor(heig ht)); |
| 837 this._context.strokeStyle = WebInspector.TimelinePresentationModel.c ategories()[category].borderColor; | 840 this._context.strokeStyle = WebInspector.TimelinePresentationModel.c ategories()[category].borderColor; |
| 838 this._context.beginPath(); | 841 this._context.beginPath(); |
| 839 this._context.moveTo(0, y); | 842 this._context.moveTo(0, y); |
| 840 this._context.lineTo(this._maxInnerBarWidth, y); | 843 this._context.lineTo(this._maxInnerBarWidth, y); |
| 841 this._context.stroke(); | 844 this._context.stroke(); |
| 842 this._context.restore(); | 845 this._context.restore(); |
| 843 | 846 |
| 844 bottomOffset -= height - 1; | 847 bottomOffset -= height - 1; |
| 845 } | 848 } |
| 849 | |
| 846 // Draw a contour for the total frame time. | 850 // Draw a contour for the total frame time. |
| 847 var y0 = Math.floor(this._canvas.height - frame.duration * scale) + 0.5; | 851 var y0 = Math.floor(this._canvas.height - frame.duration * scale) + 0.5; |
| 848 var y1 = this._canvas.height + 0.5; | 852 var y1 = this._canvas.height + 0.5; |
| 849 | 853 |
| 850 this._context.strokeStyle = "rgba(90, 90, 90, 0.3)"; | 854 this._context.strokeStyle = "rgba(90, 90, 90, 0.3)"; |
| 851 this._context.beginPath(); | 855 this._context.beginPath(); |
| 852 this._context.moveTo(x, y1); | 856 this._context.moveTo(x, y1); |
| 853 this._context.lineTo(x, y0); | 857 this._context.lineTo(x, y0); |
| 854 this._context.lineTo(x + width, y0); | 858 this._context.lineTo(x + width, y0); |
| 855 this._context.lineTo(x + width, y1); | 859 this._context.lineTo(x + width, y1); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 951 WebInspector.TimelineWindowFilter.prototype = { | 955 WebInspector.TimelineWindowFilter.prototype = { |
| 952 /** | 956 /** |
| 953 * @param {!WebInspector.TimelinePresentationModel.Record} record | 957 * @param {!WebInspector.TimelinePresentationModel.Record} record |
| 954 * @return {boolean} | 958 * @return {boolean} |
| 955 */ | 959 */ |
| 956 accept: function(record) | 960 accept: function(record) |
| 957 { | 961 { |
| 958 return record.lastChildEndTime >= this._pane._windowStartTime && record. startTime <= this._pane._windowEndTime; | 962 return record.lastChildEndTime >= this._pane._windowStartTime && record. startTime <= this._pane._windowEndTime; |
| 959 } | 963 } |
| 960 } | 964 } |
| OLD | NEW |