1) I think we do want to use the same MainLoop object by default, although I could see having a separate the_timer() top-level and returning the mainloop from it might make the intent clearer.
2) I deliberately didn't use a more elaborate abstraction for the initial merge, but if we want to go the whole hog, sure.
In that case, I think the policy interface wants to be something like...
class FrameDroppingPolicy
{
virtual void swap_now_blocking(std::function<void(void)> do_frame_drop) = 0;
virtual void swap_unblocked() = 0;
virtual bool frame_drop_pending() const = 0; /* Possibly don't need this */
};
The SwitchingBundle would then call swap_now_blocking(...) where we currently schedule the alarm, and swap_unblocked() from compositor_release(). If we decide that calling swap_unblocked() when there isn't a swap pending is an error, then we need frame_drop_pending() otherwise we can just unconditionally call swap_unblocked().
1) I think we do want to use the same MainLoop object by default, although I could see having a separate the_timer() top-level and returning the mainloop from it might make the intent clearer.
2) I deliberately didn't use a more elaborate abstraction for the initial merge, but if we want to go the whole hog, sure.
In that case, I think the policy interface wants to be something like...
class FrameDroppingPolicy blocking( std::function< void(void) > do_frame_drop) = 0; pending( ) const = 0; /* Possibly don't need this */
{
virtual void swap_now_
virtual void swap_unblocked() = 0;
virtual bool frame_drop_
};
The SwitchingBundle would then call swap_now_ blocking( ...) where we currently schedule the alarm, and swap_unblocked() from compositor_ release( ). If we decide that calling swap_unblocked() when there isn't a swap pending is an error, then we need frame_drop_ pending( ) otherwise we can just unconditionally call swap_unblocked().