| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 resetHeapSizeLabels: function() | 46 resetHeapSizeLabels: function() |
| 47 { | 47 { |
| 48 this._maxHeapSizeLabel.textContent = ""; | 48 this._maxHeapSizeLabel.textContent = ""; |
| 49 this._minHeapSizeLabel.textContent = ""; | 49 this._minHeapSizeLabel.textContent = ""; |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 update: function() | 52 update: function() |
| 53 { | 53 { |
| 54 this.resetCanvas(); | 54 this.resetCanvas(); |
| 55 | 55 |
| 56 var records = this._model.records; | 56 var records = this._model.records(); |
| 57 if (!records.length) { | 57 if (!records.length) { |
| 58 this.resetHeapSizeLabels(); | 58 this.resetHeapSizeLabels(); |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 | 61 |
| 62 const lowerOffset = 3; | 62 const lowerOffset = 3; |
| 63 var maxUsedHeapSize = 0; | 63 var maxUsedHeapSize = 0; |
| 64 var minUsedHeapSize = 100000000000; | 64 var minUsedHeapSize = 100000000000; |
| 65 var minTime = this._model.minimumRecordTime(); | 65 var minTime = this._model.minimumRecordTime(); |
| 66 var maxTime = this._model.maximumRecordTime(); | 66 var maxTime = this._model.maximumRecordTime(); |
| 67 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r
) { | 67 this._model.forAllRecords(function(r) { |
| 68 if (!r.counters || !r.counters.jsHeapSizeUsed) | 68 if (!r.counters || !r.counters.jsHeapSizeUsed) |
| 69 return; | 69 return; |
| 70 maxUsedHeapSize = Math.max(maxUsedHeapSize, r.counters.jsHeapSizeUse
d); | 70 maxUsedHeapSize = Math.max(maxUsedHeapSize, r.counters.jsHeapSizeUse
d); |
| 71 minUsedHeapSize = Math.min(minUsedHeapSize, r.counters.jsHeapSizeUse
d); | 71 minUsedHeapSize = Math.min(minUsedHeapSize, r.counters.jsHeapSizeUse
d); |
| 72 }); | 72 }); |
| 73 minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize); | 73 minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize); |
| 74 | 74 |
| 75 var width = this._canvas.width; | 75 var width = this._canvas.width; |
| 76 var height = this._canvas.height - lowerOffset; | 76 var height = this._canvas.height - lowerOffset; |
| 77 var xFactor = width / (maxTime - minTime); | 77 var xFactor = width / (maxTime - minTime); |
| 78 var yFactor = height / Math.max(maxUsedHeapSize - minUsedHeapSize, 1); | 78 var yFactor = height / Math.max(maxUsedHeapSize - minUsedHeapSize, 1); |
| 79 | 79 |
| 80 var histogram = new Array(width); | 80 var histogram = new Array(width); |
| 81 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r
) { | 81 this._model.forAllRecords(function(r) { |
| 82 if (!r.counters || !r.counters.jsHeapSizeUsed) | 82 if (!r.counters || !r.counters.jsHeapSizeUsed) |
| 83 return; | 83 return; |
| 84 var x = Math.round((r.endTime - minTime) * xFactor); | 84 var x = Math.round((r.endTime - minTime) * xFactor); |
| 85 var y = (r.counters.jsHeapSizeUsed - minUsedHeapSize) * yFactor; | 85 var y = (r.counters.jsHeapSizeUsed - minUsedHeapSize) * yFactor; |
| 86 histogram[x] = Math.max(histogram[x] || 0, y); | 86 histogram[x] = Math.max(histogram[x] || 0, y); |
| 87 }); | 87 }); |
| 88 | 88 |
| 89 var y = 0; | 89 var y = 0; |
| 90 var isFirstPoint = true; | 90 var isFirstPoint = true; |
| 91 var ctx = this._context; | 91 var ctx = this._context; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 120 ctx.strokeStyle = "#666"; | 120 ctx.strokeStyle = "#666"; |
| 121 ctx.stroke(); | 121 ctx.stroke(); |
| 122 ctx.restore(); | 122 ctx.restore(); |
| 123 | 123 |
| 124 this._maxHeapSizeLabel.textContent = Number.bytesToString(maxUsedHeapSiz
e); | 124 this._maxHeapSizeLabel.textContent = Number.bytesToString(maxUsedHeapSiz
e); |
| 125 this._minHeapSizeLabel.textContent = Number.bytesToString(minUsedHeapSiz
e); | 125 this._minHeapSizeLabel.textContent = Number.bytesToString(minUsedHeapSiz
e); |
| 126 }, | 126 }, |
| 127 | 127 |
| 128 __proto__: WebInspector.TimelineOverviewBase.prototype | 128 __proto__: WebInspector.TimelineOverviewBase.prototype |
| 129 } | 129 } |
| OLD | NEW |