1 #ifndef _REF_COUNTED_FRAME_H
2 #define _REF_COUNTED_FRAME_H 1
4 // A wrapper around FrameAllocator::Frame that is automatically refcounted;
5 // when the refcount goes to zero, the frame is given back to the allocator.
7 // Note that the important point isn't really the pointer to the Frame itself,
8 // it's the resources it's representing that need to go back to the allocator.
12 #include "bmusb/bmusb.h"
14 void release_refcounted_frame(FrameAllocator::Frame *frame);
16 typedef std::shared_ptr<FrameAllocator::Frame> RefCountedFrameBase;
18 class RefCountedFrame : public RefCountedFrameBase {
22 RefCountedFrame(const FrameAllocator::Frame &frame)
23 : RefCountedFrameBase(new FrameAllocator::Frame(frame), release_refcounted_frame) {}
26 #endif // !defined(_REF_COUNTED_FRAME_H)