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 { | |
jeffbrown
2016/02/02 05:35:46
The class name is very generic but its use is more
dalesat
2016/02/02 21:46:38
With regard to referencing Packet, my tendency wou
| |
15 public: | |
jeffbrown
2016/02/02 05:35:46
missing virtual destructor
dalesat
2016/02/02 21:46:38
Adding this blows up the constexpr stuff:
../../s
| |
16 // Gets the default allocator, which allocates vanilla memory from the heap. | |
17 static Allocator* GetDefault(); | |
18 | |
19 // Allocates and returns a buffer of the indicated size or returns nullptr | |
20 // if the allocation fails. | |
21 // TODO(dalesat): Use size_t for sizes in units of bytes framework-wide. | |
22 virtual void* AllocatePayloadBuffer(uint64_t size) = 0; | |
jeffbrown
2016/02/02 05:35:46
use size_t
dalesat
2016/02/02 21:46:38
John pointed this out. I have this teed up in a fu
| |
23 | |
24 // Releases a buffer previously allocated via AllocatePayloadBuffer. | |
25 virtual void ReleasePayloadBuffer(uint64_t size, void* buffer) = 0; | |
jeffbrown
2016/02/02 05:35:46
void*, size_t
dalesat
2016/02/02 21:46:38
Acknowledged.
| |
26 }; | |
27 | |
28 } // namespace media | |
29 } // namespace mojo | |
30 | |
31 #endif // SERVICES_MEDIA_FRAMEWORK_ALLOCATOR_H_ | |
OLD | NEW |