summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 03:30:52 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 03:30:52 +0000
commitc5addfbb9cb0518d8346cc9b827c2a5e8c32957d (patch)
treef49834c75c5a078fc5b3554a21b004c6ddfe5692 /media
parent9e7a2dcebbbe2df2b019f213e3b39be53237e3ab (diff)
downloadchromium_src-c5addfbb9cb0518d8346cc9b827c2a5e8c32957d.zip
chromium_src-c5addfbb9cb0518d8346cc9b827c2a5e8c32957d.tar.gz
chromium_src-c5addfbb9cb0518d8346cc9b827c2a5e8c32957d.tar.bz2
Moved RefCountedThreadSafe from AssignableBuffer to base type Assignable.
Fixed some template naming and whitespace issues as well. Review URL: http://codereview.chromium.org/18854 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/buffers.h36
1 files changed, 25 insertions, 11 deletions
diff --git a/media/base/buffers.h b/media/base/buffers.h
index 7f0ddb8..7a3d856 100644
--- a/media/base/buffers.h
+++ b/media/base/buffers.h
@@ -124,31 +124,45 @@ class VideoFrame : public StreamSample {
};
+// An interface for receiving the results of an asynchronous read. Downstream
+// filters typically implement this interface or use AssignableBuffer and
+// provide it to upstream filters as a read request. When the upstream filter
+// has completed the read, they call SetBuffer/OnAssignment to notify the
+// downstream filter.
+//
+// TODO(scherkus): rethink the Assignable interface -- it's a bit kludgy.
template <class BufferType>
-class Assignable {
+class Assignable :
+ public base::RefCountedThreadSafe< Assignable<BufferType> > {
public:
// Assigns a buffer to the owner.
virtual void SetBuffer(BufferType* buffer) = 0;
// Notifies the owner that an assignment has been completed.
virtual void OnAssignment() = 0;
+
+ // TODO(scherkus): figure out a solution to friending a template.
+ // See http://www.comeaucomputing.com/techtalk/templates/#friendclassT for
+ // an explanation.
+ //protected:
+ // friend class base::RefCountedThreadSafe< Assignable<class T> >;
+ virtual ~Assignable() {}
};
// Template for easily creating Assignable buffers. Pass in the pointer of the
// object to receive the OnAssignment callback.
-template <class TOwner, class TBuffer>
-class AssignableBuffer : public Assignable<TBuffer>,
- public base::RefCountedThreadSafe< AssignableBuffer<TOwner, TBuffer> > {
+template <class OwnerType, class BufferType>
+class AssignableBuffer : public Assignable<BufferType> {
public:
- explicit AssignableBuffer(TOwner* owner)
+ explicit AssignableBuffer(BufferType* owner)
: owner_(owner),
buffer_(NULL) {
DCHECK(owner_);
}
- // AssignableBuffer<TBuffer> implementation.
- virtual void SetBuffer(TBuffer* buffer) {
+ // AssignableBuffer<BufferType> implementation.
+ virtual void SetBuffer(BufferType* buffer) {
buffer_ = buffer;
}
@@ -157,12 +171,12 @@ class AssignableBuffer : public Assignable<TBuffer>,
}
private:
- TOwner* owner_;
- scoped_refptr<TBuffer> buffer_;
+ OwnerType* owner_;
+ scoped_refptr<BufferType> buffer_;
DISALLOW_COPY_AND_ASSIGN(AssignableBuffer);
};
-} // namespace media
+} // namespace media
-#endif // MEDIA_BASE_BUFFERS_H_
+#endif // MEDIA_BASE_BUFFERS_H_