OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * This class provides data access interface for dump file profiler. | 6 * This class provides data access interface for dump file profiler. |
7 * @constructor | 7 * @constructor |
8 */ | 8 */ |
9 var Profiler = function(jsonData, template) { | 9 var Profiler = function(jsonData, template) { |
10 this.jsonData_ = jsonData; | 10 this.jsonData_ = jsonData; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 /** | 53 /** |
54 * Calcualte initial models according default template. | 54 * Calcualte initial models according default template. |
55 */ | 55 */ |
56 Profiler.prototype.reparse = function() { | 56 Profiler.prototype.reparse = function() { |
57 this.models_ = this.parseTemplate_(); | 57 this.models_ = this.parseTemplate_(); |
58 this.emit('changed', this.models_); | 58 this.emit('changed', this.models_); |
59 }; | 59 }; |
60 | 60 |
61 /** | 61 /** |
| 62 * Get current breakdown template. |
| 63 * @return {Object} current breakdown template. |
| 64 */ |
| 65 Profiler.prototype.getTemplate = function() { |
| 66 return this.template_; |
| 67 }; |
| 68 |
| 69 /** |
| 70 * Get run_id of current profiler. |
| 71 * @return {string} run_id of current profiler. |
| 72 */ |
| 73 Profiler.prototype.getRunId = function() { |
| 74 return this.jsonData_['run_id']; |
| 75 }; |
| 76 |
| 77 /** |
62 * To be called by view when new model being selected. | 78 * To be called by view when new model being selected. |
63 * And then triggers all relative views to update. | 79 * And then triggers all relative views to update. |
64 */ | 80 */ |
65 Profiler.prototype.setSelected = function(id) { | 81 Profiler.prototype.setSelected = function(id) { |
66 this.selected_ = id; | 82 this.selected_ = id; |
67 this.emit('changed:selected', id); | 83 this.emit('changed:selected', id); |
68 }; | 84 }; |
69 | 85 |
70 /** | 86 /** |
71 * Get all models throughout the whole timeline of given id. | 87 * Get all models throughout the whole timeline of given id. |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 localUnits = localUnits.map(function(unitID) { | 298 localUnits = localUnits.map(function(unitID) { |
283 return parseInt(unitID, 10); | 299 return parseInt(unitID, 10); |
284 }); | 300 }); |
285 | 301 |
286 var retVal = | 302 var retVal = |
287 self.accumulate_(self.template_, snapshot, worldUnits, localUnits); | 303 self.accumulate_(self.template_, snapshot, worldUnits, localUnits); |
288 calModelId(retVal.model, []); | 304 calModelId(retVal.model, []); |
289 return retVal.model; | 305 return retVal.model; |
290 }); | 306 }); |
291 }; | 307 }; |
OLD | NEW |