| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // MessageFilter that handles audio messages and delegates them to audio | 5 // MessageFilter that handles audio messages and delegates them to audio |
| 6 // renderers. Created on render thread, AudioMessageFilter is operated on | 6 // renderers. Created on render thread, AudioMessageFilter is operated on |
| 7 // IO thread (main thread of render process), it intercepts audio messages | 7 // IO thread (main thread of render process), it intercepts audio messages |
| 8 // and process them on IO thread since these messages are time critical. | 8 // and process them on IO thread since these messages are time critical. |
| 9 | 9 |
| 10 #ifndef CHROME_RENDERER_AUDIO_MESSAGE_FILTER_H_ | 10 #ifndef CHROME_RENDERER_AUDIO_MESSAGE_FILTER_H_ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 const base::Time& message_timestamp) = 0; | 24 const base::Time& message_timestamp) = 0; |
| 25 | 25 |
| 26 // Called when state of an audio stream has changed in the browser process. | 26 // Called when state of an audio stream has changed in the browser process. |
| 27 virtual void OnStateChanged(ViewMsg_AudioStreamState state) = 0; | 27 virtual void OnStateChanged(ViewMsg_AudioStreamState state) = 0; |
| 28 | 28 |
| 29 // Called when an audio stream has been created in the browser process. | 29 // Called when an audio stream has been created in the browser process. |
| 30 virtual void OnCreated(base::SharedMemoryHandle handle, size_t length) = 0; | 30 virtual void OnCreated(base::SharedMemoryHandle handle, size_t length) = 0; |
| 31 | 31 |
| 32 // Called when notification of stream volume is received from the browser | 32 // Called when notification of stream volume is received from the browser |
| 33 // process. | 33 // process. |
| 34 virtual void OnVolume(double left, double right) = 0; | 34 virtual void OnVolume(double volume) = 0; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 AudioMessageFilter(int32 route_id); | 37 explicit AudioMessageFilter(int32 route_id); |
| 38 ~AudioMessageFilter(); | 38 ~AudioMessageFilter(); |
| 39 | 39 |
| 40 // Add a delegate to the map and return id of the entry. | 40 // Add a delegate to the map and return id of the entry. |
| 41 int32 AddDelegate(Delegate* delegate); | 41 int32 AddDelegate(Delegate* delegate); |
| 42 | 42 |
| 43 // Remove a delegate referenced by |id| from the map. | 43 // Remove a delegate referenced by |id| from the map. |
| 44 void RemoveDelegate(int32 id); | 44 void RemoveDelegate(int32 id); |
| 45 | 45 |
| 46 // Sends an IPC message using |channel_|. | 46 // Sends an IPC message using |channel_|. |
| 47 bool Send(IPC::Message* message); | 47 bool Send(IPC::Message* message); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 64 | 64 |
| 65 // Received when browser process has created an audio output stream. | 65 // Received when browser process has created an audio output stream. |
| 66 void OnStreamCreated(int stream_id, base::SharedMemoryHandle handle, | 66 void OnStreamCreated(int stream_id, base::SharedMemoryHandle handle, |
| 67 int length); | 67 int length); |
| 68 | 68 |
| 69 // Received when internal state of browser process' audio output device has | 69 // Received when internal state of browser process' audio output device has |
| 70 // changed. | 70 // changed. |
| 71 void OnStreamStateChanged(int stream_id, ViewMsg_AudioStreamState state); | 71 void OnStreamStateChanged(int stream_id, ViewMsg_AudioStreamState state); |
| 72 | 72 |
| 73 // Notification of volume property of an audio output stream. | 73 // Notification of volume property of an audio output stream. |
| 74 void OnStreamVolume(int stream_id, double left, double right); | 74 void OnStreamVolume(int stream_id, double volume); |
| 75 | 75 |
| 76 // A map of stream ids to delegates. | 76 // A map of stream ids to delegates. |
| 77 IDMap<Delegate> delegates_; | 77 IDMap<Delegate> delegates_; |
| 78 | 78 |
| 79 IPC::Channel* channel_; | 79 IPC::Channel* channel_; |
| 80 | 80 |
| 81 int32 route_id_; | 81 int32 route_id_; |
| 82 | 82 |
| 83 MessageLoop* message_loop_; | 83 MessageLoop* message_loop_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(AudioMessageFilter); | 85 DISALLOW_COPY_AND_ASSIGN(AudioMessageFilter); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 #endif // CHROME_RENDERER_AUDIO_MESSAGE_FITLER_H_ | 88 #endif // CHROME_RENDERER_AUDIO_MESSAGE_FILTER_H_ |
| 89 |
| OLD | NEW |