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

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

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/data_buffer.h ('k') | media/base/filter_collection.h » ('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 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "media/base/data_buffer.h" 6 #include "media/base/data_buffer.h"
7 7
8 namespace media { 8 namespace media {
9 9
10 DataBuffer::DataBuffer(uint8* buffer, size_t buffer_size) 10 DataBuffer::DataBuffer(scoped_array<uint8> buffer, size_t buffer_size)
11 : data_(buffer), 11 : data_(buffer.Pass()),
12 buffer_size_(buffer_size), 12 buffer_size_(buffer_size),
13 data_size_(buffer_size) { 13 data_size_(buffer_size) {
14 } 14 }
15 15
16 DataBuffer::DataBuffer(size_t buffer_size) 16 DataBuffer::DataBuffer(size_t buffer_size)
17 : data_(new uint8[buffer_size]), 17 : data_(new uint8[buffer_size]),
18 buffer_size_(buffer_size), 18 buffer_size_(buffer_size),
19 data_size_(0) { 19 data_size_(0) {
20 CHECK(data_.get()) << "DataBuffer ctor failed to allocate memory"; 20 CHECK(data_.get()) << "DataBuffer ctor failed to allocate memory";
21 21
(...skipping 21 matching lines...) Expand all
43 void DataBuffer::SetDataSize(size_t data_size) { 43 void DataBuffer::SetDataSize(size_t data_size) {
44 DCHECK_LE(data_size, buffer_size_); 44 DCHECK_LE(data_size, buffer_size_);
45 data_size_ = data_size; 45 data_size_ = data_size;
46 } 46 }
47 47
48 size_t DataBuffer::GetBufferSize() const { 48 size_t DataBuffer::GetBufferSize() const {
49 return buffer_size_; 49 return buffer_size_;
50 } 50 }
51 51
52 } // namespace media 52 } // namespace media
OLDNEW
« no previous file with comments | « media/base/data_buffer.h ('k') | media/base/filter_collection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698