Exemple #1
0
void CCLayerTreeHost::setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor)
{
    if (pageScaleFactor == m_pageScaleFactor && minPageScaleFactor == m_minPageScaleFactor && maxPageScaleFactor == m_maxPageScaleFactor)
        return;

    m_pageScaleFactor = pageScaleFactor;
    m_minPageScaleFactor = minPageScaleFactor;
    m_maxPageScaleFactor = maxPageScaleFactor;
    setNeedsCommit();
}
void WKCACFLayer::setBounds(const CGRect& rect)
{
    if (CGRectEqualToRect(rect, bounds()))
        return;

    CACFLayerSetBounds(layer(), rect);
    setNeedsCommit();

    if (m_needsDisplayOnBoundsChange)
        setNeedsDisplay();
}
void WKCACFLayer::setFrame(const CGRect& rect)
{
    CGRect oldFrame = frame();
    if (CGRectEqualToRect(rect, oldFrame))
        return;

    CACFLayerSetFrame(layer(), rect);
    setNeedsCommit();

    if (m_needsDisplayOnBoundsChange)
        setNeedsDisplay();
}
Exemple #4
0
void CCLayerTreeHost::setRootLayer(PassRefPtr<LayerChromium> rootLayer)
{
    if (m_rootLayer == rootLayer)
        return;

    if (m_rootLayer)
        m_rootLayer->setLayerTreeHost(0);
    m_rootLayer = rootLayer;
    if (m_rootLayer)
        m_rootLayer->setLayerTreeHost(this);
    setNeedsCommit();
}
Exemple #5
0
void CCSingleThreadProxy::setVisible(bool visible)
{
    m_layerTreeHostImpl->setVisible(visible);

    if (!visible) {
        DebugScopedSetImplThread impl;
        m_layerTreeHost->didBecomeInvisibleOnImplThread(m_layerTreeHostImpl.get());
        return;
    }

    setNeedsCommit();
}
Exemple #6
0
void CCLayerTreeHost::setViewportSize(const IntSize& viewportSize)
{
    if (viewportSize == m_viewportSize)
        return;

    m_viewportSize = viewportSize;

    m_deviceViewportSize = viewportSize;
    m_deviceViewportSize.scale(m_deviceScaleFactor);

    setNeedsCommit();
}
Exemple #7
0
void CCLayerTreeHost::setViewportSize(const IntSize& viewportSize)
{
    if (viewportSize == m_viewportSize)
        return;

    if (m_contentsTextureManager) {
        m_contentsTextureManager->setMaxMemoryLimitBytes(TextureManager::highLimitBytes(viewportSize));
        m_contentsTextureManager->setPreferredMemoryLimitBytes(TextureManager::reclaimLimitBytes(viewportSize));
    }
    m_viewportSize = viewportSize;
    setNeedsCommit();
}
Exemple #8
0
void ContentLayerChromium::idlePaintContentsIfDirty()
{
    if (!drawsContent())
        return;

    const IntRect& layerRect = visibleLayerRect();
    if (layerRect.isEmpty())
        return;

    prepareToUpdateIdle(layerRect);
    if (needsIdlePaint(layerRect))
        setNeedsCommit();
}
void PluginLayerWebKitThread::setPluginView(PluginView* pluginView)
{
    m_pluginView = pluginView;
    setNeedsTexture(isDrawable() && pluginView);
    setLayerProgram(LayerProgramRGBA);

    if (m_pluginView)
        setNeedsDisplay();
    else {
        // We can't afford to wait until the next commit
        // to set the m_pluginView to 0 in the impl, because it is
        // about to be destroyed.
        layerCompositingThread()->setPluginView(0);
        setNeedsCommit();
    }
}
void WKCACFLayer::setSublayers(const Vector<RefPtr<WKCACFLayer> >& sublayers)
{
    if (sublayers.isEmpty())
        CACFLayerSetSublayers(layer(), 0);
    else {
        // Create a vector of CACFLayers.
        Vector<const void*> layers;
        for (size_t i = 0; i < sublayers.size(); i++)
            layers.append(sublayers[i]->layer());
    
        RetainPtr<CFArrayRef> layersArray(AdoptCF, CFArrayCreate(0, layers.data(), layers.size(), 0));
        CACFLayerSetSublayers(layer(), layersArray.get());
    }
    
    setNeedsCommit();
}
Exemple #11
0
void CCLayerTreeHost::setContentsMemoryAllocationLimitBytes(size_t bytes)
{
    ASSERT(CCProxy::isMainThread());
    if (m_memoryAllocationBytes == bytes)
        return;

    m_memoryAllocationBytes = bytes;
    m_memoryAllocationIsForDisplay = bytes;

    // When not visible, force a commit so that we change our memory allocation
    // and evict/delete any textures if we are being requested to.
    if (!m_visible)
        setNeedsForcedCommit();
    else
        setNeedsCommit();
}
bool CCSingleThreadProxy::recreateContextIfNeeded()
{
    ASSERT(CCProxy::isMainThread());

    if (!m_graphicsContextLost && m_layerTreeHostImpl->isContextLost()) {
        m_graphicsContextLost = true;
        m_numFailedRecreateAttempts = 0;
    }

    if (!m_graphicsContextLost)
        return true;
    RefPtr<GraphicsContext3D> context;
    if (!m_timesRecreateShouldFail)
        context = m_layerTreeHost->createLayerTreeHostContext3D();
    else
        m_timesRecreateShouldFail--;

    if (context) {
        ASSERT(context->hasOneRef());
        bool ok;
        {
            DebugScopedSetImplThread impl;
            m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
            ok = m_layerTreeHostImpl->initializeLayerRenderer(context);
            if (ok)
                m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities();
        }
        if (ok) {
            m_layerTreeHost->didRecreateGraphicsContext(true);
            m_graphicsContextLost = false;
            return true;
        }
    }

    // Tolerate a certain number of recreation failures to work around races
    // in the context-lost machinery.
    m_numFailedRecreateAttempts++;
    if (m_numFailedRecreateAttempts < 5) {
        setNeedsCommit();
        return false;
    }

    // We have tried too many times to recreate the context. Tell the host to fall
    // back to software rendering.
    m_layerTreeHost->didRecreateGraphicsContext(false);
    return false;
}
void VideoLayerWebKitThread::setMediaPlayer(MediaPlayer* mediaPlayer)
{
    m_mediaPlayer = mediaPlayer;

    // This is a bit of a misnomer, since we don't need an actual GL texture.
    // However, the LayerRenderer will only process layers that "need textures"
    setNeedsTexture(isDrawable() && (contents() || drawsContent() || this->mediaPlayer()));

    if (!m_mediaPlayer) {
        // We can't afford to wait until the next commit to set the m_mediaPlayer
        // to 0 in the impl, because it is about to be destroyed.
        layerCompositingThread()->setMediaPlayer(0);

        // Clear hole punch rect.
        setHolePunchRect(IntRect());
    }

    setNeedsCommit();
}
Exemple #14
0
void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& updater)
{
    TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers");

    if (!rootLayer->renderSurface())
        rootLayer->createRenderSurface();
    rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(0, 0), deviceViewportSize()));

    IntRect rootClipRect(IntPoint(), deviceViewportSize());
    rootLayer->setClipRect(rootClipRect);

    LayerList updateList;
    updateList.append(rootLayer);

    RenderSurfaceChromium* rootRenderSurface = rootLayer->renderSurface();
    rootRenderSurface->clearLayerList();

    {
        TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc");
        WebTransformationMatrix identityMatrix;
        WebTransformationMatrix deviceScaleTransform;
        deviceScaleTransform.scale(m_deviceScaleFactor);
        CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, updateList, rootRenderSurface->layerList(), layerRendererCapabilities().maxTextureSize);

        FloatRect rootScissorRect(FloatPoint(0, 0), viewportSize());
        CCLayerTreeHostCommon::calculateVisibleAndScissorRects(updateList, rootScissorRect);
    }

    // Reset partial texture update requests.
    m_partialTextureUpdateRequests = 0;

    prioritizeTextures(updateList);

    bool needMoreUpdates = paintLayerContents(updateList, updater);
    if (m_triggerIdleUpdates && needMoreUpdates)
        setNeedsCommit();

    for (size_t i = 0; i < updateList.size(); ++i)
        updateList[i]->clearRenderSurface();
}
Exemple #15
0
void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueue& queue)
{
    TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers");

    LayerList updateList;

    {
        TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc");
        CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize(), m_deviceScaleFactor, rendererCapabilities().maxTextureSize, updateList);
        CCLayerTreeHostCommon::calculateVisibleRects(updateList);
    }

    // Reset partial texture update requests.
    m_partialTextureUpdateRequests = 0;

    bool needMoreUpdates = paintLayerContents(updateList, queue);
    if (m_triggerIdleUpdates && needMoreUpdates)
        setNeedsCommit();

    for (size_t i = 0; i < updateList.size(); ++i)
        updateList[i]->clearRenderSurface();
}
void WKCACFLayer::setContentsGravity(ContentsGravityType type)
{
    CACFLayerSetContentsGravity(layer(), toCACFContentsGravityType(type));
    setNeedsCommit();
}
Exemple #17
0
void CCThreadProxy::setNeedsCommitThenRedraw()
{
    ASSERT(isMainThread());
    m_redrawAfterCommit = true;
    setNeedsCommit();
}
void CCSingleThreadProxy::setNeedsRedraw()
{
    // FIXME: Once we move render_widget scheduling into this class, we can
    // treat redraw requests more efficiently than commitAndRedraw requests.
    setNeedsCommit();
}
Exemple #19
0
void CCThreadProxy::beginFrame()
{
    TRACE_EVENT0("cc", "CCThreadProxy::beginFrame");
    ASSERT(isMainThread());
    if (!m_layerTreeHost)
        return;

    if (!m_pendingBeginFrameRequest) {
        TRACE_EVENT0("cc", "EarlyOut_StaleBeginFrameMessage");
        return;
    }

    OwnPtr<BeginFrameAndCommitState> request(m_pendingBeginFrameRequest.release());

    // Do not notify the impl thread of commit requests that occur during
    // the apply/animate/layout part of the beginFrameAndCommit process since
    // those commit requests will get painted immediately. Once we have done
    // the paint, m_commitRequested will be set to false to allow new commit
    // requests to be scheduled.
    m_commitRequested = true;

    // On the other hand, the animationRequested flag needs to be cleared
    // here so that any animation requests generated by the apply or animate
    // callbacks will trigger another frame.
    m_animateRequested = false;

    // FIXME: technically, scroll deltas need to be applied for dropped commits as well.
    // Re-do the commit flow so that we don't send the scrollInfo on the BFAC message.
    m_layerTreeHost->applyScrollAndScale(*request->scrollInfo);

    // FIXME: recreate the context if it was requested by the impl thread.
    m_layerTreeHost->updateAnimations(request->frameBeginTime);
    m_layerTreeHost->layout();

    // Clear the commit flag after updating animations and layout here --- objects that only
    // layout when painted will trigger another setNeedsCommit inside
    // updateLayers.
    m_commitRequested = false;

    if (!m_layerTreeHost->updateLayers())
        return;

    // Before applying scrolls and calling animate, we set m_animateRequested to false.
    // If it is true now, it means setNeedAnimate was called again. Call setNeedsCommit
    // now so that we get begin frame when this one is done.
    if (m_animateRequested)
        setNeedsCommit();

    // Notify the impl thread that the beginFrame has completed. This will
    // begin the commit process, which is blocking from the main thread's
    // point of view, but asynchronously performed on the impl thread,
    // coordinated by the CCScheduler.
    {
        TRACE_EVENT("commit", this, 0);
        CCCompletionEvent completion;
        CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, AllowCrossThreadAccess(&completion)));
        completion.wait();
    }

    m_layerTreeHost->commitComplete();
}
void WKCACFLayer::removeAllSublayers()
{
    CACFLayerSetSublayers(layer(), 0);
    setNeedsCommit();
}
Exemple #21
0
void PluginLayerChromium::setTextureId(unsigned id)
{
    m_textureId = id;
    setNeedsCommit();
}
void CCSchedulerStateMachine::beginFrameAborted()
{
    ASSERT(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS);
    m_commitState = COMMIT_STATE_IDLE;
    setNeedsCommit();
}
void WKCACFLayer::setNeedsDisplay()
{
    if (m_owner)
        CACFLayerSetNeedsDisplay(layer(), 0);
    setNeedsCommit();
}
void WKCACFLayer::setNeedsDisplay(const CGRect& dirtyRect)
{
    if (m_owner)
        CACFLayerSetNeedsDisplay(layer(), &dirtyRect);
    setNeedsCommit();
}
Exemple #25
0
void CCLayerTreeHost::setFontAtlas(PassOwnPtr<CCFontAtlas> fontAtlas)
{
    m_fontAtlas = fontAtlas;
    setNeedsCommit();
}
Exemple #26
0
void PluginLayerChromium::setFlipped(bool flipped)
{
    m_flipped = flipped;
    setNeedsCommit();
}
Exemple #27
0
void PluginLayerChromium::setUVRect(const FloatRect& rect)
{
    m_uvRect = rect;
    setNeedsCommit();
}
void WKCACFLayer::setMinificationFilter(FilterType type)
{
    CACFLayerSetMinificationFilter(layer(), toCACFFilterType(type));
    setNeedsCommit();
}
void CCSchedulerStateMachine::didRecreateContext()
{
    ASSERT(m_contextState == CONTEXT_RECREATING);
    m_contextState = CONTEXT_ACTIVE;
    setNeedsCommit();
}
void PluginLayerChromium::setIOSurfaceProperties(int width, int height, uint32_t ioSurfaceId)
{
    m_ioSurfaceSize = IntSize(width, height);
    m_ioSurfaceId = ioSurfaceId;
    setNeedsCommit();
}