Changeset 95014 in webkit


Ignore:
Timestamp:
Sep 12, 2011 9:44:38 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r94975.
http://trac.webkit.org/changeset/94975
https://bugs.webkit.org/show_bug.cgi?id=67984

crash in PrerenderBrowserTest.PrerenderHTML5VideoJs (Requested
by ukai on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2011-09-12

Source/WebCore:

  • platform/graphics/chromium/CanvasLayerChromium.h:

(WebCore::CanvasLayerChromium::layerTypeAsString):

  • platform/graphics/chromium/ContentLayerChromium.h:

(WebCore::ContentLayerChromium::layerTypeAsString):

  • platform/graphics/chromium/ImageLayerChromium.h:

(WebCore::ImageLayerChromium::layerTypeAsString):

  • platform/graphics/chromium/LayerChromium.cpp:

(WebCore::LayerChromium::layerTreeAsText):
(WebCore::writeIndent):
(WebCore::LayerChromium::dumpLayer):
(WebCore::LayerChromium::dumpLayerProperties):

  • platform/graphics/chromium/LayerChromium.h:

(WebCore::LayerChromium::layerTypeAsString):

  • platform/graphics/chromium/LayerRendererChromium.cpp:

(WebCore::LayerRendererChromium::textureMemoryReclaimLimit):
(WebCore::LayerRendererChromium::create):
(WebCore::LayerRendererChromium::LayerRendererChromium):
(WebCore::LayerRendererChromium::close):
(WebCore::LayerRendererChromium::releaseTextures):
(WebCore::LayerRendererChromium::drawLayers):
(WebCore::LayerRendererChromium::drawLayersInternal):
(WebCore::LayerRendererChromium::getOffscreenLayerTexture):
(WebCore::LayerRendererChromium::initializeSharedObjects):
(WebCore::LayerRendererChromium::cleanupSharedObjects):
(WebCore::LayerRendererChromium::layerTreeAsText):
(WebCore::LayerRendererChromium::dumpRenderSurfaces):

  • platform/graphics/chromium/LayerRendererChromium.h:

(WebCore::LayerRendererChromium::owner):
(WebCore::LayerRendererChromium::rootLayer):
(WebCore::LayerRendererChromium::rootLayerImpl):
(WebCore::LayerRendererChromium::viewportSize):
(WebCore::LayerRendererChromium::contentsTextureManager):

  • platform/graphics/chromium/ManagedTexture.cpp:

(WebCore::ManagedTexture::bindTexture):
(WebCore::ManagedTexture::framebufferTexture2D):

  • platform/graphics/chromium/PluginLayerChromium.h:

(WebCore::PluginLayerChromium::layerTypeAsString):

  • platform/graphics/chromium/RenderSurfaceChromium.cpp:

(WebCore::RenderSurfaceChromium::name):
(WebCore::writeIndent):
(WebCore::RenderSurfaceChromium::dumpSurface):

  • platform/graphics/chromium/RenderSurfaceChromium.h:
  • platform/graphics/chromium/TextureManager.cpp:

(WebCore::TextureManager::deleteEvictedTextures):
(WebCore::TextureManager::removeTexture):
(WebCore::TextureManager::allocateTexture):
(WebCore::TextureManager::requestTexture):

  • platform/graphics/chromium/TextureManager.h:

(WebCore::TextureManager::setAssociatedContextDebugOnly):
(WebCore::TextureManager::associatedContextDebugOnly):

  • platform/graphics/chromium/TiledLayerChromium.cpp:

(WebCore::writeIndent):
(WebCore::TiledLayerChromium::dumpLayerProperties):

  • platform/graphics/chromium/TiledLayerChromium.h:
  • platform/graphics/chromium/VideoLayerChromium.h:

(WebCore::VideoLayerChromium::layerTypeAsString):

  • platform/graphics/chromium/WebGLLayerChromium.h:

(WebCore::WebGLLayerChromium::layerTypeAsString):

  • platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp:
  • platform/graphics/chromium/cc/CCCanvasLayerImpl.h:
  • platform/graphics/chromium/cc/CCLayerImpl.cpp:
  • platform/graphics/chromium/cc/CCLayerImpl.h:
  • platform/graphics/chromium/cc/CCLayerTreeHost.cpp:

(WebCore::CCLayerTreeHost::initialize):
(WebCore::CCLayerTreeHost::~CCLayerTreeHost):
(WebCore::CCLayerTreeHost::commitTo):
(WebCore::CCLayerTreeHost::didRecreateGraphicsContext):
(WebCore::CCLayerTreeHost::setVisible):
(WebCore::CCLayerTreeHost::contentsTextureManager):

  • platform/graphics/chromium/cc/CCLayerTreeHost.h:
  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:

(WebCore::CCLayerTreeHostImpl::drawLayers):
(WebCore::CCLayerTreeHostImpl::setVisible):
(WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
  • platform/graphics/chromium/cc/CCPluginLayerImpl.cpp:
  • platform/graphics/chromium/cc/CCPluginLayerImpl.h:
  • platform/graphics/chromium/cc/CCProxy.h:
  • platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:

(WebCore::CCSingleThreadProxy::initializeLayerRenderer):
(WebCore::CCSingleThreadProxy::stop):
(WebCore::CCSingleThreadProxy::contentsTextureManager):
(WebCore::CCSingleThreadProxy::recreateContextIfNeeded):

  • platform/graphics/chromium/cc/CCSingleThreadProxy.h:
  • platform/graphics/chromium/cc/CCThreadProxy.cpp:

(WebCore::CCThreadProxy::initializeLayerRenderer):
(WebCore::CCThreadProxy::contentsTextureManager):
(WebCore::CCThreadProxy::initializeLayerRendererOnCCThread):
(WebCore::CCThreadProxy::layerTreeHostClosedOnCCThread):

  • platform/graphics/chromium/cc/CCThreadProxy.h:
  • platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:

(WebCore::CCTiledLayerImpl::dumpLayerProperties):

  • platform/graphics/chromium/cc/CCTiledLayerImpl.h:
  • platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
  • platform/graphics/chromium/cc/CCVideoLayerImpl.h:

LayoutTests:

  • platform/chromium/compositing/lost-compositor-context-with-rendersurface-expected.png: Removed.
  • platform/chromium/compositing/lost-compositor-context-with-rendersurface-expected.txt: Removed.
  • platform/chromium/compositing/lost-compositor-context-with-rendersurface.html: Removed.
Location:
trunk
Files:
3 deleted
38 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95011 r95014  
     12011-09-12  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r94975.
     4        http://trac.webkit.org/changeset/94975
     5        https://bugs.webkit.org/show_bug.cgi?id=67984
     6
     7        crash in PrerenderBrowserTest.PrerenderHTML5VideoJs (Requested
     8        by ukai on #webkit).
     9
     10        * platform/chromium/compositing/lost-compositor-context-with-rendersurface-expected.png: Removed.
     11        * platform/chromium/compositing/lost-compositor-context-with-rendersurface-expected.txt: Removed.
     12        * platform/chromium/compositing/lost-compositor-context-with-rendersurface.html: Removed.
     13
    1142011-09-12  Sam Weinig  <sam@webkit.org>
    215
  • trunk/Source/WebCore/ChangeLog

    r95013 r95014  
     12011-09-12  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r94975.
     4        http://trac.webkit.org/changeset/94975
     5        https://bugs.webkit.org/show_bug.cgi?id=67984
     6
     7        crash in PrerenderBrowserTest.PrerenderHTML5VideoJs (Requested
     8        by ukai on #webkit).
     9
     10        * platform/graphics/chromium/CanvasLayerChromium.h:
     11        (WebCore::CanvasLayerChromium::layerTypeAsString):
     12        * platform/graphics/chromium/ContentLayerChromium.h:
     13        (WebCore::ContentLayerChromium::layerTypeAsString):
     14        * platform/graphics/chromium/ImageLayerChromium.h:
     15        (WebCore::ImageLayerChromium::layerTypeAsString):
     16        * platform/graphics/chromium/LayerChromium.cpp:
     17        (WebCore::LayerChromium::layerTreeAsText):
     18        (WebCore::writeIndent):
     19        (WebCore::LayerChromium::dumpLayer):
     20        (WebCore::LayerChromium::dumpLayerProperties):
     21        * platform/graphics/chromium/LayerChromium.h:
     22        (WebCore::LayerChromium::layerTypeAsString):
     23        * platform/graphics/chromium/LayerRendererChromium.cpp:
     24        (WebCore::LayerRendererChromium::textureMemoryReclaimLimit):
     25        (WebCore::LayerRendererChromium::create):
     26        (WebCore::LayerRendererChromium::LayerRendererChromium):
     27        (WebCore::LayerRendererChromium::close):
     28        (WebCore::LayerRendererChromium::releaseTextures):
     29        (WebCore::LayerRendererChromium::drawLayers):
     30        (WebCore::LayerRendererChromium::drawLayersInternal):
     31        (WebCore::LayerRendererChromium::getOffscreenLayerTexture):
     32        (WebCore::LayerRendererChromium::initializeSharedObjects):
     33        (WebCore::LayerRendererChromium::cleanupSharedObjects):
     34        (WebCore::LayerRendererChromium::layerTreeAsText):
     35        (WebCore::LayerRendererChromium::dumpRenderSurfaces):
     36        * platform/graphics/chromium/LayerRendererChromium.h:
     37        (WebCore::LayerRendererChromium::owner):
     38        (WebCore::LayerRendererChromium::rootLayer):
     39        (WebCore::LayerRendererChromium::rootLayerImpl):
     40        (WebCore::LayerRendererChromium::viewportSize):
     41        (WebCore::LayerRendererChromium::contentsTextureManager):
     42        * platform/graphics/chromium/ManagedTexture.cpp:
     43        (WebCore::ManagedTexture::bindTexture):
     44        (WebCore::ManagedTexture::framebufferTexture2D):
     45        * platform/graphics/chromium/PluginLayerChromium.h:
     46        (WebCore::PluginLayerChromium::layerTypeAsString):
     47        * platform/graphics/chromium/RenderSurfaceChromium.cpp:
     48        (WebCore::RenderSurfaceChromium::name):
     49        (WebCore::writeIndent):
     50        (WebCore::RenderSurfaceChromium::dumpSurface):
     51        * platform/graphics/chromium/RenderSurfaceChromium.h:
     52        * platform/graphics/chromium/TextureManager.cpp:
     53        (WebCore::TextureManager::deleteEvictedTextures):
     54        (WebCore::TextureManager::removeTexture):
     55        (WebCore::TextureManager::allocateTexture):
     56        (WebCore::TextureManager::requestTexture):
     57        * platform/graphics/chromium/TextureManager.h:
     58        (WebCore::TextureManager::setAssociatedContextDebugOnly):
     59        (WebCore::TextureManager::associatedContextDebugOnly):
     60        * platform/graphics/chromium/TiledLayerChromium.cpp:
     61        (WebCore::writeIndent):
     62        (WebCore::TiledLayerChromium::dumpLayerProperties):
     63        * platform/graphics/chromium/TiledLayerChromium.h:
     64        * platform/graphics/chromium/VideoLayerChromium.h:
     65        (WebCore::VideoLayerChromium::layerTypeAsString):
     66        * platform/graphics/chromium/WebGLLayerChromium.h:
     67        (WebCore::WebGLLayerChromium::layerTypeAsString):
     68        * platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp:
     69        * platform/graphics/chromium/cc/CCCanvasLayerImpl.h:
     70        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
     71        * platform/graphics/chromium/cc/CCLayerImpl.h:
     72        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     73        (WebCore::CCLayerTreeHost::initialize):
     74        (WebCore::CCLayerTreeHost::~CCLayerTreeHost):
     75        (WebCore::CCLayerTreeHost::commitTo):
     76        (WebCore::CCLayerTreeHost::didRecreateGraphicsContext):
     77        (WebCore::CCLayerTreeHost::setVisible):
     78        (WebCore::CCLayerTreeHost::contentsTextureManager):
     79        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
     80        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
     81        (WebCore::CCLayerTreeHostImpl::drawLayers):
     82        (WebCore::CCLayerTreeHostImpl::setVisible):
     83        (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):
     84        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
     85        * platform/graphics/chromium/cc/CCPluginLayerImpl.cpp:
     86        * platform/graphics/chromium/cc/CCPluginLayerImpl.h:
     87        * platform/graphics/chromium/cc/CCProxy.h:
     88        * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
     89        (WebCore::CCSingleThreadProxy::initializeLayerRenderer):
     90        (WebCore::CCSingleThreadProxy::stop):
     91        (WebCore::CCSingleThreadProxy::contentsTextureManager):
     92        (WebCore::CCSingleThreadProxy::recreateContextIfNeeded):
     93        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
     94        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
     95        (WebCore::CCThreadProxy::initializeLayerRenderer):
     96        (WebCore::CCThreadProxy::contentsTextureManager):
     97        (WebCore::CCThreadProxy::initializeLayerRendererOnCCThread):
     98        (WebCore::CCThreadProxy::layerTreeHostClosedOnCCThread):
     99        * platform/graphics/chromium/cc/CCThreadProxy.h:
     100        * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
     101        (WebCore::CCTiledLayerImpl::dumpLayerProperties):
     102        * platform/graphics/chromium/cc/CCTiledLayerImpl.h:
     103        * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
     104        * platform/graphics/chromium/cc/CCVideoLayerImpl.h:
     105
    11062011-09-12  Joseph Pecoraro  <joepeck@webkit.org>
    2107
  • trunk/Source/WebCore/platform/graphics/chromium/CanvasLayerChromium.h

    r94975 r95014  
    5353    explicit CanvasLayerChromium(GraphicsLayerChromium* owner);
    5454
     55    virtual const char* layerTypeAsString() const { return "CanvasLayer"; }
     56
    5557    bool m_hasAlpha;
    5658    bool m_premultipliedAlpha;
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h

    r94975 r95014  
    5555    explicit ContentLayerChromium(GraphicsLayerChromium* owner);
    5656
     57    virtual const char* layerTypeAsString() const { return "ContentLayer"; }
     58
    5759    virtual void cleanupResources();
    5860    virtual bool drawsContent() const;
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h

    r94975 r95014  
    5858    void setContents(Image* image);
    5959
     60protected:
     61    virtual const char* layerTypeAsString() const { return "ImageLayer"; }
     62
    6063private:
    6164    ImageLayerChromium(GraphicsLayerChromium* owner);
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r94975 r95014  
    377377}
    378378
     379String LayerChromium::layerTreeAsText() const
     380{
     381    TextStream ts;
     382    dumpLayer(ts, 0);
     383    return ts.release();
     384}
     385
     386static void writeIndent(TextStream& ts, int indent)
     387{
     388    for (int i = 0; i != indent; ++i)
     389        ts << "  ";
     390}
     391
     392void LayerChromium::dumpLayer(TextStream& ts, int indent) const
     393{
     394    writeIndent(ts, indent);
     395    ts << layerTypeAsString() << "(" << m_name << ")\n";
     396    dumpLayerProperties(ts, indent+2);
     397    if (m_replicaLayer) {
     398        writeIndent(ts, indent+2);
     399        ts << "Replica:\n";
     400        m_replicaLayer->dumpLayer(ts, indent+3);
     401    }
     402    if (m_maskLayer) {
     403        writeIndent(ts, indent+2);
     404        ts << "Mask:\n";
     405        m_maskLayer->dumpLayer(ts, indent+3);
     406    }
     407    for (size_t i = 0; i < m_children.size(); ++i)
     408        m_children[i]->dumpLayer(ts, indent+1);
     409}
     410
     411void LayerChromium::dumpLayerProperties(TextStream& ts, int indent) const
     412{
     413    writeIndent(ts, indent);
     414    ts << "id: " << id() << " drawsContent: " << drawsContent() << " bounds " << m_bounds.width() << "x" << m_bounds.height() << " usesLayerScissor: " << usesLayerScissor()
     415        << " scissorRect: (" << m_scissorRect.x() << ", " << m_scissorRect.y() << ", " << m_scissorRect.width() << ", " << m_scissorRect.height() << ")"
     416        << " visibleLayerRect: (" << m_visibleLayerRect.x() << ", " << m_visibleLayerRect.y() << ", " << m_visibleLayerRect.width() << ", " << m_visibleLayerRect.height() << ")"
     417        << "\n";
     418
     419}
     420
    379421PassRefPtr<CCLayerImpl> LayerChromium::createCCLayerImpl()
    380422{
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r94975 r95014  
    173173
    174174    void drawDebugBorder();
     175    String layerTreeAsText() const;
    175176
    176177    void setBorderWidth(float);
     
    219220
    220221    static void toGLMatrix(float*, const TransformationMatrix&);
     222
     223    void dumpLayer(TextStream&, int indent) const;
     224
     225    virtual const char* layerTypeAsString() const { return "LayerChromium"; }
     226    virtual void dumpLayerProperties(TextStream&, int indent) const;
    221227
    222228    FloatRect m_dirtyRect;
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r94975 r95014  
    7171namespace WebCore {
    7272
     73// FIXME: Make this limit adjustable and give it a useful value.
     74
     75// Absolute maximum limit for texture allocations for this instance.
     76static size_t textureMemoryHighLimitBytes = 128 * 1024 * 1024;
     77// Preferred texture size limit. Can be exceeded if needed.
     78static size_t textureMemoryReclaimLimitBytes = 64 * 1024 * 1024;
     79// The maximum texture memory usage when asked to release textures.
     80static size_t textureMemoryLowLimitBytes = 3 * 1024 * 1024;
     81
     82size_t LayerRendererChromium::textureMemoryReclaimLimit()
     83{
     84    return textureMemoryReclaimLimitBytes;
     85}
     86
    7387namespace {
    7488
     
    130144} // anonymous namespace
    131145
    132 PassRefPtr<LayerRendererChromium> LayerRendererChromium::create(CCLayerTreeHostImpl* owner, PassRefPtr<GraphicsContext3D> context)
     146PassRefPtr<LayerRendererChromium> LayerRendererChromium::create(CCLayerTreeHost* owner, CCLayerTreeHostImpl* ownerImpl, PassRefPtr<GraphicsContext3D> context)
    133147{
    134148#if USE(SKIA)
     
    136150        return 0;
    137151#endif
    138     RefPtr<LayerRendererChromium> layerRenderer(adoptRef(new LayerRendererChromium(owner, context)));
     152    RefPtr<LayerRendererChromium> layerRenderer(adoptRef(new LayerRendererChromium(owner, ownerImpl, context)));
    139153    if (!layerRenderer->initialize())
    140154        return 0;
     
    143157}
    144158
    145 LayerRendererChromium::LayerRendererChromium(CCLayerTreeHostImpl* owner,
     159LayerRendererChromium::LayerRendererChromium(CCLayerTreeHost* owner,
     160                                             CCLayerTreeHostImpl* ownerImpl,
    146161                                             PassRefPtr<GraphicsContext3D> context)
    147162    : m_owner(owner)
     163    , m_ownerImpl(ownerImpl)
    148164    , m_currentRenderSurface(0)
    149165    , m_offscreenFramebufferId(0)
     
    195211void LayerRendererChromium::close()
    196212{
    197     if (rootLayer())
    198         clearRenderSurfacesOnCCLayerImplRecursive(rootLayer());
     213    if (rootLayerImpl())
     214        clearRenderSurfacesOnCCLayerImplRecursive(rootLayerImpl());
    199215}
    200216
     
    211227}
    212228
    213 void LayerRendererChromium::releaseRenderSurfaceTextures()
    214 {
    215     m_renderSurfaceTextureManager->evictAndDeleteAllTextures(m_context.get());
     229void LayerRendererChromium::releaseTextures()
     230{
     231    // Reduces texture memory usage to textureMemoryLowLimitBytes by deleting non root layer
     232    // textures.
     233    m_owner->nonCompositedContentHost()->protectVisibleTileTextures();
     234    m_contentsTextureManager->reduceMemoryToLimit(textureMemoryLowLimitBytes);
     235    m_contentsTextureManager->unprotectAllTextures();
     236    m_contentsTextureManager->deleteEvictedTextures(m_context.get());
     237    // Evict all RenderSurface textures.
     238    m_renderSurfaceTextureManager->unprotectAllTextures();
     239    m_renderSurfaceTextureManager->reduceMemoryToLimit(0);
     240    m_renderSurfaceTextureManager->deleteEvictedTextures(m_context.get());
    216241}
    217242
     
    233258    m_headsUpDisplay->onFrameBegin(currentTime());
    234259
    235     if (!rootLayer())
     260    if (!rootLayerImpl())
    236261        return;
    237262    // FIXME: No need to walk the tree here. This could be passed via draw.
    238     rootLayer()->setLayerRendererRecursive(this);
    239 
    240     m_renderSurfaceTextureManager->setMemoryLimitBytes(TextureManager::highLimitBytes() - m_contentsTextureMemoryUseBytes);
     263    rootLayerImpl()->setLayerRendererRecursive(this);
     264
     265    m_renderSurfaceTextureManager->setMemoryLimitBytes(textureMemoryHighLimitBytes - m_contentsTextureManager->currentMemoryUseBytes());
    241266    drawLayersInternal();
    242267
    243     if (TextureManager::reclaimLimitBytes() > m_contentsTextureMemoryUseBytes)
    244         m_renderSurfaceTextureManager->reduceMemoryToLimit(TextureManager::reclaimLimitBytes() - m_contentsTextureMemoryUseBytes);
     268    m_contentsTextureManager->unprotectAllTextures();
     269
     270    if (textureMemoryReclaimLimitBytes > m_contentsTextureManager->currentMemoryUseBytes())
     271        m_renderSurfaceTextureManager->reduceMemoryToLimit(textureMemoryReclaimLimitBytes - m_contentsTextureManager->currentMemoryUseBytes());
    245272    else
    246273        m_renderSurfaceTextureManager->reduceMemoryToLimit(0);
     
    257284
    258285    TRACE_EVENT("LayerRendererChromium::drawLayers", this, 0);
    259     CCLayerImpl* rootDrawLayer = rootLayer();
     286    CCLayerImpl* rootDrawLayer = rootLayerImpl();
    260287    makeContextCurrent();
    261288
     
    421448ManagedTexture* LayerRendererChromium::getOffscreenLayerTexture()
    422449{
    423     return settings().compositeOffscreen && rootLayer() ? rootLayer()->renderSurface()->contentsTexture() : 0;
     450    return settings().compositeOffscreen && rootLayerImpl() ? rootLayerImpl()->renderSurface()->contentsTexture() : 0;
    424451}
    425452
     
    577604    GLC(m_context.get(), m_context->flush());
    578605
    579     m_renderSurfaceTextureManager = TextureManager::create(TextureManager::highLimitBytes(), m_capabilities.maxTextureSize);
     606    m_contentsTextureManager = TextureManager::create(textureMemoryHighLimitBytes, m_capabilities.maxTextureSize);
     607    m_renderSurfaceTextureManager = TextureManager::create(textureMemoryHighLimitBytes, m_capabilities.maxTextureSize);
     608#ifndef NDEBUG
     609    m_contentsTextureManager->setAssociatedContextDebugOnly(m_context.get());
     610    m_renderSurfaceTextureManager->setAssociatedContextDebugOnly(m_context.get());
     611#endif
    580612    return true;
    581613}
     
    786818        GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebufferId));
    787819
    788     ASSERT(!m_contentsTextureMemoryUseBytes);
    789     releaseRenderSurfaceTextures();
     820    // Clear tilers before the texture manager, as they have references to textures.
     821    m_contentsTextureManager->unprotectAllTextures();
     822    m_contentsTextureManager->reduceMemoryToLimit(0);
     823    m_contentsTextureManager->deleteEvictedTextures(m_context.get());
     824    m_contentsTextureManager.clear();
     825    m_renderSurfaceTextureManager->unprotectAllTextures();
     826    m_renderSurfaceTextureManager->reduceMemoryToLimit(0);
     827    m_renderSurfaceTextureManager->deleteEvictedTextures(m_context.get());
     828    m_renderSurfaceTextureManager.clear();
    790829}
    791830
     
    794833    TextStream ts;
    795834    if (rootLayer()) {
    796         ts << rootLayer()->layerTreeAsText();
     835        ts << rootLayer()->platformLayer()->layerTreeAsText();
    797836        ts << "RenderSurfaces:\n";
    798         dumpRenderSurfaces(ts, 1, rootLayer());
     837        dumpRenderSurfaces(ts, 1, rootLayer()->platformLayer());
    799838    }
    800839    return ts.release();
    801840}
    802841
    803 void LayerRendererChromium::dumpRenderSurfaces(TextStream& ts, int indent, const CCLayerImpl* layer) const
     842void LayerRendererChromium::dumpRenderSurfaces(TextStream& ts, int indent, const LayerChromium* layer) const
    804843{
    805844    if (layer->renderSurface())
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h

    r94975 r95014  
    7575class LayerRendererChromium : public RefCounted<LayerRendererChromium> {
    7676public:
    77     static PassRefPtr<LayerRendererChromium> create(CCLayerTreeHostImpl*, PassRefPtr<GraphicsContext3D>);
     77    static PassRefPtr<LayerRendererChromium> create(CCLayerTreeHost*, CCLayerTreeHostImpl*, PassRefPtr<GraphicsContext3D>);
    7878
    7979    // Must be called in order to allow the LayerRendererChromium to destruct
     
    8585    const LayerRendererCapabilities& capabilities() const { return m_capabilities; }
    8686
    87     CCLayerImpl* rootLayer() { return m_owner->rootLayer(); }
    88     const CCLayerImpl* rootLayer() const { return m_owner->rootLayer(); }
     87    CCLayerTreeHost* owner() { return m_owner; }
     88    const CCLayerTreeHost* owner() const { return m_owner; }
     89
     90    GraphicsLayer* rootLayer() { return m_owner->rootLayer(); }
     91    const GraphicsLayer* rootLayer() const { return m_owner->rootLayer(); }
     92
     93    CCLayerImpl* rootLayerImpl() { return m_ownerImpl->rootLayer(); }
     94    const CCLayerImpl* rootLayerImpl() const { return m_ownerImpl->rootLayer(); }
    8995
    9096    GraphicsContext3D* context();
    9197    bool contextSupportsMapSub() const { return m_capabilities.usingMapSub; }
    9298
    93     const IntSize& viewportSize() { return m_owner->viewportSize(); }
     99    const IntSize& viewportSize() { return m_ownerImpl->viewportSize(); }
    94100    int viewportWidth() { return viewportSize().width(); }
    95101    int viewportHeight() { return viewportSize().height(); }
     
    134140    void getFramebufferPixels(void *pixels, const IntRect& rect);
    135141
     142    TextureManager* contentsTextureManager() const { return m_contentsTextureManager.get(); }
    136143    TextureManager* renderSurfaceTextureManager() const { return m_renderSurfaceTextureManager.get(); }
    137144
     
    144151    bool isContextLost();
    145152
    146     void releaseRenderSurfaceTextures();
     153    void releaseTextures();
    147154
    148155    GC3Denum bestTextureFormat();
     
    150157    typedef Vector<RefPtr<CCLayerImpl> > CCLayerList;
    151158
    152     void setContentsTextureMemoryUseBytes(size_t contentsTextureMemoryUseBytes) { m_contentsTextureMemoryUseBytes = contentsTextureMemoryUseBytes; }
     159    // FIXME: Remove this when the contents texture manager has moved to CCLayerTreeHost.
     160    static size_t textureMemoryReclaimLimit();
    153161
    154162private:
    155     LayerRendererChromium(CCLayerTreeHostImpl*, PassRefPtr<GraphicsContext3D>);
     163    LayerRendererChromium(CCLayerTreeHost*, CCLayerTreeHostImpl*, PassRefPtr<GraphicsContext3D>);
    156164    bool initialize();
    157165
     
    172180    static bool compareLayerZ(const RefPtr<CCLayerImpl>&, const RefPtr<CCLayerImpl>&);
    173181
    174     void dumpRenderSurfaces(TextStream&, int indent, const CCLayerImpl*) const;
     182    void dumpRenderSurfaces(TextStream&, int indent, const LayerChromium*) const;
    175183
    176184    bool initializeSharedObjects();
     
    179187    void clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImpl*);
    180188
    181     CCLayerTreeHostImpl* m_owner;
     189    // FIXME: Remove CCLayerTreeHost field
     190    CCLayerTreeHost* m_owner;
     191
     192    CCLayerTreeHostImpl* m_ownerImpl;
    182193
    183194    LayerRendererCapabilities m_capabilities;
     
    210221    OwnPtr<CCVideoLayerImpl::YUVProgram> m_videoLayerYUVProgram;
    211222
    212     size_t m_contentsTextureMemoryUseBytes;
     223    OwnPtr<TextureManager> m_contentsTextureManager;
    213224    OwnPtr<TextureManager> m_renderSurfaceTextureManager;
    214225
  • trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp

    r94975 r95014  
    8484{
    8585    ASSERT(m_textureManager->hasTexture(m_token));
     86    ASSERT(context == m_textureManager->associatedContextDebugOnly());
    8687    if (!m_textureId)
    8788        m_textureId = m_textureManager->allocateTexture(context, m_token);
     
    9293{
    9394    ASSERT(m_textureManager->hasTexture(m_token));
     95    ASSERT(context == m_textureManager->associatedContextDebugOnly());
    9496    if (!m_textureId)
    9597        m_textureId = m_textureManager->allocateTexture(context, m_token);
  • trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h

    r94975 r95014  
    4747    virtual void pushPropertiesTo(CCLayerImpl*);
    4848
     49protected:
     50    virtual const char* layerTypeAsString() const { return "PluginLayer"; }
     51
    4952private:
    5053    explicit PluginLayerChromium(GraphicsLayerChromium* owner);
  • trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp

    r94975 r95014  
    6060}
    6161
     62String RenderSurfaceChromium::name() const
     63{
     64    return String::format("RenderSurface(id=%d,owner=%s)", m_owningLayer->id(), m_owningLayer->name().utf8().data());
     65}
     66
     67static void writeIndent(TextStream& ts, int indent)
     68{
     69    for (int i = 0; i != indent; ++i)
     70        ts << "  ";
     71}
     72
     73void RenderSurfaceChromium::dumpSurface(TextStream& ts, int indent) const
     74{
     75    writeIndent(ts, indent);
     76    ts << name() << "\n";
     77
     78    writeIndent(ts, indent+1);
     79    ts << "contentRect: (" << m_contentRect.x() << ", " << m_contentRect.y() << ", " << m_contentRect.width() << ", " << m_contentRect.height()
     80        << " scissorRect: (" << m_scissorRect.x() << ", " << m_scissorRect.y() << ", " << m_scissorRect.width() << ", " << m_scissorRect.height() << ")"
     81        << "\n";
     82}
     83
    6284}
    6385#endif // USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h

    r94975 r95014  
    5555    void draw(const IntRect& targetSurfaceRect);
    5656
     57    String name() const;
     58    void dumpSurface(TextStream&, int indent) const;
     59
    5760    // Returns the rect that encloses the RenderSurface including any reflection.
    5861    FloatRect drawableContentRect() const;
  • trunk/Source/WebCore/platform/graphics/chromium/TextureManager.cpp

    r94975 r95014  
    4545}
    4646
    47 size_t TextureManager::highLimitBytes()
    48 {
    49     return 128 * 1024 * 1024;
    50 }
    51 
    52 size_t TextureManager::reclaimLimitBytes()
    53 {
    54     return 64 * 1024 * 1024;
    55 }
    56 
    57 size_t TextureManager::lowLimitBytes()
    58 {
    59     return 3 * 1024 * 1024;
    60 }
    61 
    6247TextureManager::TextureManager(size_t memoryLimitBytes, int maxTextureSize)
    6348    : m_memoryLimitBytes(memoryLimitBytes)
     
    155140void TextureManager::deleteEvictedTextures(GraphicsContext3D* context)
    156141{
    157     if (context) {
    158         for (size_t i = 0; i < m_evictedTextures.size(); ++i) {
    159             if (m_evictedTextures[i].textureId) {
    160 #ifndef NDEBUG
    161                 ASSERT(m_evictedTextures[i].allocatingContext == context);
    162 #endif
    163                 GLC(context, context->deleteTexture(m_evictedTextures[i].textureId));
    164             }
    165         }
    166     }
    167     m_evictedTextures.clear();
    168 }
    169 
    170 void TextureManager::evictAndDeleteAllTextures(GraphicsContext3D* context)
    171 {
    172     unprotectAllTextures();
    173     reduceMemoryToLimit(0);
    174     deleteEvictedTextures(context);
     142    ASSERT(context == m_associatedContextDebugOnly);
     143    for (size_t i = 0; i < m_evictedTextureIds.size(); ++i) {
     144        if (m_evictedTextureIds[i])
     145            GLC(context, context->deleteTexture(m_evictedTextureIds[i]));
     146    }
     147    m_evictedTextureIds.clear();
    175148}
    176149
     
    183156    ASSERT(m_textureLRUSet.contains(token));
    184157    m_textureLRUSet.remove(token);
    185     EvictionEntry entry;
    186     entry.textureId = info.textureId;
    187 #ifndef NDEBUG
    188     entry.allocatingContext = info.allocatingContext;
    189 #endif
    190     m_evictedTextures.append(entry);
     158    m_evictedTextureIds.append(info.textureId);
    191159}
    192160
    193161unsigned TextureManager::allocateTexture(GraphicsContext3D* context, TextureToken token)
    194162{
     163    ASSERT(context == m_associatedContextDebugOnly);
    195164    TextureMap::iterator it = m_textures.find(token);
    196165    ASSERT(it != m_textures.end());
     
    209178    GLC(context, context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, info->format, info->size.width(), info->size.height(), 0, info->format, GraphicsContext3D::UNSIGNED_BYTE));
    210179    info->textureId = textureId;
    211 #ifndef NDEBUG
    212     info->allocatingContext = context;
    213 #endif
    214180    return textureId;
    215181}
     
    239205    info.textureId = 0;
    240206    info.isProtected = true;
    241 #ifndef NDEBUG
    242     info.allocatingContext = 0;
    243 #endif
    244207    addTexture(token, info);
    245208    return true;
  • trunk/Source/WebCore/platform/graphics/chromium/TextureManager.h

    r94975 r95014  
    4646    }
    4747
    48     // Absolute maximum limit for texture allocations for this instance.
    49     static size_t highLimitBytes();
    50     // Preferred texture size limit. Can be exceeded if needed.
    51     static size_t reclaimLimitBytes();
    52     // The maximum texture memory usage when asked to release textures.
    53     static size_t lowLimitBytes();
    54 
    5548    void setMemoryLimitBytes(size_t);
    5649
     
    6962    void deleteEvictedTextures(GraphicsContext3D*);
    7063
    71     void evictAndDeleteAllTextures(GraphicsContext3D*);
    72 
    7364    void reduceMemoryToLimit(size_t);
    7465    size_t currentMemoryUseBytes() const { return m_memoryUseBytes; }
     66
     67#ifndef NDEBUG
     68    void setAssociatedContextDebugOnly(GraphicsContext3D* context) { m_associatedContextDebugOnly = context; }
     69    GraphicsContext3D* associatedContextDebugOnly() const { return m_associatedContextDebugOnly; }
     70#endif
    7571
    7672private:
     
    8278        unsigned textureId;
    8379        bool isProtected;
    84 #ifndef NDEBUG
    85         GraphicsContext3D* allocatingContext;
    86 #endif
    8780    };
    8881
     
    9992    TextureToken m_nextToken;
    10093
    101     struct EvictionEntry {
    102         unsigned textureId;
    10394#ifndef NDEBUG
    104         GraphicsContext3D* allocatingContext;
     95    GraphicsContext3D* m_associatedContextDebugOnly;
    10596#endif
    106     };
    10797
    108     Vector<EvictionEntry> m_evictedTextures;
     98    Vector<unsigned> m_evictedTextureIds;
    10999};
    110100
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp

    r94975 r95014  
    266266}
    267267
     268static void writeIndent(TextStream& ts, int indent)
     269{
     270    for (int i = 0; i != indent; ++i)
     271        ts << "  ";
     272}
     273
     274void TiledLayerChromium::dumpLayerProperties(TextStream& ts, int indent) const
     275{
     276    LayerChromium::dumpLayerProperties(ts, indent);
     277    writeIndent(ts, indent);
     278    ts << "skipsDraw: " << (!m_tiler || m_skipsDraw) << "\n";
     279}
     280
    268281TextureManager* TiledLayerChromium::textureManager() const
    269282{
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h

    r94975 r95014  
    7575    virtual PassRefPtr<CCLayerImpl> createCCLayerImpl();
    7676
     77    virtual void dumpLayerProperties(TextStream&, int indent) const;
     78
    7779    virtual void setLayerTreeHost(CCLayerTreeHost*);
    7880
  • trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h

    r94975 r95014  
    6464protected:
    6565    virtual void cleanupResources();
     66    virtual const char* layerTypeAsString() const { return "VideoLayer"; }
    6667
    6768private:
  • trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h

    r94975 r95014  
    5858    GraphicsContext3D* context() { return m_context; }
    5959
     60protected:
     61    virtual const char* layerTypeAsString() const { return "WebGLLayer"; }
     62
    6063private:
    6164    explicit WebGLLayerChromium(GraphicsLayerChromium* owner);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp

    r94975 r95014  
    4949}
    5050
    51 const char* CCCanvasLayerImpl::layerTypeAsString() const
    52 {
    53     return "CanvasLayer";
    54 }
    55 
    5651void CCCanvasLayerImpl::draw()
    5752{
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h

    r94975 r95014  
    5353    explicit CCCanvasLayerImpl(int);
    5454
    55     virtual const char* layerTypeAsString() const;
    56 
    5755    unsigned m_textureId;
    5856    bool m_hasAlpha;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp

    r94975 r95014  
    8686}
    8787
    88 const char* CCLayerImpl::layerTypeAsString() const
    89 {
    90     return "LayerChromium";
    91 }
    92 
    9388void CCLayerImpl::addChild(PassRefPtr<CCLayerImpl> child)
    9489{
     
    233228}
    234229
    235 String CCLayerImpl::layerTreeAsText() const
    236 {
    237     TextStream ts;
    238     dumpLayer(ts, 0);
    239     return ts.release();
    240 }
    241 
    242 void CCLayerImpl::dumpLayer(TextStream& ts, int indent) const
    243 {
    244     writeIndent(ts, indent);
    245     ts << layerTypeAsString() << "(" << m_name << ")\n";
    246     dumpLayerProperties(ts, indent+2);
    247     if (m_replicaLayer) {
    248         writeIndent(ts, indent+2);
    249         ts << "Replica:\n";
    250         m_replicaLayer->dumpLayer(ts, indent+3);
    251     }
    252     if (m_maskLayer) {
    253         writeIndent(ts, indent+2);
    254         ts << "Mask:\n";
    255         m_maskLayer->dumpLayer(ts, indent+3);
    256     }
    257     for (size_t i = 0; i < m_children.size(); ++i)
    258         m_children[i]->dumpLayer(ts, indent+1);
    259 }
    260 
    261 }
    262 
     230}
    263231
    264232#endif // USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r94975 r95014  
    166166    void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
    167167
    168     String layerTreeAsText() const;
     168    virtual void dumpLayerProperties(TextStream&, int indent) const;
    169169
    170170protected:
    171171    explicit CCLayerImpl(int);
    172172
    173     virtual void dumpLayerProperties(TextStream&, int indent) const;
    174173    static void writeIndent(TextStream&, int indent);
    175174
     
    178177    friend class TreeSynchronizer;
    179178    void clearChildList(); // Warning: This does not preserve tree structure invariants and so is only exposed to the tree synchronizer.
    180 
    181     virtual const char* layerTypeAsString() const;
    182 
    183     void dumpLayer(TextStream&, int indent) const;
    184179
    185180    // Properties internal to CCLayerImpl
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r94975 r95014  
    7070    m_proxy->start();
    7171
    72     if (!m_proxy->initializeLayerRenderer())
     72    if (!m_proxy->initializeLayerRenderer(this))
    7373        return false;
    7474
     
    8787    m_proxy->setNeedsCommitAndRedraw();
    8888
    89     m_contentsTextureManager = TextureManager::create(TextureManager::highLimitBytes(), m_proxy->layerRendererCapabilities().maxTextureSize);
    9089    return true;
    9190}
     
    9392CCLayerTreeHost::~CCLayerTreeHost()
    9493{
    95     ASSERT(CCProxy::isMainThread());
    9694    TRACE_EVENT("CCLayerTreeHost::~CCLayerTreeHost", this, 0);
    9795    m_proxy->stop();
    9896    m_proxy.clear();
    99     m_updateList.clear();
    100     ASSERT(!m_contentsTextureManager->currentMemoryUseBytes());
    101     m_contentsTextureManager.clear();
    102 }
    103 
    104 void CCLayerTreeHost::deleteContentsTextures(GraphicsContext3D* context)
    105 {
    106     ASSERT(CCProxy::isImplThread());
    107     m_contentsTextureManager->evictAndDeleteAllTextures(context);
    10897}
    10998
     
    121110    hostImpl->setSourceFrameNumber(frameNumber());
    122111
    123     contentsTextureManager()->reduceMemoryToLimit(TextureManager::reclaimLimitBytes());
     112    contentsTextureManager()->reduceMemoryToLimit(hostImpl->layerRenderer()->textureMemoryReclaimLimit());
    124113    contentsTextureManager()->deleteEvictedTextures(hostImpl->context());
    125114
     
    130119    hostImpl->setZoomAnimatorScale(m_zoomAnimatorScale);
    131120    hostImpl->setViewport(viewportSize());
    132 
    133     hostImpl->layerRenderer()->setContentsTextureMemoryUseBytes(m_contentsTextureManager->currentMemoryUseBytes());
    134     m_contentsTextureManager->unprotectAllTextures();
    135121
    136122    // Synchronize trees, if one exists at all...
     
    160146void CCLayerTreeHost::didRecreateGraphicsContext(bool success)
    161147{
    162     m_contentsTextureManager->evictAndDeleteAllTextures(0);
    163 
    164148    if (rootLayer())
    165149        rootLayer()->platformLayer()->cleanupResourcesRecursive();
     
    276260{
    277261    m_visible = visible;
    278     if (visible)
    279         m_proxy->setNeedsCommitAndRedraw();
    280     else {
    281         m_nonCompositedContentHost->protectVisibleTileTextures();
    282         m_contentsTextureManager->reduceMemoryToLimit(TextureManager::lowLimitBytes());
    283         m_contentsTextureManager->unprotectAllTextures();
    284         m_proxy->setNeedsCommit();
    285     }
     262    m_proxy->setNeedsCommitAndRedraw();
    286263}
    287264
     
    293270TextureManager* CCLayerTreeHost::contentsTextureManager() const
    294271{
    295     return m_contentsTextureManager.get();
     272    return m_proxy->contentsTextureManager();
    296273}
    297274
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

    r94975 r95014  
    158158    void updateLayers();
    159159
    160     void deleteContentsTextures(GraphicsContext3D*);
    161 
    162160protected:
    163161    CCLayerTreeHost(CCLayerTreeHostClient*, const CCSettings&);
     
    187185    OwnPtr<GraphicsLayer> m_rootLayer;
    188186    OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost;
    189     OwnPtr<TextureManager> m_contentsTextureManager;
    190187
    191188    LayerList m_updateList;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

    r94975 r95014  
    7575    TRACE_EVENT("CCLayerTreeHostImpl::drawLayers", this, 0);
    7676    ASSERT(m_layerRenderer);
    77     if (m_layerRenderer->rootLayer())
     77    if (m_layerRenderer->owner()->rootLayer())
    7878        m_layerRenderer->drawLayers();
    7979
     
    117117{
    118118    if (m_layerRenderer && !visible)
    119         m_layerRenderer->releaseRenderSurfaceTextures();
     119        m_layerRenderer->releaseTextures();
    120120}
    121121
    122 bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<GraphicsContext3D> context)
     122bool CCLayerTreeHostImpl::initializeLayerRenderer(CCLayerTreeHost* implHack, PassRefPtr<GraphicsContext3D> context)
    123123{
     124    // If m_layerRenderer exists, then we are recovering from a lost context
     125    bool recreatingRenderer = m_layerRenderer;
     126
     127    // First time layerRenderer creation
    124128    RefPtr<LayerRendererChromium> layerRenderer;
    125     layerRenderer = LayerRendererChromium::create(this, context);
     129    if (!recreatingRenderer)
     130        layerRenderer = LayerRendererChromium::create(implHack, this, context);
     131    else
     132        layerRenderer = LayerRendererChromium::create(m_layerRenderer->owner(), this, context);
     133
    126134
    127135    // If creation failed, and we had asked for accelerated painting, disable accelerated painting
     
    130138        m_settings.acceleratePainting = false;
    131139
    132         layerRenderer = LayerRendererChromium::create(this, context);
    133     }
    134 
    135     // If we had a previous layer renderer, then its context must have been lost along with all of its resources.
    136     // Let the old layer renderer known its resources are gone.
    137     if (m_layerRenderer) {
    138         m_layerRenderer->setContentsTextureMemoryUseBytes(0);
    139         m_layerRenderer->close();
     140        if (!recreatingRenderer)
     141            layerRenderer = LayerRendererChromium::create(implHack, this, context);
     142        else
     143            layerRenderer = LayerRendererChromium::create(m_layerRenderer->owner(), this, context);
    140144    }
    141145
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

    r94975 r95014  
    5757    int frameNumber() const { return m_frameNumber; }
    5858
    59     bool initializeLayerRenderer(PassRefPtr<GraphicsContext3D>);
     59    bool initializeLayerRenderer(CCLayerTreeHost* ownerHack, PassRefPtr<GraphicsContext3D>);
    6060    bool isContextLost();
    6161    LayerRendererChromium* layerRenderer() { return m_layerRenderer.get(); }
     
    7878    void setZoomAnimatorScale(double);
    7979
    80     const CCSettings& settings() const { return m_settings; }
    8180protected:
    8281    explicit CCLayerTreeHostImpl(const CCSettings&);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp

    r94975 r95014  
    4747}
    4848
    49 const char* CCPluginLayerImpl::layerTypeAsString() const
    50 {
    51     return "PluginLayer";
    52 }
    53 
    5449void CCPluginLayerImpl::draw()
    5550{
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h

    r94975 r95014  
    5252    explicit CCPluginLayerImpl(int);
    5353
    54     virtual const char* layerTypeAsString() const;
    55 
    5654    unsigned m_textureId;
    5755};
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h

    r94975 r95014  
    5959    virtual bool isStarted() const = 0;
    6060
    61     virtual bool initializeLayerRenderer() = 0;
     61    virtual bool initializeLayerRenderer(CCLayerTreeHost* ownerHack) = 0;
    6262
    6363    virtual const LayerRendererCapabilities& layerRendererCapabilities() const = 0;
    6464
    65     virtual void setNeedsCommit() = 0;
    6665    virtual void setNeedsCommitAndRedraw() = 0;
    6766    virtual void setNeedsRedraw() = 0;
     
    8281    virtual GraphicsContext3D* context() = 0;
    8382
     83    // Temporary hack while LayerChromiums hold references to LayerRendererChromiums
     84    virtual TextureManager* contentsTextureManager() = 0;
     85
    8486protected:
    8587    CCProxy() { }
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp

    r94975 r95014  
    122122}
    123123
    124 bool CCSingleThreadProxy::initializeLayerRenderer()
    125 {
    126     ASSERT(isMainThread());
     124bool CCSingleThreadProxy::initializeLayerRenderer(CCLayerTreeHost* ownerHack)
     125{
    127126    RefPtr<GraphicsContext3D> context = m_layerTreeHost->createLayerTreeHostContext3D();
    128127    if (!context)
     
    132131    {
    133132        ScopedSetImplThread impl;
    134         return m_layerTreeHostImpl->initializeLayerRenderer(context);
     133        return m_layerTreeHostImpl->initializeLayerRenderer(ownerHack, context);
    135134    }
    136135}
     
    146145    m_graphicsContextLost = true;
    147146    m_timesRecreateShouldFail = numTimes - 1;
    148 }
    149 
    150 void CCSingleThreadProxy::setNeedsCommit()
    151 {
    152     ASSERT(isMainThread());
    153     // Commit immediately
    154     {
    155         ScopedSetImplThread impl;
    156         m_layerTreeHostImpl->beginCommit();
    157         m_layerTreeHost->commitTo(m_layerTreeHostImpl.get());
    158         m_layerTreeHostImpl->commitComplete();
    159     }
    160147}
    161148
     
    184171    {
    185172        ScopedSetImplThread impl;
    186         m_layerTreeHost->deleteContentsTextures(m_layerTreeHostImpl->context());
    187173        m_layerTreeHostImpl.clear();
    188174    }
    189175    m_layerTreeHost = 0;
     176}
     177
     178TextureManager* CCSingleThreadProxy::contentsTextureManager()
     179{
     180    return m_layerTreeHostImpl->layerRenderer()->contentsTextureManager();
    190181}
    191182
     
    207198bool CCSingleThreadProxy::recreateContextIfNeeded()
    208199{
    209     ASSERT(isMainThread());
    210200    if (!m_graphicsContextLost)
    211201        return true;
     
    218208    if (context) {
    219209        ASSERT(context->hasOneRef());
    220         if (m_layerTreeHostImpl->initializeLayerRenderer(context)) {
     210        if (m_layerTreeHostImpl->initializeLayerRenderer(0, context)) {
    221211            m_layerTreeHost->didRecreateGraphicsContext(true);
    222212            m_graphicsContextLost = false;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h

    r94975 r95014  
    4545    virtual void finishAllRendering();
    4646    virtual bool isStarted() const;
    47     virtual bool initializeLayerRenderer();
     47    virtual bool initializeLayerRenderer(CCLayerTreeHost* ownerHack);
    4848    virtual const LayerRendererCapabilities& layerRendererCapabilities() const;
    4949    virtual void loseCompositorContext(int numTimes);
    50     virtual void setNeedsCommit();
    5150    virtual void setNeedsCommitAndRedraw();
    5251    virtual void setNeedsRedraw();
    5352    virtual void start();
    5453    virtual void stop();
     54
     55    // Temporary hack while LayerChromiums hold references to LayerRendererChromiums
     56    virtual TextureManager* contentsTextureManager();
    5557
    5658    // Special case functions.
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

    r94975 r95014  
    9999}
    100100
    101 bool CCThreadProxy::initializeLayerRenderer()
     101bool CCThreadProxy::initializeLayerRenderer(CCLayerTreeHost* ownerHack)
    102102{
    103103    RefPtr<GraphicsContext3D> context = m_layerTreeHost->createLayerTreeHostContext3D();
     
    116116    LayerRendererCapabilities capabilities;
    117117    ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnCCThread,
    118                                           AllowCrossThreadAccess(contextPtr), AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&initializeSucceeded), AllowCrossThreadAccess(&capabilities)));
     118                                          AllowCrossThreadAccess(ownerHack), AllowCrossThreadAccess(contextPtr),
     119                                          AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&initializeSucceeded), AllowCrossThreadAccess(&capabilities)));
    119120    completion.wait();
    120121
     
    134135}
    135136
    136 void CCThreadProxy::setNeedsCommit()
    137 {
    138     ASSERT(isMainThread());
    139     if (m_commitPending)
    140         return;
    141 
    142     TRACE_EVENT("CCThreadProxy::setNeedsCommit", this, 0);
    143     m_commitPending = true;
    144     ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsCommitOnCCThread));
    145 }
    146 
    147137void CCThreadProxy::setNeedsCommitAndRedraw()
    148138{
     
    181171    ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted.
    182172    m_layerTreeHost = 0;
     173}
     174
     175TextureManager* CCThreadProxy::contentsTextureManager()
     176{
     177    ASSERT_NOT_REACHED();
     178    return 0;
    183179}
    184180
     
    234230}
    235231
    236 void CCThreadProxy::setNeedsCommitOnCCThread()
    237 {
    238     TRACE_EVENT("CCThreadProxy::setNeedsCommitOnCCThread", this, 0);
     232void CCThreadProxy::setNeedsCommitAndRedrawOnCCThread()
     233{
     234    TRACE_EVENT("CCThreadProxy::setNeedsCommitAndRedrawOnCCThread", this, 0);
    239235    ASSERT(isImplThread());
    240236    ASSERT(m_layerTreeHostImpl);
    241     // FIXME: Not yet implemented, see https://bugs.webkit.org/show_bug.cgi?id=67417
    242     ASSERT_NOT_REACHED();
    243 }
    244 
    245 void CCThreadProxy::setNeedsCommitAndRedrawOnCCThread()
    246 {
    247     TRACE_EVENT("CCThreadProxy::setNeedsCommitAndRedrawOnCCThread", this, 0);
    248     ASSERT(isImplThread());
    249     ASSERT(m_layerTreeHostImpl);
    250237    ASSERT_NOT_REACHED();
    251238}
     
    265252}
    266253
    267 void CCThreadProxy::initializeLayerRendererOnCCThread(GraphicsContext3D* contextPtr, CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities)
     254void CCThreadProxy::initializeLayerRendererOnCCThread(CCLayerTreeHost* ownerHack, GraphicsContext3D* contextPtr, CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities)
    268255{
    269256    TRACE_EVENT("CCThreadProxy::initializeLayerRendererOnCCThread", this, 0);
    270257    ASSERT(isImplThread());
    271258    RefPtr<GraphicsContext3D> context(adoptRef(contextPtr));
    272     *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(context);
     259    *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(ownerHack, context);
    273260    if (*initializeSucceeded)
    274261        *capabilities = m_layerTreeHostImpl->layerRendererCapabilities();
     
    280267    TRACE_EVENT("CCThreadProxy::layerTreeHostClosedOnCCThread", this, 0);
    281268    ASSERT(isImplThread());
    282     m_layerTreeHost->deleteContentsTextures(m_layerTreeHostImpl->context());
    283269    m_layerTreeHostImpl.clear();
    284270    completion->signal();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h

    r94975 r95014  
    4646    virtual void finishAllRendering();
    4747    virtual bool isStarted() const;
    48     virtual bool initializeLayerRenderer();
     48    virtual bool initializeLayerRenderer(CCLayerTreeHost* ownerHack);
    4949    virtual const LayerRendererCapabilities& layerRendererCapabilities() const;
    5050    virtual void loseCompositorContext(int numTimes);
    51     virtual void setNeedsCommit();
    5251    virtual void setNeedsCommitAndRedraw();
    5352    virtual void setNeedsRedraw();
    5453    virtual void start();
    5554    virtual void stop();
     55
     56    // Temporary hack while LayerChromiums hold references to LayerRendererChromiums
     57    virtual TextureManager* contentsTextureManager();
    5658
    5759private:
     
    6668    void drawLayersOnCCThread();
    6769    void initializeImplOnCCThread(CCCompletionEvent*);
    68     void initializeLayerRendererOnCCThread(GraphicsContext3D*, CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*);
    69     void setNeedsCommitOnCCThread();
     70    void initializeLayerRendererOnCCThread(CCLayerTreeHost*, GraphicsContext3D*, CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*);
    7071    void setNeedsCommitAndRedrawOnCCThread();
    7172    void setNeedsRedrawOnCCThread();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp

    r94975 r95014  
    6161}
    6262
    63 const char* CCTiledLayerImpl::layerTypeAsString() const
    64 {
    65     return "TiledLayer";
    66 }
    67 
    6863void CCTiledLayerImpl::bindContentsTexture()
    6964{
     
    8176void CCTiledLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const
    8277{
     78    writeIndent(ts, indent);
    8379    CCLayerImpl::dumpLayerProperties(ts, indent);
    84     writeIndent(ts, indent);
    85     ts << "skipsDraw: " << (!m_tiler || m_skipsDraw) << "\n";
    8680}
    8781
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h

    r94975 r95014  
    6868    explicit CCTiledLayerImpl(int id);
    6969
    70     virtual const char* layerTypeAsString() const;
    71 
    7270    // Draw all tiles that intersect with the content rect.
    7371    void draw(LayerRendererChromium*, const IntRect& contentRect, const TransformationMatrix&, float opacity);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp

    r94975 r95014  
    6868{
    6969    cleanupResources();
    70 }
    71 
    72 const char* CCVideoLayerImpl::layerTypeAsString() const
    73 {
    74     return "VideoLayer";
    7570}
    7671
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h

    r94975 r95014  
    5959    explicit CCVideoLayerImpl(int);
    6060
    61     virtual const char* layerTypeAsString() const;
    62 
    6361    struct Texture {
    6462        Platform3DObject id;
Note: See TracChangeset for help on using the changeset viewer.