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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 * @param {!WebInspector.TimelineModel.Record} record | 62 * @param {!WebInspector.TimelineModel.Record} record |
63 */ | 63 */ |
64 addRecord: function(record) | 64 addRecord: function(record) |
65 { | 65 { |
66 /** | 66 /** |
67 * @param {!WebInspector.TimelineModel.Record} record | 67 * @param {!WebInspector.TimelineModel.Record} record |
68 * @this {!WebInspector.MemoryCountersGraph} | 68 * @this {!WebInspector.MemoryCountersGraph} |
69 */ | 69 */ |
70 function addStatistics(record) | 70 function addStatistics(record) |
71 { | 71 { |
72 if (record.type() !== WebInspector.TimelineModel.RecordType.UpdateCo
unters) | 72 var counters = record.counters(); |
| 73 if (!counters) |
73 return; | 74 return; |
74 var counters = record.data(); | |
75 for (var name in counters) { | 75 for (var name in counters) { |
76 var counter = this._countersByName[name]; | 76 var counter = this._countersByName[name]; |
77 if (counter) | 77 if (counter) |
78 counter.appendSample(record.endTime() || record.startTime(),
counters[name]); | 78 counter.appendSample(record.endTime() || record.startTime(),
counters[name]); |
79 } | 79 } |
80 | 80 |
81 var gpuMemoryLimitCounterName = "gpuMemoryLimitKB"; | 81 var gpuMemoryLimitCounterName = "gpuMemoryLimitKB"; |
82 if (this._gpuMemoryCounter && (gpuMemoryLimitCounterName in counters
)) | 82 if (this._gpuMemoryCounter && (gpuMemoryLimitCounterName in counters
)) |
83 this._gpuMemoryCounter.setLimit(counters[gpuMemoryLimitCounterNa
me]); | 83 this._gpuMemoryCounter.setLimit(counters[gpuMemoryLimitCounterNa
me]); |
84 } | 84 } |
85 WebInspector.TimelineModel.forAllRecords([record], null, addStatistics.b
ind(this)); | 85 WebInspector.TimelineModel.forAllRecords([record], null, addStatistics.b
ind(this)); |
86 this.scheduleRefresh(); | 86 this.scheduleRefresh(); |
87 }, | 87 }, |
88 | 88 |
89 refreshRecords: function() | 89 refreshRecords: function() |
90 { | 90 { |
91 this.reset(); | 91 this.reset(); |
92 var records = this._model.records(); | 92 var records = this._model.records(); |
93 for (var i = 0; i < records.length; ++i) | 93 for (var i = 0; i < records.length; ++i) |
94 this.addRecord(records[i]); | 94 this.addRecord(records[i]); |
95 }, | 95 }, |
96 | 96 |
97 __proto__: WebInspector.CountersGraph.prototype | 97 __proto__: WebInspector.CountersGraph.prototype |
98 } | 98 } |
OLD | NEW |