| OLD | NEW |
| 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 // 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_ |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 virtual int GetBufferSize() const; | 43 virtual int GetBufferSize() const; |
| 44 | 44 |
| 45 virtual void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); | 45 virtual void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 // Copies from [data,data+size) to owned array. | 48 // Copies from [data,data+size) to owned array. |
| 49 DataBuffer(const uint8* data, int size); | 49 DataBuffer(const uint8* data, int size); |
| 50 virtual ~DataBuffer(); | 50 virtual ~DataBuffer(); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 // Helper method to allocate |data_| with at least |buffer_size| bytes. |
| 54 void AllocateBuffer(int buffer_size); |
| 55 |
| 53 scoped_array<uint8> data_; | 56 scoped_array<uint8> data_; |
| 54 int buffer_size_; | 57 int buffer_size_; |
| 55 int data_size_; | 58 int data_size_; |
| 56 scoped_ptr<DecryptConfig> decrypt_config_; | 59 scoped_ptr<DecryptConfig> decrypt_config_; |
| 57 | 60 |
| 58 DISALLOW_COPY_AND_ASSIGN(DataBuffer); | 61 DISALLOW_COPY_AND_ASSIGN(DataBuffer); |
| 59 }; | 62 }; |
| 60 | 63 |
| 61 } // namespace media | 64 } // namespace media |
| 62 | 65 |
| 63 #endif // MEDIA_BASE_DATA_BUFFER_H_ | 66 #endif // MEDIA_BASE_DATA_BUFFER_H_ |
| OLD | NEW |