Index: webrtc/base/bufferqueue.h |
diff --git a/webrtc/base/bufferqueue.h b/webrtc/base/bufferqueue.h |
index 4941fccf2e1c6233584c21588e34991a312e41e3..458f0189cdbe541301cbd9e5bacacdd953a67db7 100644 |
--- a/webrtc/base/bufferqueue.h |
+++ b/webrtc/base/bufferqueue.h |
@@ -21,26 +21,33 @@ namespace rtc { |
class BufferQueue { |
public: |
- // Creates a buffer queue queue with a given capacity and default buffer size. |
+ // Creates a buffer queue with a given capacity and default buffer size. |
BufferQueue(size_t capacity, size_t default_size); |
- ~BufferQueue(); |
+ virtual ~BufferQueue(); |
// Return number of queued buffers. |
size_t size() const; |
// ReadFront will only read one buffer at a time and will truncate buffers |
// that don't fit in the passed memory. |
+ // Returns true unless no data could be returned. |
bool ReadFront(void* data, size_t bytes, size_t* bytes_read); |
// WriteBack always writes either the complete memory or nothing. |
+ // Returns true unless no data could be written. |
bool WriteBack(const void* data, size_t bytes, size_t* bytes_written); |
+ protected: |
+ // These methods are called when the state of the queue changes. |
+ virtual void NotifyReadableForTest() {} |
+ virtual void NotifyWritableForTest() {} |
+ |
private: |
size_t capacity_; |
size_t default_size_; |
- std::deque<Buffer*> queue_; |
- std::vector<Buffer*> free_list_; |
- mutable CriticalSection crit_; // object lock |
+ mutable CriticalSection crit_; |
+ std::deque<Buffer*> queue_ GUARDED_BY(crit_); |
+ std::vector<Buffer*> free_list_ GUARDED_BY(crit_); |
RTC_DISALLOW_COPY_AND_ASSIGN(BufferQueue); |
}; |