OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 cr.define('media', function() { | |
6 | |
7 /** | |
8 * This class holds a list of MediaLogEvents. | |
9 * It exposes an <li> element that contains a tabular list of said events, | |
10 * the time at which they occurred, and their parameters. | |
11 */ | |
12 function EventList() { | |
13 this.table_ = document.createElement('table'); | |
14 this.li = createDetailsLi(); | |
15 this.li.details.appendChild(this.table_); | |
16 this.li.summary.textContent = 'Log:'; | |
17 | |
18 this.startTime_ = null; | |
19 | |
20 var hrow = document.createElement('tr'); | |
arv (Not doing code reviews)
2011/08/16 19:29:03
hRow
Scott Franklin
2011/08/16 23:33:52
Done.
| |
21 hrow.appendChild(makeElement('th', 'Time:')); | |
22 hrow.appendChild(makeElement('th', 'Event:')); | |
23 hrow.appendChild(makeElement('th', 'Parameters:')); | |
24 var header = document.createElement('thead'); | |
25 header.appendChild(hrow); | |
26 this.table_.appendChild(header); | |
27 }; | |
28 | |
29 EventList.prototype = { | |
30 | |
31 /** | |
32 * Add an event to the list. It is stored as a new row in this.table_. | |
33 * @param {Object} event The MediaLogEvent that has occurred. | |
34 */ | |
35 addEvent: function(event) { | |
36 this.startTime_ = this.startTime_ || event.time; | |
37 event.time -= this.startTime_; | |
38 | |
39 var row = document.createElement('tr'); | |
40 row.appendChild(makeElement('td', media.round(event.time))); | |
41 row.appendChild(makeElement('td', event.type)); | |
42 params = []; | |
arv (Not doing code reviews)
2011/08/16 19:29:03
missing var
Scott Franklin
2011/08/16 23:33:52
Done.
| |
43 for (var p in event.params) | |
44 params.push(p + ': ' + event.params[p]); | |
45 row.appendChild(makeElement('td', params.join(', '))); | |
46 this.table_.appendChild(row); | |
47 }, | |
scherkus (not reviewing)
2011/08/16 19:18:29
trailing , ?
Scott Franklin
2011/08/16 23:33:52
Done.
| |
48 }; | |
49 | |
50 return { | |
51 EventList: EventList, | |
scherkus (not reviewing)
2011/08/16 19:18:29
trailing , ?
Scott Franklin
2011/08/16 23:33:52
Done.
| |
52 }; | |
53 }); | |
OLD | NEW |