Changeset 93615 in webkit


Ignore:
Timestamp:
Aug 23, 2011 11:08:46 AM (13 years ago)
Author:
enne@google.com
Message:

[chromium] Remove LayerRendererChromium references from TiledLayerChromium
https://bugs.webkit.org/show_bug.cgi?id=66433

Reviewed by James Robinson.

Covered by existing tests.

Updated TiledLayerChromium and the texture updater classes to not
access LayerRendererChromium or cache GraphicsContext3D. Some settings
like max texture size were moved from LayerRendererChromium to
CCLayerTreeHost in order to facilitate this refactoring.

LayerTextureUpdaterSkPicture has been #ifdef'd to only work when the
compositor is not threaded. It will need to be refactored more in
order to not own graphics resources from the main thread.

  • platform/graphics/chromium/ContentLayerChromium.cpp:

(WebCore::ContentLayerChromium::paintContentsIfDirty):
(WebCore::ContentLayerChromium::createTextureUpdater):

  • platform/graphics/chromium/ContentLayerChromium.h:
  • platform/graphics/chromium/ImageLayerChromium.cpp:

(WebCore::ImageLayerTextureUpdater::create):
(WebCore::ImageLayerTextureUpdater::updateTextureRect):
(WebCore::ImageLayerTextureUpdater::ImageLayerTextureUpdater):
(WebCore::ImageLayerChromium::paintContentsIfDirty):
(WebCore::ImageLayerChromium::createTextureUpdater):

  • platform/graphics/chromium/ImageLayerChromium.h:
  • platform/graphics/chromium/LayerChromium.cpp:

(WebCore::LayerChromium::setLayerRenderer):
(WebCore::LayerChromium::setLayerTreeHost):

  • platform/graphics/chromium/LayerChromium.h:
  • platform/graphics/chromium/LayerRendererChromium.cpp:
  • platform/graphics/chromium/LayerRendererChromium.h:
  • platform/graphics/chromium/LayerTextureUpdater.h:

(WebCore::LayerTextureUpdater::LayerTextureUpdater):

  • platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp:

(WebCore::LayerTextureUpdaterCanvas::LayerTextureUpdaterCanvas):
(WebCore::LayerTextureUpdaterBitmap::create):
(WebCore::LayerTextureUpdaterBitmap::LayerTextureUpdaterBitmap):
(WebCore::LayerTextureUpdaterBitmap::updateTextureRect):
(WebCore::LayerTextureUpdaterSkPicture::create):
(WebCore::LayerTextureUpdaterSkPicture::LayerTextureUpdaterSkPicture):
(WebCore::LayerTextureUpdaterSkPicture::updateTextureRect):

  • platform/graphics/chromium/LayerTextureUpdaterCanvas.h:

(WebCore::LayerTextureUpdaterSkPicture::context):

  • platform/graphics/chromium/TiledLayerChromium.cpp:

(WebCore::TiledLayerChromium::setLayerTreeHost):
(WebCore::TiledLayerChromium::updateCompositorResources):
(WebCore::TiledLayerChromium::invalidateRect):
(WebCore::TiledLayerChromium::prepareToUpdate):

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

(WebCore::CCLayerTreeHost::CCLayerTreeHost):
(WebCore::CCLayerTreeHost::initialize):

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

(WebCore::CCLayerTreeHost::layerRenderer):
(WebCore::CCLayerTreeHost::contextSupportsMapSub):
(WebCore::CCLayerTreeHost::maxTextureSize):
(WebCore::CCLayerTreeHost::bestTextureFormat):

