| OLD | NEW | 
|   1 // Copyright 2015 The Chromium Authors. All rights reserved. |   1 // Copyright 2015 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 #ifndef MEDIA_CDM_SIMPLE_CDM_BUFFER_H_ |   5 #ifndef MEDIA_CDM_SIMPLE_CDM_BUFFER_H_ | 
|   6 #define MEDIA_CDM_SIMPLE_CDM_BUFFER_H_ |   6 #define MEDIA_CDM_SIMPLE_CDM_BUFFER_H_ | 
|   7  |   7  | 
 |   8 #include <stddef.h> | 
|   8 #include <stdint.h> |   9 #include <stdint.h> | 
 |  10  | 
|   9 #include <vector> |  11 #include <vector> | 
|  10  |  12  | 
|  11 #include "base/macros.h" |  13 #include "base/macros.h" | 
|  12 #include "media/cdm/api/content_decryption_module.h" |  14 #include "media/cdm/api/content_decryption_module.h" | 
|  13  |  15  | 
|  14 namespace media { |  16 namespace media { | 
|  15  |  17  | 
|  16 // cdm::Buffer implementation that provides access to memory. This is a simple |  18 // cdm::Buffer implementation that provides access to memory. This is a simple | 
|  17 // implementation that stores the data in a std::vector<uint8_t>. |  19 // implementation that stores the data in a std::vector<uint8_t>. | 
|  18 class SimpleCdmBuffer : public cdm::Buffer { |  20 class SimpleCdmBuffer : public cdm::Buffer { | 
|  19  public: |  21  public: | 
|  20   static SimpleCdmBuffer* Create(uint32_t capacity); |  22   static SimpleCdmBuffer* Create(size_t capacity); | 
|  21  |  23  | 
|  22   // cdm::Buffer implementation. |  24   // cdm::Buffer implementation. | 
|  23   void Destroy() final; |  25   void Destroy() final; | 
|  24   uint32_t Capacity() const final; |  26   uint32_t Capacity() const final; | 
|  25   uint8_t* Data() final; |  27   uint8_t* Data() final; | 
|  26   void SetSize(uint32_t size) final; |  28   void SetSize(uint32_t size) final; | 
|  27   uint32_t Size() const final; |  29   uint32_t Size() const final; | 
|  28  |  30  | 
|  29  private: |  31  private: | 
|  30   SimpleCdmBuffer(uint32_t capacity); |  32   SimpleCdmBuffer(uint32_t capacity); | 
|  31   ~SimpleCdmBuffer() final; |  33   ~SimpleCdmBuffer() final; | 
|  32  |  34  | 
|  33   std::vector<uint8_t> buffer_; |  35   std::vector<uint8_t> buffer_; | 
|  34   uint32_t size_; |  36   uint32_t size_; | 
|  35  |  37  | 
|  36   DISALLOW_COPY_AND_ASSIGN(SimpleCdmBuffer); |  38   DISALLOW_COPY_AND_ASSIGN(SimpleCdmBuffer); | 
|  37 }; |  39 }; | 
|  38  |  40  | 
|  39 }  // namespace media |  41 }  // namespace media | 
|  40  |  42  | 
|  41 #endif  // MEDIA_CDM_SIMPLE_CDM_BUFFER_H_ |  43 #endif  // MEDIA_CDM_SIMPLE_CDM_BUFFER_H_ | 
| OLD | NEW |