Chromium Code Reviews| Index: content/browser/resources/media/manager.js |
| diff --git a/content/browser/resources/media/manager.js b/content/browser/resources/media/manager.js |
| index 1ba130181e592dbe80794f9f555296a69f7d5d7b..80cd03273b73c757addca182b580f9d1d522767d 100644 |
| --- a/content/browser/resources/media/manager.js |
| +++ b/content/browser/resources/media/manager.js |
| @@ -14,45 +14,47 @@ var Manager = (function() { |
| function Manager(clientRenderer) { |
| this.players_ = {}; |
| - this.audioStreams_ = {}; |
| + this.audioComponents_ = []; |
| this.clientRenderer_ = clientRenderer; |
| } |
| Manager.prototype = { |
| /** |
| - * Adds an audio-stream to the dictionary of audio-streams to manage. |
| - * @param id The unique-id of the audio-stream. |
| - */ |
| - addAudioStream: function(id) { |
| - this.audioStreams_[id] = this.audioStreams_[id] || {}; |
| - this.clientRenderer_.audioStreamAdded(this.audioStreams_, |
| - this.audioStreams_[id]); |
| - }, |
| - |
| - /** |
| - * Sets properties of an audiostream. |
| - * @param id The unique-id of the audio-stream. |
| - * @param properties A dictionary of properties to be added to the |
| - * audio-stream. |
| + * Updates an audio-component. |
| + * @param componentType Integer AudioComponent enum value; must match values |
| + * from the AudioLogFactory::AudioComponent enum. |
| + * @param componentId The unique-id of the audio-component. |
| + * @param componentData The actual component data dictionary. |
| */ |
| - updateAudioStream: function(id, properties) { |
| - for (var key in properties) { |
| - this.audioStreams_[id][key] = properties[key]; |
| + updateAudioComponent: function(componentType, componentId, componentData) { |
| + if (!(componentType in this.audioComponents_)) |
| + this.audioComponents_[componentType] = {}; |
| + if (!(componentId in this.audioComponents_[componentType])) { |
| + this.audioComponents_[componentType][componentId] = componentData; |
| + } else { |
| + for (var key in componentData) { |
| + this.audioComponents_[componentType][componentId][key] = |
|
acolwell GONE FROM CHROMIUM
2013/11/26 01:33:17
We want to create a union of all key/values here?
DaleCurtis
2013/11/26 03:02:21
Because each update doesn't necessary contain all
|
| + componentData[key]; |
| + } |
| } |
| - this.clientRenderer_.audioStreamAdded( |
| - this.audioStreams_, this.audioStreams_[id]); |
| + this.clientRenderer_.audioComponentAdded( |
| + componentType, this.audioComponents_[componentType]); |
| }, |
| /** |
| * Removes an audio-stream from the manager. |
| * @param id The unique-id of the audio-stream. |
| */ |
| - removeAudioStream: function(id) { |
| - this.clientRenderer_.audioStreamRemoved( |
| - this.audioStreams_, this.audioStreams_[id]); |
| - delete this.audioStreams_[id]; |
| - }, |
| + removeAudioComponent: function(componentType, componentId) { |
| + if (!(componentType in this.audioComponents_) || |
| + !(componentId in this.audioComponents_[componentType])) { |
|
acolwell GONE FROM CHROMIUM
2013/11/26 01:33:17
How can this happen? Isn't it a bug if it does?
DaleCurtis
2013/11/26 03:02:21
It's possible the first update sent to JavaScript
|
| + return; |
| + } |
| + delete this.audioComponents_[componentType][componentId]; |
| + this.clientRenderer_.audioComponentRemoved( |
| + componentType, this.audioComponents_[componentType]); |
| + }, |
| /** |
| * Adds a player to the list of players to manage. |