// Called by the legacy scheduling path (e.g. where render_widget does the scheduling)
void CCSingleThreadProxy::compositeImmediately()
{
    if (!recreateContextIfNeeded())
        return;

    commitIfNeeded();

    if (doComposite())
        m_layerTreeHostImpl->swapBuffers();
}
bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
{
    ASSERT(CCProxy::isMainThread());

    if (!recreateContextIfNeeded())
        return false;

    commitIfNeeded();

    if (!doComposite())
        return false;

    m_layerTreeHostImpl->readback(pixels, rect);

    if (m_layerTreeHostImpl->isContextLost())
        return false;

    return true;
}
bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
{
    TRACE_EVENT("CCSingleThreadProxy::compositeAndReadback", this, 0);
    ASSERT(CCProxy::isMainThread());

    if (!recreateContextIfNeeded()) {
        TRACE_EVENT("compositeAndReadback_EarlyOut_ContextLost", this, 0);
        return false;
    }

    if (!commitIfNeeded())
        return false;

    if (!doComposite())
        return false;

    m_layerTreeHostImpl->readback(pixels, rect);

    if (m_layerTreeHostImpl->isContextLost())
        return false;

    return true;
}