Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Unified Diff: media/base/mock_reader.h

Issue 10669022: Add status parameter to DemuxerStream::ReadCB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/mock_reader.h
diff --git a/media/base/mock_reader.h b/media/base/mock_reader.h
index b0076840357daac3a2199472c94955ac343f9ef9..8a4fe409377f313eada699e784ba71d578496f88 100644
--- a/media/base/mock_reader.h
+++ b/media/base/mock_reader.h
@@ -15,16 +15,15 @@ namespace media {
// Ref counted object so we can create callbacks for asynchronous Read()
// methods for any filter type.
-template <class FilterType, class BufferType>
-class MockReader
- : public base::RefCountedThreadSafe<MockReader<FilterType, BufferType> > {
+class DemuxerStreamReader
Ami GONE FROM CHROMIUM 2012/06/26 00:33:21 rename file?
acolwell GONE FROM CHROMIUM 2012/07/12 01:19:38 Removed file in a separate CL.
+ : public base::RefCountedThreadSafe<DemuxerStreamReader> {
public:
- MockReader()
+ DemuxerStreamReader()
: called_(false),
expecting_call_(false) {
}
- virtual ~MockReader() {
+ virtual ~DemuxerStreamReader() {
}
// Prepares this object for another read.
@@ -32,33 +31,38 @@ class MockReader
DCHECK(!expecting_call_);
expecting_call_ = false;
called_ = false;
+ status_ = DemuxerStream::kAborted;
buffer_ = NULL;
}
- // Executes an asynchronous read on the given filter.
- void Read(FilterType* filter) {
+ // Executes an asynchronous read on the DemuxerStream.
+ void Read(DemuxerStream* filter) {
DCHECK(!expecting_call_);
called_ = false;
expecting_call_ = true;
- filter->Read(base::Bind(&MockReader::OnReadComplete, this));
+ filter->Read(base::Bind(&DemuxerStreamReader::OnReadComplete, this));
}
// Mock accessors.
- BufferType* buffer() { return buffer_; }
+ DecoderBuffer* buffer() { return buffer_; }
bool called() { return called_; }
bool expecting_call() { return expecting_call_; }
private:
- void OnReadComplete(const scoped_refptr<BufferType>& buffer) {
+ void OnReadComplete(DemuxerStream::Status status,
+ const scoped_refptr<DecoderBuffer>& buffer) {
DCHECK(!called_);
DCHECK(expecting_call_);
expecting_call_ = false;
called_ = true;
+ status_ = status;
buffer_ = buffer;
}
+ DemuxerStream::Status status_;
+
// Reference to the buffer provided in the callback.
- scoped_refptr<BufferType> buffer_;
+ scoped_refptr<DecoderBuffer> buffer_;
// Whether or not the callback was executed.
bool called_;
@@ -66,12 +70,9 @@ class MockReader
// Whether or not this reader was expecting a callback.
bool expecting_call_;
- DISALLOW_COPY_AND_ASSIGN(MockReader);
+ DISALLOW_COPY_AND_ASSIGN(DemuxerStreamReader);
};
-// Commonly used reader types.
-typedef MockReader<DemuxerStream, DecoderBuffer> DemuxerStreamReader;
-
} // namespace media
#endif // MEDIA_BASE_MOCK_READER_H_

Powered by Google App Engine
This is Rietveld 408576698