• danakj's avatar
    cc: Post the missed BeginFrame to a new stack · e15b5e85
    danakj authored
    When the UI compositor (or any compositor with a Display attached to it
    in process - such as layout tests) does SwapBuffers, it submits the
    CompositorFrame to the SurfaceFactory.
    
    The SurfaceFactory pokes the DisplayScheduler, which can lead to it
    doing the Display::DrawAndSwap immediately, in the same callstack. In
    that case, the callback to the SurfaceDisplayOutputSurface (or the
    TestDelegatingOutputSurface) that it drew happens inline also, which
    was previously calling out to the OutputSurfaceClient.
    
    The problem is, the compositor expects SwapBuffers() to return before
    it hears that DidSwapBuffersComplete(). To avoid this, and similar
    problems, we prevent DisplayScheduler from running a new BeginFrame
    inside an external call to DisplayScheduler::SurfaceDamaged() which
    prevents re-entrancy for its clients.
    
    We do this by posting the missed BeginFrame to respond to it on a new
    stack (and cancelling it if another BeginFrame comes in the meantime
    since it was already posted).
    
    For TestDelegatedOutputSurface synchronous composites, we simply
    post the SwapBuffersComplete message to get it on a new call stack.
    
    R=jbauman
    BUG=495650
    CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel
    
    Review-Url: https://codereview.chromium.org/2183333003
    Cr-Commit-Position: refs/heads/master@{#408289}
    e15b5e85
test_delegating_output_surface.h 2.89 KB