OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 // One-time (per client/per-buffer) initialization to share a particular | 52 // One-time (per client/per-buffer) initialization to share a particular |
53 // buffer to a process. The size of the allocation is returned as | 53 // buffer to a process. The size of the allocation is returned as |
54 // |memory_size|. | 54 // |memory_size|. |
55 base::SharedMemoryHandle ShareToProcess(int buffer_id, | 55 base::SharedMemoryHandle ShareToProcess(int buffer_id, |
56 base::ProcessHandle process_handle, | 56 base::ProcessHandle process_handle, |
57 size_t* memory_size); | 57 size_t* memory_size); |
58 | 58 |
59 // Query the memory parameters of |buffer_id|. Fills in parameters in the | 59 // Query the memory parameters of |buffer_id|. Fills in parameters in the |
60 // pointer arguments, and returns true iff the buffer exists. | 60 // pointer arguments, and returns true iff the buffer exists. |
61 bool GetBufferInfo(int buffer_id, void** memory, size_t* size); | 61 bool GetBufferInfo(int buffer_id, void** memory, size_t* size, |
| 62 base::SharedMemoryHandle* handle); |
62 | 63 |
63 // Reserve or allocate a buffer of at least |size| bytes and return its id. | 64 // Reserve or allocate a buffer of at least |size| bytes and return its id. |
64 // This will fail (returning kInvalidId) if the pool already is at its |count| | 65 // This will fail (returning kInvalidId) if the pool already is at its |count| |
65 // limit of the number of allocations, and all allocated buffers are in use by | 66 // limit of the number of allocations, and all allocated buffers are in use by |
66 // the producer and/or consumers. | 67 // the producer and/or consumers. |
67 // | 68 // |
68 // If successful, the reserved buffer remains reserved (and writable by the | 69 // If successful, the reserved buffer remains reserved (and writable by the |
69 // producer) until ownership is transferred either to the consumer via | 70 // producer) until ownership is transferred either to the consumer via |
70 // HoldForConsumers(), or back to the pool with | 71 // HoldForConsumers(), or back to the pool with |
71 // RelinquishProducerReservation(). | 72 // RelinquishProducerReservation(). |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 129 |
129 // The buffers, indexed by |buffer_id|. | 130 // The buffers, indexed by |buffer_id|. |
130 BufferMap buffers_; | 131 BufferMap buffers_; |
131 | 132 |
132 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureBufferPool); | 133 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureBufferPool); |
133 }; | 134 }; |
134 | 135 |
135 } // namespace content | 136 } // namespace content |
136 | 137 |
137 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ | 138 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ |
OLD | NEW |