示例#1
0
bool CCThreadProxy::canDraw()
{
    ASSERT(isImplThread());
    if (!m_layerTreeHostImpl)
        return false;
    return m_layerTreeHostImpl->canDraw();
}
示例#2
0
void CCThreadProxy::onSwapBuffersCompleteOnImplThread()
{
    ASSERT(isImplThread());
    TRACE_EVENT("CCThreadProxy::onSwapBuffersCompleteOnImplThread", this, 0);
    m_schedulerOnImplThread->didSwapBuffersComplete();
    m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didCompleteSwapBuffers));
}
示例#3
0
void CCThreadProxy::setNeedsCommitAndRedrawOnCCThread()
{
    TRACE_EVENT("CCThreadProxy::setNeedsCommitAndRedrawOnCCThread", this, 0);
    ASSERT(isImplThread());
    ASSERT(m_layerTreeHostImpl);
    ASSERT_NOT_REACHED();
}
示例#4
0
void CCThreadProxy::initializeImplOnCCThread(CCCompletionEvent* completion)
{
    TRACE_EVENT("CCThreadProxy::initializeImplOnCCThread", this, 0);
    ASSERT(isImplThread());
    m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl();
    completion->signal();
}
示例#5
0
void CCThreadProxy::drawLayersOnCCThread()
{
    TRACE_EVENT("CCThreadProxy::drawLayersOnCCThread", this, 0);
    ASSERT(isImplThread());
    if (m_layerTreeHostImpl)
        m_layerTreeHostImpl->drawLayers();
}
示例#6
0
void CCThreadProxy::beginFrameAndCommitOnCCThread()
{
    TRACE_EVENT("CCThreadProxy::beginFrameAndCommitOnCCThread", this, 0);
    ASSERT(isImplThread());
    ASSERT_NOT_REACHED();
    // FIXME: call beginFrameAndCommit on main thread
}
示例#7
0
void CCThreadProxy::layerTreeHostClosedOnCCThread(CCCompletionEvent* completion)
{
    TRACE_EVENT("CCThreadProxy::layerTreeHostClosedOnCCThread", this, 0);
    ASSERT(isImplThread());
    m_layerTreeHost->deleteContentsTextures(m_layerTreeHostImpl->context());
    m_layerTreeHostImpl.clear();
    completion->signal();
}
示例#8
0
void CCThreadProxy::setNeedsCommitOnCCThread()
{
    TRACE_EVENT("CCThreadProxy::setNeedsCommitOnCCThread", this, 0);
    ASSERT(isImplThread());
    ASSERT(m_layerTreeHostImpl);
    // FIXME: Not yet implemented, see https://bugs.webkit.org/show_bug.cgi?id=67417
    ASSERT_NOT_REACHED();
}
示例#9
0
void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion)
{
    TRACE_EVENT("CCThreadProxy::initializeImplOnImplThread", this, 0);
    ASSERT(isImplThread());
    m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this);
    m_schedulerClientOnImplThread = CCThreadProxySchedulerClient::create(this);
    m_schedulerOnImplThread = CCScheduler::create(m_schedulerClientOnImplThread.get());
    completion->signal();
}
示例#10
0
void CCThreadProxy::finishAllRenderingOnImplThread(CCCompletionEvent* completion)
{
    TRACE_EVENT("CCThreadProxy::finishAllRenderingOnImplThread", this, 0);
    ASSERT(isImplThread());
    ASSERT(!m_finishAllRenderingCompletionEventOnImplThread);
    m_finishAllRenderingCompletionEventOnImplThread = completion;

    m_schedulerOnImplThread->setNeedsForcedRedraw();
}
示例#11
0
void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completion)
{
    TRACE_EVENT("CCThreadProxy::layerTreeHostClosedOnImplThread", this, 0);
    ASSERT(isImplThread());
    m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
    m_layerTreeHostImpl.clear();
    m_inputHandlerOnImplThread.clear();
    m_schedulerOnImplThread.clear();
    completion->signal();
}
示例#12
0
void CCThreadProxy::initializeLayerRendererOnCCThread(GraphicsContext3D* contextPtr, CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities)
{
    TRACE_EVENT("CCThreadProxy::initializeLayerRendererOnCCThread", this, 0);
    ASSERT(isImplThread());
    RefPtr<GraphicsContext3D> context(adoptRef(contextPtr));
    *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(context);
    if (*initializeSucceeded)
        *capabilities = m_layerTreeHostImpl->layerRendererCapabilities();
    completion->signal();
}
示例#13
0
void CCThreadProxy::drawLayersOnImplThread()
{
    TRACE_EVENT("CCThreadProxy::drawLayersOnImplThread", this, 0);
    ASSERT(isImplThread());
    ASSERT(m_layerTreeHostImpl);

    m_layerTreeHostImpl->drawLayers();
    // FIXME: handle case where m_layerTreeHostImpl->isContextLost.
    // FIXME: pass didSwapBuffersAbort if m_layerTreeHostImpl->isContextLost.
    ASSERT(!m_layerTreeHostImpl->isContextLost());
}
示例#14
0
void CCThreadProxy::drawLayersAndSwapOnImplThread()
{
    TRACE_EVENT("CCThreadProxy::drawLayersAndSwapOnImplThread", this, 0);
    ASSERT(isImplThread());
    if (!m_layerTreeHostImpl)
        return;

    drawLayersOnImplThread();
    m_layerTreeHostImpl->swapBuffers();
    m_schedulerOnImplThread->didDrawAndSwap();
}
示例#15
0
void CCThreadProxy::finishAllRenderingOnImplThread(CCCompletionEvent* completion)
{
    TRACE_EVENT("CCThreadProxy::finishAllRenderingOnImplThread", this, 0);
    ASSERT(isImplThread());
    if (m_schedulerOnImplThread->redrawPending()) {
        drawLayersOnImplThread();
        m_layerTreeHostImpl->swapBuffers();
        m_schedulerOnImplThread->didDrawAndSwap();
    }
    m_layerTreeHostImpl->finishAllRendering();
    completion->signal();
}
示例#16
0
CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInternal(bool forcedDraw)
{
    TRACE_EVENT("CCThreadProxy::scheduledActionDrawAndSwap", this, 0);
    CCScheduledActionDrawAndSwapResult result;
    result.didDraw = false;
    result.didSwap = false;
    ASSERT(isImplThread());
    ASSERT(m_layerTreeHostImpl);
    if (!m_layerTreeHostImpl)
        return result;

    // FIXME: compute the frame display time more intelligently
    double monotonicTime = monotonicallyIncreasingTime();
    double wallClockTime = currentTime();

    m_inputHandlerOnImplThread->animate(monotonicTime);
    m_layerTreeHostImpl->animate(monotonicTime, wallClockTime);
    CCLayerTreeHostImpl::FrameData frame;
    bool drawFrame = m_layerTreeHostImpl->prepareToDraw(frame) || forcedDraw;
    if (drawFrame) {
        m_layerTreeHostImpl->drawLayers(frame);
        result.didDraw = true;
    }

    // Check for a pending compositeAndReadback.
    if (m_readbackRequestOnImplThread) {
        ASSERT(drawFrame); // This should be a forcedDraw
        m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels, m_readbackRequestOnImplThread->rect);
        m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isContextLost();
        m_readbackRequestOnImplThread->completion.signal();
        m_readbackRequestOnImplThread = 0;
    }

    if (drawFrame)
        result.didSwap = m_layerTreeHostImpl->swapBuffers();

    // Process any finish request
    if (m_finishAllRenderingCompletionEventOnImplThread) {
        ASSERT(drawFrame); // This should be a forcedDraw
        m_layerTreeHostImpl->finishAllRendering();
        m_finishAllRenderingCompletionEventOnImplThread->signal();
        m_finishAllRenderingCompletionEventOnImplThread = 0;
    }

    // Tell the main thread that the the newly-commited frame was drawn.
    if (m_nextFrameIsNewlyCommittedFrameOnImplThread) {
        m_nextFrameIsNewlyCommittedFrameOnImplThread = false;
        m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didCommitAndDrawFrame));
    }

    ASSERT(drawFrame || (!drawFrame && !forcedDraw));
    return result;
}
示例#17
0
void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, GraphicsContext3D* contextPtr, bool* recreateSucceeded, LayerRendererCapabilities* capabilities)
{
    TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread");
    ASSERT(isImplThread());
    m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
    *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(contextPtr));
    if (*recreateSucceeded) {
        *capabilities = m_layerTreeHostImpl->layerRendererCapabilities();
        m_schedulerOnImplThread->didRecreateContext();
    }
    completion->signal();
}
示例#18
0
void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool visible)
{
    ASSERT(isImplThread());
    m_schedulerOnImplThread->setVisible(visible);
    m_layerTreeHostImpl->setVisible(visible);
    if (!visible) {
        m_layerTreeHost->didBecomeInvisibleOnImplThread(m_layerTreeHostImpl.get());
        // as partial or all the textures may be evicted in didBecomeInvisibleOnImplThread,
        // schedule a commit which will be executed when it goes to visible again.
        m_schedulerOnImplThread->setNeedsCommit();
    } else
        m_schedulerOnImplThread->setNeedsRedraw();
    completion->signal();
}
示例#19
0
void CCThreadProxy::commitOnCCThread(CCCompletionEvent* completion)
{
    ASSERT(isImplThread());
    TRACE_EVENT("CCThreadProxy::commitOnCCThread", this, 0);
    m_layerTreeHostImpl->beginCommit();
    {
        TRACE_EVENT("CCLayerTreeHost::commit", this, 0);
        m_layerTreeHost->commitTo(m_layerTreeHostImpl.get());
    }
    completion->signal();

    m_layerTreeHostImpl->commitComplete();
    setNeedsRedrawOnCCThread();
}
示例#20
0
void CCThreadProxy::initializeLayerRendererOnImplThread(GraphicsContext3D* contextPtr, CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities, int* compositorIdentifier)
{
    TRACE_EVENT("CCThreadProxy::initializeLayerRendererOnImplThread", this, 0);
    ASSERT(isImplThread());
    RefPtr<GraphicsContext3D> context(adoptRef(contextPtr));
    *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(context);
    if (*initializeSucceeded)
        *capabilities = m_layerTreeHostImpl->layerRendererCapabilities();

    m_inputHandlerOnImplThread = CCInputHandler::create(m_layerTreeHostImpl.get());
    *compositorIdentifier = m_inputHandlerOnImplThread->identifier();

    completion->signal();
}
示例#21
0
void CCThreadProxy::initializeLayerRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities)
{
    TRACE_EVENT("CCThreadProxy::initializeLayerRendererOnImplThread", this, 0);
    ASSERT(isImplThread());
    ASSERT(m_contextBeforeInitializationOnImplThread);
    *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitializationOnImplThread.release());
    if (*initializeSucceeded) {
        *capabilities = m_layerTreeHostImpl->layerRendererCapabilities();
        if (capabilities->usingSwapCompleteCallback)
            m_schedulerOnImplThread->setMaxFramesPending(2);
    }

    completion->signal();
}
示例#22
0
void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion)
{
    TRACE_EVENT("CCThreadProxy::initializeImplOnImplThread", this, 0);
    ASSERT(isImplThread());
    m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this);
    const double displayRefreshIntervalMs = 1000.0 / 60.0;
    OwnPtr<CCFrameRateController> frameRateController = adoptPtr(new CCFrameRateController(CCDelayBasedTimeSource::create(displayRefreshIntervalMs, CCProxy::implThread())));
    m_schedulerOnImplThread = CCScheduler::create(this, frameRateController.release());
    m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible());

    m_inputHandlerOnImplThread = CCInputHandler::create(m_layerTreeHostImpl.get());
    m_compositorIdentifier = m_inputHandlerOnImplThread->identifier();

    completion->signal();
}
示例#23
0
void CCThreadProxy::commitOnImplThread(CCCompletionEvent* completion)
{
    TRACE_EVENT("CCThreadProxy::beginFrameAndCommitOnImplThread", this, 0);
    ASSERT(isImplThread());
    ASSERT(m_schedulerOnImplThread->commitPending());
    if (!m_layerTreeHostImpl) {
        completion->signal();
        return;
    }
    m_layerTreeHostImpl->beginCommit();
    m_layerTreeHost->commitToOnImplThread(m_layerTreeHostImpl.get());
    m_layerTreeHostImpl->commitComplete();

    completion->signal();

    m_schedulerOnImplThread->didCommit();
}
示例#24
0
void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion)
{
    TRACE_EVENT("CCThreadProxy::beginFrameCompleteOnImplThread", this, 0);
    ASSERT(!m_commitCompletionEventOnImplThread);
    ASSERT(isImplThread());
    ASSERT(m_schedulerOnImplThread);
    ASSERT(m_schedulerOnImplThread->commitPending());
    if (!m_layerTreeHostImpl) {
        completion->signal();
        return;
    }

    m_commitCompletionEventOnImplThread = completion;

    ASSERT(!m_currentTextureUpdaterOnImplThread);
    m_currentTextureUpdaterOnImplThread = adoptPtr(new CCTextureUpdater(m_layerTreeHostImpl->contentsTextureAllocator()));
    m_layerTreeHost->updateCompositorResources(m_layerTreeHostImpl->context(), *m_currentTextureUpdaterOnImplThread);

    m_schedulerOnImplThread->beginFrameComplete();
}
示例#25
0
PassOwnPtr<CCMainThread::Task> CCThreadProxy::createBeginFrameAndCommitTaskOnImplThread()
{
    TRACE_EVENT("CCThreadProxy::createBeginFrameAndCommitTaskOnImplThread", this, 0);
    ASSERT(isImplThread());
    double frameBeginTime = currentTime();

    // NOTE, it is possible to receieve a request for a
    // beginFrameAndCommitOnImplThread from finishAllRendering while a
    // beginFrameAndCommitOnImplThread is enqueued. Since CCMainThread doesn't
    // provide a threadsafe way to cancel tasks, it is important that
    // beginFrameAndCommit be structured to understand that it may get called at
    // a point that it shouldn't. We do this by assigning a sequence number to
    // every new beginFrameAndCommit task. Then, beginFrameAndCommit tracks the
    // last executed sequence number, dropping beginFrameAndCommit with sequence
    // numbers below the last executed one.
    int thisTaskSequenceNumber = m_numBeginFrameAndCommitsIssuedOnImplThread;
    m_numBeginFrameAndCommitsIssuedOnImplThread++;
    OwnPtr<CCScrollUpdateSet> scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
    return createMainThreadTask(this, &CCThreadProxy::beginFrameAndCommit, thisTaskSequenceNumber, frameBeginTime, scrollInfo.release());
}
示例#26
0
void CCThreadProxy::scheduledActionDrawAndSwap()
{
    TRACE_EVENT("CCThreadProxy::scheduledActionDrawAndSwap", this, 0);
    ASSERT(isImplThread());
    if (!m_layerTreeHostImpl)
        return;

    // FIXME: compute the frame display time more intelligently
    double monotonicTime = monotonicallyIncreasingTime();
    double wallClockTime = currentTime();

    m_inputHandlerOnImplThread->willDraw(monotonicTime);
    m_layerTreeHostImpl->animate(monotonicTime, wallClockTime);
    m_layerTreeHostImpl->drawLayers();

    // Check for a pending compositeAndReadback.
    if (m_readbackRequestOnImplThread) {
        m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels, m_readbackRequestOnImplThread->rect);
        m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isContextLost();
        m_readbackRequestOnImplThread->completion.signal();
        m_readbackRequestOnImplThread = 0;
    }

    m_layerTreeHostImpl->swapBuffers();

    // Process any finish request
    if (m_finishAllRenderingCompletionEventOnImplThread) {
        m_layerTreeHostImpl->finishAllRendering();
        m_finishAllRenderingCompletionEventOnImplThread->signal();
        m_finishAllRenderingCompletionEventOnImplThread = 0;
    }

    // Tell the main thread that the the newly-commited frame was drawn.
    if (m_nextFrameIsNewlyCommittedFrameOnImplThread) {
        m_nextFrameIsNewlyCommittedFrameOnImplThread = false;
        m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::didCommitAndDrawFrame));
    }
}
示例#27
0
void CCSingleThreadProxy::releaseContentsTexturesOnImplThread()
{
    ASSERT(isImplThread());
    m_layerTreeHost->reduceContentsTexturesMemoryOnImplThread(0, m_layerTreeHostImpl->resourceProvider());
}
示例#28
0
void CCThreadProxy::setNeedsAnimateOnImplThread()
{
    ASSERT(isImplThread());
    TRACE_EVENT("CCThreadProxy::setNeedsCommitOnImplThread", this, 0);
    m_schedulerOnImplThread->requestAnimate();
}
示例#29
0
void CCThreadProxy::onSwapBuffersCompleteOnImplThread()
{
    ASSERT(isImplThread());
    TRACE_EVENT("CCThreadProxy::onSwapBuffersCompleteOnImplThread", this, 0);
    m_schedulerOnImplThread->didSwapBuffersComplete();
}
示例#30
0
void CCThreadProxy::setNeedsRedrawOnImplThread()
{
    ASSERT(isImplThread());
    TRACE_EVENT("CCThreadProxy::setNeedsRedrawOnImplThread", this, 0);
    m_schedulerOnImplThread->requestRedraw();
}