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

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

Issue 10837118: Dead code elimination: scythe.chrome_functions:segment.path %media% edition, round 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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
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 "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 25 matching lines...) Expand all
36 // Prevent arbitrary pointers. 36 // Prevent arbitrary pointers.
37 if (buffer_size_ <= 0) { 37 if (buffer_size_ <= 0) {
38 buffer_size_ = data_size_ = 0; 38 buffer_size_ = data_size_ = 0;
39 data_.reset(); 39 data_.reset();
40 return; 40 return;
41 } 41 }
42 42
43 data_.reset(new uint8[buffer_size_]); 43 data_.reset(new uint8[buffer_size_]);
44 } 44 }
45 45
46 scoped_refptr<DataBuffer> DataBuffer::CopyFrom(const uint8* data,
47 int data_size) {
48 return make_scoped_refptr(new DataBuffer(data, data_size));
49 }
50
51 const uint8* DataBuffer::GetData() const { 46 const uint8* DataBuffer::GetData() const {
52 return data_.get(); 47 return data_.get();
53 } 48 }
54 49
55 int DataBuffer::GetDataSize() const { 50 int DataBuffer::GetDataSize() const {
56 return data_size_; 51 return data_size_;
57 } 52 }
58 53
59 uint8* DataBuffer::GetWritableData() { 54 uint8* DataBuffer::GetWritableData() {
60 return data_.get(); 55 return data_.get();
61 } 56 }
62 57
63 void DataBuffer::SetDataSize(int data_size) { 58 void DataBuffer::SetDataSize(int data_size) {
64 DCHECK_LE(data_size, buffer_size_); 59 DCHECK_LE(data_size, buffer_size_);
65 data_size_ = data_size; 60 data_size_ = data_size;
66 } 61 }
67 62
68 int DataBuffer::GetBufferSize() const { 63 int DataBuffer::GetBufferSize() const {
69 return buffer_size_; 64 return buffer_size_;
70 } 65 }
71 66
72 } // namespace media 67 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698