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

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

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: . Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/base/data_buffer.h" 5 #include "media/base/data_buffer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 namespace media { 9 namespace media {
10 10
11 DataBuffer::DataBuffer(int buffer_size) 11 DataBuffer::DataBuffer(int buffer_size)
12 : buffer_size_(buffer_size), 12 : buffer_size_(buffer_size),
13 data_size_(0) { 13 data_size_(0) {
14 CHECK_GE(buffer_size, 0); 14 CHECK_GE(buffer_size, 0);
15 data_.reset(new uint8_t[buffer_size_]); 15 data_.reset(new uint8_t[buffer_size_]);
16 } 16 }
17 17
18 DataBuffer::DataBuffer(scoped_ptr<uint8_t[]> buffer, int buffer_size) 18 DataBuffer::DataBuffer(std::unique_ptr<uint8_t[]> buffer, int buffer_size)
19 : data_(std::move(buffer)), 19 : data_(std::move(buffer)),
20 buffer_size_(buffer_size), 20 buffer_size_(buffer_size),
21 data_size_(buffer_size) { 21 data_size_(buffer_size) {
22 CHECK(data_.get()); 22 CHECK(data_.get());
23 CHECK_GE(buffer_size, 0); 23 CHECK_GE(buffer_size, 0);
24 } 24 }
25 25
26 DataBuffer::DataBuffer(const uint8_t* data, int data_size) 26 DataBuffer::DataBuffer(const uint8_t* data, int data_size)
27 : buffer_size_(data_size), data_size_(data_size) { 27 : buffer_size_(data_size), data_size_(data_size) {
28 if (!data) { 28 if (!data) {
(...skipping 13 matching lines...) Expand all
42 // If you hit this CHECK you likely have a bug in a demuxer. Go fix it. 42 // If you hit this CHECK you likely have a bug in a demuxer. Go fix it.
43 CHECK(data); 43 CHECK(data);
44 return make_scoped_refptr(new DataBuffer(data, size)); 44 return make_scoped_refptr(new DataBuffer(data, size));
45 } 45 }
46 46
47 // static 47 // static
48 scoped_refptr<DataBuffer> DataBuffer::CreateEOSBuffer() { 48 scoped_refptr<DataBuffer> DataBuffer::CreateEOSBuffer() {
49 return make_scoped_refptr(new DataBuffer(NULL, 0)); 49 return make_scoped_refptr(new DataBuffer(NULL, 0));
50 } 50 }
51 } // namespace media 51 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698