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 25 matching lines...) Expand all Loading... |
36 WebInspector.TimelineMemoryOverview = function(model) | 36 WebInspector.TimelineMemoryOverview = function(model) |
37 { | 37 { |
38 WebInspector.TimelineOverviewBase.call(this, model); | 38 WebInspector.TimelineOverviewBase.call(this, model); |
39 this.element.id = "timeline-overview-memory"; | 39 this.element.id = "timeline-overview-memory"; |
40 | 40 |
41 this._maxHeapSizeLabel = this.element.createChild("div", "max memory-graph-l
abel"); | 41 this._maxHeapSizeLabel = this.element.createChild("div", "max memory-graph-l
abel"); |
42 this._minHeapSizeLabel = this.element.createChild("div", "min memory-graph-l
abel"); | 42 this._minHeapSizeLabel = this.element.createChild("div", "min memory-graph-l
abel"); |
43 } | 43 } |
44 | 44 |
45 WebInspector.TimelineMemoryOverview.prototype = { | 45 WebInspector.TimelineMemoryOverview.prototype = { |
| 46 resetHeapSizeLabels: function() |
| 47 { |
| 48 this._maxHeapSizeLabel.textContent = ""; |
| 49 this._minHeapSizeLabel.textContent = ""; |
| 50 }, |
| 51 |
46 update: function() | 52 update: function() |
47 { | 53 { |
48 this.resetCanvas(); | 54 this.resetCanvas(); |
49 | 55 |
50 var records = this._model.records; | 56 var records = this._model.records; |
51 if (!records.length) | 57 if (!records.length) { |
| 58 this.resetHeapSizeLabels(); |
52 return; | 59 return; |
| 60 } |
53 | 61 |
54 const lowerOffset = 3; | 62 const lowerOffset = 3; |
55 var maxUsedHeapSize = 0; | 63 var maxUsedHeapSize = 0; |
56 var minUsedHeapSize = 100000000000; | 64 var minUsedHeapSize = 100000000000; |
57 var minTime = this._model.minimumRecordTime(); | 65 var minTime = this._model.minimumRecordTime(); |
58 var maxTime = this._model.maximumRecordTime(); | 66 var maxTime = this._model.maximumRecordTime(); |
59 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r
) { | 67 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r
) { |
60 if (!r.counters || !r.counters.jsHeapSizeUsed) | 68 if (!r.counters || !r.counters.jsHeapSizeUsed) |
61 return; | 69 return; |
62 maxUsedHeapSize = Math.max(maxUsedHeapSize, r.counters.jsHeapSizeUse
d); | 70 maxUsedHeapSize = Math.max(maxUsedHeapSize, r.counters.jsHeapSizeUse
d); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 ctx.strokeStyle = "#666"; | 120 ctx.strokeStyle = "#666"; |
113 ctx.stroke(); | 121 ctx.stroke(); |
114 ctx.restore(); | 122 ctx.restore(); |
115 | 123 |
116 this._maxHeapSizeLabel.textContent = Number.bytesToString(maxUsedHeapSiz
e); | 124 this._maxHeapSizeLabel.textContent = Number.bytesToString(maxUsedHeapSiz
e); |
117 this._minHeapSizeLabel.textContent = Number.bytesToString(minUsedHeapSiz
e); | 125 this._minHeapSizeLabel.textContent = Number.bytesToString(minUsedHeapSiz
e); |
118 }, | 126 }, |
119 | 127 |
120 __proto__: WebInspector.TimelineOverviewBase.prototype | 128 __proto__: WebInspector.TimelineOverviewBase.prototype |
121 } | 129 } |
OLD | NEW |