Chromium Code Reviews| Index: media/audio/audio_device_thread.h |
| =================================================================== |
| --- media/audio/audio_device_thread.h (revision 185810) |
| +++ media/audio/audio_device_thread.h (working copy) |
| @@ -8,6 +8,7 @@ |
| #include "base/basictypes.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/scoped_vector.h" |
| #include "base/shared_memory.h" |
| #include "base/sync_socket.h" |
| #include "base/synchronization/lock.h" |
| @@ -36,8 +37,10 @@ |
| // thread owned by AudioDeviceThread. |
| class Callback { |
| public: |
| + typedef std::vector<base::SharedMemoryHandle> SharedMemoryHandleVector; |
| + |
| Callback(const AudioParameters& audio_parameters, |
| - base::SharedMemoryHandle memory, |
| + SharedMemoryHandleVector& memory, |
| int memory_length); |
| virtual ~Callback(); |
| @@ -49,7 +52,7 @@ |
| virtual void MapSharedMemory() = 0; |
| // Called whenever we receive notifications about pending data. |
|
henrika (OOO until Aug 14)
2013/03/04 13:12:51
No comment about |index|.
wjia(left Chromium)
2013/03/05 02:40:13
Done.
|
| - virtual void Process(int pending_data) = 0; |
| + virtual void Process(int pending_data, int index) = 0; |
| protected: |
| // Protected so that derived classes can access directly. |
| @@ -59,14 +62,14 @@ |
| const int samples_per_ms_; |
| const int bytes_per_ms_; |
| - base::SharedMemory shared_memory_; |
| + ScopedVector<base::SharedMemory> shared_memory_; |
| const int memory_length_; |
| private: |
| DISALLOW_COPY_AND_ASSIGN(Callback); |
| }; |
| - AudioDeviceThread(); |
| + AudioDeviceThread(bool read_index); |
| ~AudioDeviceThread(); |
| // Starts the audio thread. The thread must not already be running. |
| @@ -98,6 +101,9 @@ |
| // reliable initialization. |
| class Thread; |
| + // Flag indicating whether need to read index from sync socket. |
| + bool read_index_; |
|
henrika (OOO until Aug 14)
2013/03/04 13:12:51
It feels odd to use index as name in a flag. When
wjia(left Chromium)
2013/03/05 02:40:13
Changed name to need_read_index_ to be self explai
|
| + |
| base::Lock thread_lock_; |
| scoped_refptr<AudioDeviceThread::Thread> thread_; |