Location:
trunk/Source/WebCore
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r93614 r93615  
     12011-08-23  Adrienne Walker  <enne@google.com>
     2
     3        [chromium] Remove LayerRendererChromium references from TiledLayerChromium
     4        https://bugs.webkit.org/show_bug.cgi?id=66433
     5
     6        Reviewed by James Robinson.
     7
     8        Covered by existing tests.
     9
     10        Updated TiledLayerChromium and the texture updater classes to not
     11        access LayerRendererChromium or cache GraphicsContext3D. Some settings
     12        like max texture size were moved from LayerRendererChromium to
     13        CCLayerTreeHost in order to facilitate this refactoring.
     14
     15        LayerTextureUpdaterSkPicture has been #ifdef'd to only work when the
     16        compositor is not threaded. It will need to be refactored more in
     17        order to not own graphics resources from the main thread.
     18
     19        * platform/graphics/chromium/ContentLayerChromium.cpp:
     20        (WebCore::ContentLayerChromium::paintContentsIfDirty):
     21        (WebCore::ContentLayerChromium::createTextureUpdater):
     22        * platform/graphics/chromium/ContentLayerChromium.h:
     23        * platform/graphics/chromium/ImageLayerChromium.cpp:
     24        (WebCore::ImageLayerTextureUpdater::create):
     25        (WebCore::ImageLayerTextureUpdater::updateTextureRect):
     26        (WebCore::ImageLayerTextureUpdater::ImageLayerTextureUpdater):
     27        (WebCore::ImageLayerChromium::paintContentsIfDirty):
     28        (WebCore::ImageLayerChromium::createTextureUpdater):
     29        * platform/graphics/chromium/ImageLayerChromium.h:
     30        * platform/graphics/chromium/LayerChromium.cpp:
     31        (WebCore::LayerChromium::setLayerRenderer):
     32        (WebCore::LayerChromium::setLayerTreeHost):
     33        * platform/graphics/chromium/LayerChromium.h:
     34        * platform/graphics/chromium/LayerRendererChromium.cpp:
     35        * platform/graphics/chromium/LayerRendererChromium.h:
     36        * platform/graphics/chromium/LayerTextureUpdater.h:
     37        (WebCore::LayerTextureUpdater::LayerTextureUpdater):
     38        * platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp:
     39        (WebCore::LayerTextureUpdaterCanvas::LayerTextureUpdaterCanvas):
     40        (WebCore::LayerTextureUpdaterBitmap::create):
     41        (WebCore::LayerTextureUpdaterBitmap::LayerTextureUpdaterBitmap):
     42        (WebCore::LayerTextureUpdaterBitmap::updateTextureRect):
     43        (WebCore::LayerTextureUpdaterSkPicture::create):
     44        (WebCore::LayerTextureUpdaterSkPicture::LayerTextureUpdaterSkPicture):
     45        (WebCore::LayerTextureUpdaterSkPicture::updateTextureRect):
     46        * platform/graphics/chromium/LayerTextureUpdaterCanvas.h:
     47        (WebCore::LayerTextureUpdaterSkPicture::context):
     48        * platform/graphics/chromium/TiledLayerChromium.cpp:
     49        (WebCore::TiledLayerChromium::setLayerTreeHost):
     50        (WebCore::TiledLayerChromium::updateCompositorResources):
     51        (WebCore::TiledLayerChromium::invalidateRect):
     52        (WebCore::TiledLayerChromium::prepareToUpdate):
     53        * platform/graphics/chromium/TiledLayerChromium.h:
     54        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     55        (WebCore::CCLayerTreeHost::CCLayerTreeHost):
     56        (WebCore::CCLayerTreeHost::initialize):
     57        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
     58        (WebCore::CCLayerTreeHost::layerRenderer):
     59        (WebCore::CCLayerTreeHost::contextSupportsMapSub):
     60        (WebCore::CCLayerTreeHost::maxTextureSize):
     61        (WebCore::CCLayerTreeHost::bestTextureFormat):
     62
    1632011-08-23  Julien Chaffraix  <jchaffraix@webkit.org>
    264
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp

    r93424 r93615  
    3939#include "LayerTextureUpdaterCanvas.h"
    4040#include "PlatformBridge.h"
     41#include "cc/CCLayerTreeHost.h"
    4142#include <wtf/CurrentTime.h>
    4243
     
    9596{
    9697    ASSERT(drawsContent());
    97     ASSERT(layerRenderer());
    9898
    9999    updateTileSizeAndTilingOption();
     
    119119}
    120120
    121 void ContentLayerChromium::createTextureUpdaterIfNeeded()
     121void ContentLayerChromium::createTextureUpdater(const CCLayerTreeHost* host)
    122122{
    123     if (m_textureUpdater)
    124         return;
    125 
     123#if !USE(THREADED_COMPOSITING)
    126124#if USE(SKIA)
    127     if (layerRenderer()->settings().acceleratePainting) {
    128         m_textureUpdater = LayerTextureUpdaterSkPicture::create(layerRendererContext(), ContentLayerPainter::create(m_owner), layerRenderer()->skiaContext());
     125    if (host->settings().acceleratePainting) {
     126        m_textureUpdater = LayerTextureUpdaterSkPicture::create(ContentLayerPainter::create(m_owner), host->layerRenderer()->skiaContext());
    129127        return;
    130128    }
    131 #endif
    132     m_textureUpdater = LayerTextureUpdaterBitmap::create(layerRendererContext(), ContentLayerPainter::create(m_owner), layerRenderer()->contextSupportsMapSub());
     129#endif // SKIA
     130#endif // !THREADED_COMPOSITING
     131
     132    m_textureUpdater = LayerTextureUpdaterBitmap::create(ContentLayerPainter::create(m_owner), host->contextSupportsMapSub());
    133133}
    134134
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h

    r93424 r93615  
    5959    virtual void cleanupResources();
    6060    virtual bool drawsContent() const;
    61     virtual void createTextureUpdaterIfNeeded();
     61    virtual void createTextureUpdater(const CCLayerTreeHost*);
    6262    virtual LayerTextureUpdater* textureUpdater() const { return m_textureUpdater.get(); }
    6363
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp

    r93424 r93615  
    3535#include "ImageLayerChromium.h"
    3636
    37 #include "cc/CCLayerImpl.h"
    3837#include "Image.h"
    39 #include "LayerRendererChromium.h"
    40 #include "ManagedTexture.h"
    4138#include "LayerTextureSubImage.h"
    4239#include "LayerTextureUpdater.h"
     40#include "ManagedTexture.h"
    4341#include "PlatformColor.h"
     42#include "cc/CCLayerImpl.h"
     43#include "cc/CCLayerTreeHost.h"
    4444
    4545namespace WebCore {
     
    4848    WTF_MAKE_NONCOPYABLE(ImageLayerTextureUpdater);
    4949public:
    50     static PassOwnPtr<ImageLayerTextureUpdater> create(GraphicsContext3D* context, bool useMapTexSubImage)
     50    static PassOwnPtr<ImageLayerTextureUpdater> create(bool useMapTexSubImage)
    5151    {
    52         return adoptPtr(new ImageLayerTextureUpdater(context, useMapTexSubImage));
     52        return adoptPtr(new ImageLayerTextureUpdater(useMapTexSubImage));
    5353    }
    5454
     
    6868    }
    6969
    70     virtual void updateTextureRect(ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
     70    virtual void updateTextureRect(GraphicsContext3D* context, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
    7171    {
    72         texture->bindTexture(context());
     72        texture->bindTexture(context);
    7373
    7474        // Source rect should never go outside the image pixels, even if this
     
    8181        clippedDestRect.setSize(clippedSourceRect.size());
    8282
    83         m_texSubImage.upload(m_image.pixels(), imageRect(), clippedSourceRect, clippedDestRect, texture->format(), context());
     83        m_texSubImage.upload(m_image.pixels(), imageRect(), clippedSourceRect, clippedDestRect, texture->format(), context);
    8484    }
    8585
     
    9595
    9696private:
    97     ImageLayerTextureUpdater(GraphicsContext3D* context, bool useMapTexSubImage)
    98         : LayerTextureUpdater(context)
    99         , m_texSubImage(useMapTexSubImage)
     97    explicit ImageLayerTextureUpdater(bool useMapTexSubImage)
     98        : m_texSubImage(useMapTexSubImage)
    10099    {
    101100    }
     
    148147void ImageLayerChromium::paintContentsIfDirty()
    149148{
    150     ASSERT(layerRenderer());
    151 
    152149    if (!m_dirtyRect.isEmpty()) {
    153150        m_textureUpdater->updateFromImage(m_contents->nativeImageForCurrentFrame());
     
    183180}
    184181
    185 void ImageLayerChromium::createTextureUpdaterIfNeeded()
     182void ImageLayerChromium::createTextureUpdater(const CCLayerTreeHost* host)
    186183{
    187     if (!m_textureUpdater)
    188         m_textureUpdater = ImageLayerTextureUpdater::create(layerRendererContext(), layerRenderer()->contextSupportsMapSub());
     184    m_textureUpdater = ImageLayerTextureUpdater::create(host->contextSupportsMapSub());
    189185}
    190186
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h

    r90963 r93615  
    6565
    6666    virtual void cleanupResources();
    67     virtual void createTextureUpdaterIfNeeded();
     67    virtual void createTextureUpdater(const CCLayerTreeHost*);
    6868    void setTilingOption(TilingOption);
    6969
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r93571 r93615  
    106106    }
    107107    m_layerRenderer = renderer;
     108
     109    // FIXME: Once setLayerRenderer is no longer needed on the LayerChromium
     110    // tree, move this call to LayerRendererChromium::paintLayerContents.
     111    setLayerTreeHost(renderer->owner());
     112}
     113
     114void LayerChromium::setLayerTreeHost(CCLayerTreeHost*)
     115{
    108116}
    109117
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r93454 r93615  
    5454
    5555class CCLayerImpl;
     56class CCLayerTreeHost;
    5657class GraphicsContext3D;
    5758class LayerRendererChromium;
     
    157158    // FIXME, replace with CCLayerTreeHost.
    158159    virtual void setLayerRenderer(LayerRendererChromium*);
     160
     161    virtual void setLayerTreeHost(CCLayerTreeHost*);
    159162
    160163    void setOwner(GraphicsLayerChromium* owner) { m_owner = owner; }
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r93571 r93615  
    4646#include "NonCompositedContentHost.h"
    4747#include "NotImplemented.h"
    48 #include "PlatformColor.h"
    4948#include "RenderSurfaceChromium.h"
    5049#include "TextStream.h"
     
    535534}
    536535
    537 GC3Denum LayerRendererChromium::bestTextureFormat()
    538 {
    539     return PlatformColor::bestTextureFormat(context());
    540 }
    541 
    542536void LayerRendererChromium::viewportChanged()
    543537{
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h

    r93424 r93615  
    4343    WTF_MAKE_NONCOPYABLE(LayerTextureUpdater);
    4444public:
     45    LayerTextureUpdater() { }
    4546    virtual ~LayerTextureUpdater() { }
    4647
     
    6364    virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0;
    6465    virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels) = 0;
    65     virtual void updateTextureRect(ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect) = 0;
    66 
    67 protected:
    68     explicit LayerTextureUpdater(GraphicsContext3D* context) : m_context(context) { }
    69 
    70     GraphicsContext3D* context() const { return m_context; }
    71 
    72 private:
    73     // The graphics context with which to update textures.
    74     // It is assumed that the textures are either created in the same context
    75     // or shared with this context.
    76     GraphicsContext3D* m_context;
     66    virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect) = 0;
    7767};
    7868
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp

    r92900 r93615  
    4747namespace WebCore {
    4848
    49 LayerTextureUpdaterCanvas::LayerTextureUpdaterCanvas(GraphicsContext3D* context, PassOwnPtr<LayerPainterChromium> painter)
    50     : LayerTextureUpdater(context)
    51     , m_painter(painter)
     49LayerTextureUpdaterCanvas::LayerTextureUpdaterCanvas(PassOwnPtr<LayerPainterChromium> painter)
     50    : m_painter(painter)
    5251{
    5352}
     
    6362}
    6463
    65 PassOwnPtr<LayerTextureUpdaterBitmap> LayerTextureUpdaterBitmap::create(GraphicsContext3D* context, PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage)
    66 {
    67     return adoptPtr(new LayerTextureUpdaterBitmap(context, painter, useMapTexSubImage));
    68 }
    69 
    70 LayerTextureUpdaterBitmap::LayerTextureUpdaterBitmap(GraphicsContext3D* context, PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage)
    71     : LayerTextureUpdaterCanvas(context, painter)
     64PassOwnPtr<LayerTextureUpdaterBitmap> LayerTextureUpdaterBitmap::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage)
     65{
     66    return adoptPtr(new LayerTextureUpdaterBitmap(painter, useMapTexSubImage));
     67}
     68
     69LayerTextureUpdaterBitmap::LayerTextureUpdaterBitmap(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage)
     70    : LayerTextureUpdaterCanvas(painter)
    7271    , m_texSubImage(useMapTexSubImage)
    7372{
     
    9594}
    9695
    97 void LayerTextureUpdaterBitmap::updateTextureRect(ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
     96void LayerTextureUpdaterBitmap::updateTextureRect(GraphicsContext3D* context, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
    9897{
    9998    PlatformCanvas::AutoLocker locker(&m_canvas);
    10099
    101     texture->bindTexture(context());
    102     m_texSubImage.upload(locker.pixels(), contentRect(), sourceRect, destRect, texture->format(), context());
    103 }
    104 
     100    texture->bindTexture(context);
     101    m_texSubImage.upload(locker.pixels(), contentRect(), sourceRect, destRect, texture->format(), context);
     102}
     103
     104#if !USE(THREADED_COMPOSITING)
    105105#if USE(SKIA)
    106 PassOwnPtr<LayerTextureUpdaterSkPicture> LayerTextureUpdaterSkPicture::create(GraphicsContext3D* context, PassOwnPtr<LayerPainterChromium> painter, GrContext* skiaContext)
    107 {
    108     return adoptPtr(new LayerTextureUpdaterSkPicture(context, painter, skiaContext));
    109 }
    110 
    111 LayerTextureUpdaterSkPicture::LayerTextureUpdaterSkPicture(GraphicsContext3D* context, PassOwnPtr<LayerPainterChromium> painter, GrContext* skiaContext)
    112     : LayerTextureUpdaterCanvas(context, painter)
     106PassOwnPtr<LayerTextureUpdaterSkPicture> LayerTextureUpdaterSkPicture::create(PassOwnPtr<LayerPainterChromium> painter, GrContext* skiaContext)
     107{
     108    return adoptPtr(new LayerTextureUpdaterSkPicture(painter, skiaContext));
     109}
     110
     111LayerTextureUpdaterSkPicture::LayerTextureUpdaterSkPicture(PassOwnPtr<LayerPainterChromium> painter, GrContext* skiaContext)
     112    : LayerTextureUpdaterCanvas(painter)
    113113    , m_skiaContext(skiaContext)
     114    , m_context(0)
    114115    , m_createFrameBuffer(false)
    115116    , m_fbo(0)
     
    146147}
    147148
    148 void LayerTextureUpdaterSkPicture::updateTextureRect(ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
    149 {
     149void LayerTextureUpdaterSkPicture::updateTextureRect(GraphicsContext3D* compositorContext, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
     150{
     151    ASSERT(!m_context || m_context == compositorContext);
     152    m_context = compositorContext;
     153
    150154    if (m_createFrameBuffer) {
    151155        deleteFrameBuffer();
     
    251255}
    252256#endif // SKIA
     257#endif // !THREADED_COMPOSITING
    253258
    254259} // namespace WebCore
    255260#endif // USE(ACCELERATED_COMPOSITING)
    256 
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.h

    r92900 r93615  
    5252class LayerTextureUpdaterCanvas : public LayerTextureUpdater {
    5353    WTF_MAKE_NONCOPYABLE(LayerTextureUpdaterCanvas);
    54 public:
    55     virtual ~LayerTextureUpdaterCanvas() { }
    56 
    5754protected:
    58     LayerTextureUpdaterCanvas(GraphicsContext3D*, PassOwnPtr<LayerPainterChromium>);
     55    explicit LayerTextureUpdaterCanvas(PassOwnPtr<LayerPainterChromium>);
    5956
    6057    void paintContents(GraphicsContext&, const IntRect& contentRect);
     
    7168    WTF_MAKE_NONCOPYABLE(LayerTextureUpdaterBitmap);
    7269public:
    73     static PassOwnPtr<LayerTextureUpdaterBitmap> create(GraphicsContext3D*, PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage);
    74     virtual ~LayerTextureUpdaterBitmap() { }
     70    static PassOwnPtr<LayerTextureUpdaterBitmap> create(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage);
    7571
    7672    virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; }
    7773    virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat);
    7874    virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels);
    79     virtual void updateTextureRect(ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
     75    virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
    8076
    8177private:
    82     LayerTextureUpdaterBitmap(GraphicsContext3D*, PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage);
     78    LayerTextureUpdaterBitmap(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage);
    8379    PlatformCanvas m_canvas;
    8480    LayerTextureSubImage m_texSubImage;
    8581};
    8682
     83#if !USE(THREADED_COMPOSITING)
    8784#if USE(SKIA)
    8885class LayerTextureUpdaterSkPicture : public LayerTextureUpdaterCanvas {
    8986    WTF_MAKE_NONCOPYABLE(LayerTextureUpdaterSkPicture);
    9087public:
    91     static PassOwnPtr<LayerTextureUpdaterSkPicture> create(GraphicsContext3D*, PassOwnPtr<LayerPainterChromium>, GrContext*);
     88    static PassOwnPtr<LayerTextureUpdaterSkPicture> create(PassOwnPtr<LayerPainterChromium>, GrContext*);
    9289    virtual ~LayerTextureUpdaterSkPicture();
    9390
     
    9592    virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat);
    9693    virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels);
    97     virtual void updateTextureRect(ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
     94    virtual void updateTextureRect(GraphicsContext3D*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
    9895
    9996private:
    100     LayerTextureUpdaterSkPicture(GraphicsContext3D*, PassOwnPtr<LayerPainterChromium>, GrContext*);
     97    LayerTextureUpdaterSkPicture(PassOwnPtr<LayerPainterChromium>, GrContext*);
    10198    void deleteFrameBuffer();
    10299    bool createFrameBuffer();
     100    GraphicsContext3D* context() { return m_context; }
    103101
    104102    GrContext* m_skiaContext; // SKIA graphics context.
     103    GraphicsContext3D* m_context;
    105104
    106105    bool m_createFrameBuffer; // Need to create FBO if true.
     
    112111};
    113112#endif // SKIA
     113#endif // !THREADED_COMPOSITING
    114114
    115115} // namespace WebCore
    116116#endif // USE(ACCELERATED_COMPOSITING)
    117117#endif // LayerTextureUpdaterCanvas_h
    118 
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp

    r93526 r93615  
    9393}
    9494
    95 void TiledLayerChromium::setLayerRenderer(LayerRendererChromium* layerRenderer)
    96 {
    97     LayerChromium::setLayerRenderer(layerRenderer);
    98     createTilerIfNeeded();
    99 }
    100 
    10195void TiledLayerChromium::updateTileSizeAndTilingOption()
    10296{
     
    141135}
    142136
    143 void TiledLayerChromium::createTilerIfNeeded()
     137void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
    144138{
    145139    if (m_tiler)
    146140        return;
    147141
    148     createTextureUpdaterIfNeeded();
    149 
    150     m_textureFormat = layerRenderer()->bestTextureFormat();
     142    createTextureUpdater(host);
     143
     144    m_textureFormat = host->bestTextureFormat();
    151145    m_textureOrientation = textureUpdater()->orientation();
    152146    m_sampledTexelFormat = textureUpdater()->sampledTexelFormat(m_textureFormat);
    153 
    154147    m_tiler = CCLayerTilingData::create(
    155148        IntSize(defaultTileSize, defaultTileSize),
     
    209202            GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0));
    210203
    211             textureUpdater()->updateTextureRect(tile->texture(), sourceRect, destRect);
     204            textureUpdater()->updateTextureRect(context, tile->texture(), sourceRect, destRect);
    212205            tile->clearDirty();
    213206        }
     
    328321void TiledLayerChromium::invalidateRect(const IntRect& contentRect)
    329322{
    330     if (contentRect.isEmpty() || m_skipsDraw)
     323    if (!m_tiler || contentRect.isEmpty() || m_skipsDraw)
    331324        return;
    332325
     
    377370void TiledLayerChromium::prepareToUpdate(const IntRect& contentRect)
    378371{
     372    ASSERT(m_tiler);
     373
    379374    m_skipsDraw = false;
    380375
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h

    r93438 r93615  
    6161    void updateTileSizeAndTilingOption();
    6262
    63     virtual void createTextureUpdaterIfNeeded() = 0;
     63    virtual void createTextureUpdater(const CCLayerTreeHost*) = 0;
    6464    virtual LayerTextureUpdater* textureUpdater() const = 0;
    6565
     
    7777    virtual void dumpLayerProperties(TextStream&, int indent) const;
    7878
    79     virtual void setLayerRenderer(LayerRendererChromium*);
     79    virtual void setLayerTreeHost(CCLayerTreeHost*);
    8080
    8181    void createTilerIfNeeded();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r93360 r93615  
    3131#include "LayerRendererChromium.h"
    3232#include "NonCompositedContentHost.h"
     33#include "PlatformColor.h"
    3334#include "TraceEvent.h"
    3435#include "cc/CCLayerTreeHostCommitter.h"
     
    4748CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings& settings)
    4849    : m_recreatingGraphicsContext(false)
     50    , m_maxTextureSize(0)
     51    , m_contextSupportsMapSub(false)
    4952    , m_animating(false)
    5053    , m_client(client)
     
    6063    if (!m_layerRenderer)
    6164        return false;
     65
     66    // FIXME: In the threaded case, these values will need to be initialized
     67    // by something other than m_layerRenderer.
     68    m_maxTextureSize = m_layerRenderer->maxTextureSize();
     69    m_bestTextureFormat = PlatformColor::bestTextureFormat(m_layerRenderer->context());
     70    m_contextSupportsMapSub = m_layerRenderer->contextSupportsMapSub();
    6271
    6372    m_rootLayer = GraphicsLayer::create(0);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

    r93360 r93615  
    2626#define CCLayerTreeHost_h
    2727
     28#include "GraphicsTypes3D.h"
    2829#include "IntRect.h"
    2930#include "cc/CCLayerTreeHostCommitter.h"
     
    114115#if !USE(THREADED_COMPOSITING)
    115116    void composite(bool finish);
     117    LayerRendererChromium* layerRenderer() const { return m_layerRenderer.get(); }
    116118#endif
    117119
    118120    NonCompositedContentHost* nonCompositedContentHost() const { return m_nonCompositedContentHost.get(); }
     121
     122    bool contextSupportsMapSub() const { return m_contextSupportsMapSub; }
     123    int maxTextureSize() const { return m_maxTextureSize; }
     124    GC3Denum bestTextureFormat() { return m_bestTextureFormat; }
    119125
    120126protected:
     
    134140    RefPtr<LayerRendererChromium> m_layerRenderer;
    135141#endif
     142
     143    int m_maxTextureSize;
     144    GC3Denum m_bestTextureFormat;
     145    bool m_contextSupportsMapSub;
    136146
    137147    bool m_animating;
Note: See TracChangeset for help on using the changeset viewer.