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

Side by Side Diff: media/base/data_buffer.h

Issue 9015015: Take advantage of the new Pass() machinery on scoped_ptr{,_malloc}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/composite_data_source_factory.cc ('k') | media/base/data_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A simple implementation of Buffer that takes ownership of the given data 5 // A simple implementation of Buffer that takes ownership of the given data
6 // pointer. 6 // pointer.
7 // 7 //
8 // DataBuffer assumes that memory was allocated with new uint8[]. 8 // DataBuffer assumes that memory was allocated with new uint8[].
9 9
10 #ifndef MEDIA_BASE_DATA_BUFFER_H_ 10 #ifndef MEDIA_BASE_DATA_BUFFER_H_
11 #define MEDIA_BASE_DATA_BUFFER_H_ 11 #define MEDIA_BASE_DATA_BUFFER_H_
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "media/base/buffers.h" 14 #include "media/base/buffers.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 class MEDIA_EXPORT DataBuffer : public Buffer { 18 class MEDIA_EXPORT DataBuffer : public Buffer {
19 public: 19 public:
20 // Takes ownership of the passed |buffer|, assumes valid data of size 20 // Assumes valid data of size |buffer_size|.
21 // |buffer_size|. 21 DataBuffer(scoped_array<uint8> buffer, size_t buffer_size);
22 DataBuffer(uint8* buffer, size_t buffer_size);
23 22
24 // Allocates buffer of size |buffer_size|. If |buffer_size| is 0, |data_| is 23 // Allocates buffer of size |buffer_size|. If |buffer_size| is 0, |data_| is
25 // set to a NULL ptr. 24 // set to a NULL ptr.
26 explicit DataBuffer(size_t buffer_size); 25 explicit DataBuffer(size_t buffer_size);
27 26
28 // Buffer implementation. 27 // Buffer implementation.
29 virtual const uint8* GetData() const OVERRIDE; 28 virtual const uint8* GetData() const OVERRIDE;
30 virtual size_t GetDataSize() const OVERRIDE; 29 virtual size_t GetDataSize() const OVERRIDE;
31 30
32 // Returns a read-write pointer to the buffer data. 31 // Returns a read-write pointer to the buffer data.
(...skipping 13 matching lines...) Expand all
46 scoped_array<uint8> data_; 45 scoped_array<uint8> data_;
47 size_t buffer_size_; 46 size_t buffer_size_;
48 size_t data_size_; 47 size_t data_size_;
49 48
50 DISALLOW_COPY_AND_ASSIGN(DataBuffer); 49 DISALLOW_COPY_AND_ASSIGN(DataBuffer);
51 }; 50 };
52 51
53 } // namespace media 52 } // namespace media
54 53
55 #endif // MEDIA_BASE_DATA_BUFFER_H_ 54 #endif // MEDIA_BASE_DATA_BUFFER_H_
OLDNEW
« no previous file with comments | « media/base/composite_data_source_factory.cc ('k') | media/base/data_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698