| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('media', function() { | 5 cr.define('media', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * This class holds a list of MediaLogEvents. | 9 * This class holds a list of MediaLogEvents. |
| 10 * It inherits from <li> and contains a tabular list of said events, | 10 * It inherits from <li> and contains a tabular list of said events, |
| 11 * the time at which they occurred, and their parameters. | 11 * the time at which they occurred, and their parameters. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 42 */ | 42 */ |
| 43 addEvent: function(event) { | 43 addEvent: function(event) { |
| 44 var timeInMs = event.time * 1000; // Work with milliseconds. | 44 var timeInMs = event.time * 1000; // Work with milliseconds. |
| 45 this.startTime_ = this.startTime_ || timeInMs; | 45 this.startTime_ = this.startTime_ || timeInMs; |
| 46 timeInMs -= this.startTime_; | 46 timeInMs -= this.startTime_; |
| 47 | 47 |
| 48 var row = document.createElement('tr'); | 48 var row = document.createElement('tr'); |
| 49 row.appendChild(media.makeElement('td', timeInMs.toFixed(1))); | 49 row.appendChild(media.makeElement('td', timeInMs.toFixed(1))); |
| 50 row.appendChild(media.makeElement('td', event.type)); | 50 row.appendChild(media.makeElement('td', event.type)); |
| 51 var params = []; | 51 var params = []; |
| 52 for (var i = 0; i < event.params.length; ++i) { | 52 for (var key in event.params) { |
| 53 params.push(i + ': ' + event.params[i]); | 53 params.push(key + ': ' + event.params[key]); |
| 54 } | 54 } |
| 55 | 55 |
| 56 row.appendChild(media.makeElement('td', params.join(', '))); | 56 row.appendChild(media.makeElement('td', params.join(', '))); |
| 57 this.table_.appendChild(row); | 57 this.table_.appendChild(row); |
| 58 } | 58 } |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 return { | 61 return { |
| 62 EventList: EventList | 62 EventList: EventList |
| 63 }; | 63 }; |
| 64 }); | 64 }); |
| OLD | NEW |