| 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 /** | 30 /** |
| 31 * @implements {WebInspector.TimelineModeView} | 31 * @implements {Timeline.TimelineModeView} |
| 32 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 WebInspector.MemoryCountersGraph = class extends WebInspector.CountersGraph { | 34 Timeline.MemoryCountersGraph = class extends Timeline.CountersGraph { |
| 35 /** | 35 /** |
| 36 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 36 * @param {!Timeline.TimelineModeViewDelegate} delegate |
| 37 * @param {!WebInspector.TimelineModel} model | 37 * @param {!TimelineModel.TimelineModel} model |
| 38 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters | 38 * @param {!Array<!TimelineModel.TimelineModel.Filter>} filters |
| 39 */ | 39 */ |
| 40 constructor(delegate, model, filters) { | 40 constructor(delegate, model, filters) { |
| 41 super(delegate, model, filters); | 41 super(delegate, model, filters); |
| 42 this._countersByName = {}; | 42 this._countersByName = {}; |
| 43 this._countersByName['jsHeapSizeUsed'] = this.createCounter( | 43 this._countersByName['jsHeapSizeUsed'] = this.createCounter( |
| 44 WebInspector.UIString('JS Heap'), WebInspector.UIString('JS Heap: %s'),
'hsl(220, 90%, 43%)', | 44 Common.UIString('JS Heap'), Common.UIString('JS Heap: %s'), 'hsl(220, 90
%, 43%)', |
| 45 Number.bytesToString); | 45 Number.bytesToString); |
| 46 this._countersByName['documents'] = this.createCounter( | 46 this._countersByName['documents'] = this.createCounter( |
| 47 WebInspector.UIString('Documents'), WebInspector.UIString('Documents: %s
'), 'hsl(0, 90%, 43%)'); | 47 Common.UIString('Documents'), Common.UIString('Documents: %s'), 'hsl(0,
90%, 43%)'); |
| 48 this._countersByName['nodes'] = | 48 this._countersByName['nodes'] = |
| 49 this.createCounter(WebInspector.UIString('Nodes'), WebInspector.UIString
('Nodes: %s'), 'hsl(120, 90%, 43%)'); | 49 this.createCounter(Common.UIString('Nodes'), Common.UIString('Nodes: %s'
), 'hsl(120, 90%, 43%)'); |
| 50 this._countersByName['jsEventListeners'] = this.createCounter( | 50 this._countersByName['jsEventListeners'] = this.createCounter( |
| 51 WebInspector.UIString('Listeners'), WebInspector.UIString('Listeners: %s
'), 'hsl(38, 90%, 43%)'); | 51 Common.UIString('Listeners'), Common.UIString('Listeners: %s'), 'hsl(38,
90%, 43%)'); |
| 52 this._gpuMemoryCounter = this.createCounter( | 52 this._gpuMemoryCounter = this.createCounter( |
| 53 WebInspector.UIString('GPU Memory'), WebInspector.UIString('GPU Memory [
KB]: %s'), 'hsl(300, 90%, 43%)', | 53 Common.UIString('GPU Memory'), Common.UIString('GPU Memory [KB]: %s'), '
hsl(300, 90%, 43%)', |
| 54 Number.bytesToString); | 54 Number.bytesToString); |
| 55 this._countersByName['gpuMemoryUsedKB'] = this._gpuMemoryCounter; | 55 this._countersByName['gpuMemoryUsedKB'] = this._gpuMemoryCounter; |
| 56 } | 56 } |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * @override | 59 * @override |
| 60 */ | 60 */ |
| 61 refreshRecords() { | 61 refreshRecords() { |
| 62 this.reset(); | 62 this.reset(); |
| 63 var events = this._model.mainThreadEvents(); | 63 var events = this._model.mainThreadEvents(); |
| 64 for (var i = 0; i < events.length; ++i) { | 64 for (var i = 0; i < events.length; ++i) { |
| 65 var event = events[i]; | 65 var event = events[i]; |
| 66 if (event.name !== WebInspector.TimelineModel.RecordType.UpdateCounters) | 66 if (event.name !== TimelineModel.TimelineModel.RecordType.UpdateCounters) |
| 67 continue; | 67 continue; |
| 68 | 68 |
| 69 var counters = event.args.data; | 69 var counters = event.args.data; |
| 70 if (!counters) | 70 if (!counters) |
| 71 return; | 71 return; |
| 72 for (var name in counters) { | 72 for (var name in counters) { |
| 73 var counter = this._countersByName[name]; | 73 var counter = this._countersByName[name]; |
| 74 if (counter) | 74 if (counter) |
| 75 counter.appendSample(event.startTime, counters[name]); | 75 counter.appendSample(event.startTime, counters[name]); |
| 76 } | 76 } |
| 77 | 77 |
| 78 var gpuMemoryLimitCounterName = 'gpuMemoryLimitKB'; | 78 var gpuMemoryLimitCounterName = 'gpuMemoryLimitKB'; |
| 79 if (gpuMemoryLimitCounterName in counters) | 79 if (gpuMemoryLimitCounterName in counters) |
| 80 this._gpuMemoryCounter.setLimit(counters[gpuMemoryLimitCounterName]); | 80 this._gpuMemoryCounter.setLimit(counters[gpuMemoryLimitCounterName]); |
| 81 } | 81 } |
| 82 this.scheduleRefresh(); | 82 this.scheduleRefresh(); |
| 83 } | 83 } |
| 84 }; | 84 }; |
| OLD | NEW |