OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_MEDIA_FRAMEWORK_ALLOCATOR_H_ |
| 6 #define SERVICES_MEDIA_FRAMEWORK_ALLOCATOR_H_ |
| 7 |
| 8 #include <cstdint> |
| 9 |
| 10 namespace mojo { |
| 11 namespace media { |
| 12 |
| 13 // Abstract base class for objects that allocate buffers for packets. |
| 14 class Allocator { |
| 15 public: |
| 16 // Gets the default allocator, which allocates vanilla memory from the heap. |
| 17 static Allocator* GetDefault(); |
| 18 |
| 19 // Gets the default allocator, which allocates vanilla memory from the heap. |
| 20 static Allocator* GetNull(); |
| 21 |
| 22 // Allocates and returns a buffer of the indicated size or returns nullptr |
| 23 // if the allocation fails. |
| 24 virtual void* AllocatePayloadBuffer(uint64_t size) = 0; |
| 25 |
| 26 // Releases a buffer previously allocated via AllocatePayloadBuffer. |
| 27 virtual void ReleasePayloadBuffer(uint64_t size, void* buffer) = 0; |
| 28 }; |
| 29 |
| 30 } // namespace media |
| 31 } // namespace mojo |
| 32 |
| 33 #endif // SERVICES_MEDIA_FRAMEWORK_ALLOCATOR_H_ |
OLD | NEW |