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 16 matching lines...) Expand all Loading... |
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 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @extends {WebInspector.CountersGraph} | 33 * @extends {WebInspector.CountersGraph} |
34 * @implements {WebInspector.TimelineModeView} | 34 * @implements {WebInspector.TimelineModeView} |
35 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 35 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
36 * @param {!WebInspector.TimelineModel} model | 36 * @param {!WebInspector.TimelineModel} model |
37 * @param {!WebInspector.TimelineUIUtils} uiUtils | |
38 */ | 37 */ |
39 WebInspector.MemoryCountersGraph = function(delegate, model, uiUtils) | 38 WebInspector.MemoryCountersGraph = function(delegate, model) |
40 { | 39 { |
41 WebInspector.CountersGraph.call(this, WebInspector.UIString("MEMORY"), deleg
ate, model); | 40 WebInspector.CountersGraph.call(this, WebInspector.UIString("MEMORY"), deleg
ate, model); |
42 this._uiUtils = uiUtils; | |
43 this._countersByName = {}; | 41 this._countersByName = {}; |
44 this._countersByName["jsHeapSizeUsed"] = this.createCounter(WebInspector.UIS
tring("Used JS Heap"), WebInspector.UIString("JS Heap Size: %d"), "hsl(220, 90%,
43%)"); | 42 this._countersByName["jsHeapSizeUsed"] = this.createCounter(WebInspector.UIS
tring("Used JS Heap"), WebInspector.UIString("JS Heap Size: %d"), "hsl(220, 90%,
43%)"); |
45 this._countersByName["documents"] = this.createCounter(WebInspector.UIString
("Documents"), WebInspector.UIString("Documents: %d"), "hsl(0, 90%, 43%)"); | 43 this._countersByName["documents"] = this.createCounter(WebInspector.UIString
("Documents"), WebInspector.UIString("Documents: %d"), "hsl(0, 90%, 43%)"); |
46 this._countersByName["nodes"] = this.createCounter(WebInspector.UIString("No
des"), WebInspector.UIString("Nodes: %d"), "hsl(120, 90%, 43%)"); | 44 this._countersByName["nodes"] = this.createCounter(WebInspector.UIString("No
des"), WebInspector.UIString("Nodes: %d"), "hsl(120, 90%, 43%)"); |
47 this._countersByName["jsEventListeners"] = this.createCounter(WebInspector.U
IString("Listeners"), WebInspector.UIString("Listeners: %d"), "hsl(38, 90%, 43%)
"); | 45 this._countersByName["jsEventListeners"] = this.createCounter(WebInspector.U
IString("Listeners"), WebInspector.UIString("Listeners: %d"), "hsl(38, 90%, 43%)
"); |
48 if (Runtime.experiments.isEnabled("gpuTimeline")) { | 46 if (Runtime.experiments.isEnabled("gpuTimeline")) { |
49 this._gpuMemoryCounter = this.createCounter(WebInspector.UIString("GPU M
emory"), WebInspector.UIString("GPU Memory [KB]: %d"), "hsl(300, 90%, 43%)"); | 47 this._gpuMemoryCounter = this.createCounter(WebInspector.UIString("GPU M
emory"), WebInspector.UIString("GPU Memory [KB]: %d"), "hsl(300, 90%, 43%)"); |
50 this._countersByName["gpuMemoryUsedKB"] = this._gpuMemoryCounter; | 48 this._countersByName["gpuMemoryUsedKB"] = this._gpuMemoryCounter; |
51 } | 49 } |
52 } | 50 } |
(...skipping 15 matching lines...) Expand all Loading... |
68 { | 66 { |
69 this.reset(); | 67 this.reset(); |
70 var records = this._model.records(); | 68 var records = this._model.records(); |
71 | 69 |
72 /** | 70 /** |
73 * @param {!WebInspector.TimelineModel.Record} record | 71 * @param {!WebInspector.TimelineModel.Record} record |
74 * @this {!WebInspector.MemoryCountersGraph} | 72 * @this {!WebInspector.MemoryCountersGraph} |
75 */ | 73 */ |
76 function addStatistics(record) | 74 function addStatistics(record) |
77 { | 75 { |
78 var counters = this._uiUtils.countersForRecord(record); | 76 var counters = WebInspector.TimelineUIUtils.isCoalescable.countersFo
rRecord(record); |
79 if (!counters) | 77 if (!counters) |
80 return; | 78 return; |
81 for (var name in counters) { | 79 for (var name in counters) { |
82 var counter = this._countersByName[name]; | 80 var counter = this._countersByName[name]; |
83 if (counter) | 81 if (counter) |
84 counter.appendSample(record.endTime() || record.startTime(),
counters[name]); | 82 counter.appendSample(record.endTime() || record.startTime(),
counters[name]); |
85 } | 83 } |
86 | 84 |
87 var gpuMemoryLimitCounterName = "gpuMemoryLimitKB"; | 85 var gpuMemoryLimitCounterName = "gpuMemoryLimitKB"; |
88 if (this._gpuMemoryCounter && (gpuMemoryLimitCounterName in counters
)) | 86 if (this._gpuMemoryCounter && (gpuMemoryLimitCounterName in counters
)) |
89 this._gpuMemoryCounter.setLimit(counters[gpuMemoryLimitCounterNa
me]); | 87 this._gpuMemoryCounter.setLimit(counters[gpuMemoryLimitCounterNa
me]); |
90 } | 88 } |
91 WebInspector.TimelineModel.forAllRecords(records, null, addStatistics.bi
nd(this)); | 89 WebInspector.TimelineModel.forAllRecords(records, null, addStatistics.bi
nd(this)); |
92 this.scheduleRefresh(); | 90 this.scheduleRefresh(); |
93 }, | 91 }, |
94 | 92 |
95 __proto__: WebInspector.CountersGraph.prototype | 93 __proto__: WebInspector.CountersGraph.prototype |
96 } | 94 } |
OLD | NEW |