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

Unified Diff: media/base/data_buffer.h

Issue 149573: Refactor WritableBuffer interface for more useful ptr management. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « media/base/buffers.h ('k') | media/base/data_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/data_buffer.h
===================================================================
--- media/base/data_buffer.h (revision 20532)
+++ media/base/data_buffer.h (working copy)
@@ -5,32 +5,40 @@
// A simple implementation of WritableBuffer that takes ownership of
// the given data pointer.
//
-// DataBuffer assumes that memory was allocated with new char[].
+// DataBuffer assumes that memory was allocated with new uint8[].
#ifndef MEDIA_BASE_DATA_BUFFER_H_
#define MEDIA_BASE_DATA_BUFFER_H_
+#include "base/scoped_ptr.h"
#include "media/base/buffers.h"
namespace media {
class DataBuffer : public WritableBuffer {
public:
- DataBuffer();
+ // Takes ownership of the passed |buffer|, assumes valid data of size
+ // |buffer_size|.
+ DataBuffer(uint8* buffer, size_t buffer_size);
+ // Allocates buffer of size |buffer_size|. If |buffer_size| is 0, |data_| is
+ // set to a NULL ptr.
+ explicit DataBuffer(size_t buffer_size);
+
// Buffer implementation.
virtual const uint8* GetData() const;
virtual size_t GetDataSize() const;
// WritableBuffer implementation.
- virtual uint8* GetWritableData(size_t buffer_size);
+ virtual uint8* GetWritableData();
virtual void SetDataSize(size_t data_size);
+ virtual size_t GetBufferSize() const;
protected:
virtual ~DataBuffer();
private:
- uint8* data_;
+ scoped_array<uint8> data_;
size_t buffer_size_;
size_t data_size_;
};
« no previous file with comments | « media/base/buffers.h ('k') | media/base/data_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698