Changeset 107645 in webkit


Ignore:
Timestamp:
Feb 13, 2012 5:07:14 PM (12 years ago)
Author:
enne@google.com
Message:

[chromium] Use HashMap<..., OwnPtr<Tile>> for compositor tilemap
https://bugs.webkit.org/show_bug.cgi?id=74154

Reviewed by James Robinson.

Covered by the compositing/ layout tests.

  • platform/graphics/chromium/TiledLayerChromium.cpp:

(WebCore::UpdatableTile::create):
(WebCore::UpdatableTile::UpdatableTile):
(WebCore::TiledLayerChromium::createTile):

  • platform/graphics/chromium/cc/CCLayerTilingData.cpp:

(WebCore::CCLayerTilingData::addTile):
(WebCore::CCLayerTilingData::takeTile):
(WebCore::CCLayerTilingData::tileAt):

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

(WebCore::DrawableTile::create):
(WebCore::DrawableTile::DrawableTile):
(WebCore::CCTiledLayerImpl::createTile):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107636 r107645  
     12012-02-13  Adrienne Walker  <enne@google.com>
     2
     3        [chromium] Use HashMap<..., OwnPtr<Tile>> for compositor tilemap
     4        https://bugs.webkit.org/show_bug.cgi?id=74154
     5
     6        Reviewed by James Robinson.
     7
     8        Covered by the compositing/ layout tests.
     9
     10        * platform/graphics/chromium/TiledLayerChromium.cpp:
     11        (WebCore::UpdatableTile::create):
     12        (WebCore::UpdatableTile::UpdatableTile):
     13        (WebCore::TiledLayerChromium::createTile):
     14        * platform/graphics/chromium/cc/CCLayerTilingData.cpp:
     15        (WebCore::CCLayerTilingData::addTile):
     16        (WebCore::CCLayerTilingData::takeTile):
     17        (WebCore::CCLayerTilingData::tileAt):
     18        * platform/graphics/chromium/cc/CCLayerTilingData.h:
     19        * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
     20        (WebCore::DrawableTile::create):
     21        (WebCore::DrawableTile::DrawableTile):
     22        (WebCore::CCTiledLayerImpl::createTile):
     23
    1242012-02-13  Kentaro Hara  <haraken@chromium.org>
    225
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp

    r107352 r107645  
    5454    WTF_MAKE_NONCOPYABLE(UpdatableTile);
    5555public:
    56     explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture)
    57         : m_partialUpdate(false)
    58         , m_texture(texture)
     56    static PassOwnPtr<UpdatableTile> create(PassOwnPtr<LayerTextureUpdater::Texture> texture)
    5957    {
     58        return adoptPtr(new UpdatableTile(texture));
    6059    }
    6160
     
    7574    bool m_partialUpdate;
    7675private:
     76    explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture)
     77        : m_partialUpdate(false)
     78        , m_texture(texture)
     79    {
     80    }
     81
    7782    OwnPtr<LayerTextureUpdater::Texture> m_texture;
    7883};
     
    293298UpdatableTile* TiledLayerChromium::createTile(int i, int j)
    294299{
    295     RefPtr<UpdatableTile> tile = adoptRef(new UpdatableTile(textureUpdater()->createTexture(textureManager())));
    296     m_tiler->addTile(tile, i, j);
    297     tile->m_dirtyRect = m_tiler->tileRect(tile.get());
    298 
    299     return tile.get();
     300    OwnPtr<UpdatableTile> tile(UpdatableTile::create(textureUpdater()->createTexture(textureManager())));
     301    UpdatableTile* addedTile = tile.get();
     302    m_tiler->addTile(tile.release(), i, j);
     303
     304    addedTile->m_dirtyRect = m_tiler->tileRect(addedTile);
     305    return addedTile;
    300306}
    301307
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp

    r106870 r107645  
    7575}
    7676
    77 void CCLayerTilingData::addTile(PassRefPtr<Tile> tile, int i, int j)
     77void CCLayerTilingData::addTile(PassOwnPtr<Tile> tile, int i, int j)
    7878{
    7979    ASSERT(!tileAt(i, j));
     
    8282}
    8383
    84 PassRefPtr<CCLayerTilingData::Tile> CCLayerTilingData::takeTile(int i, int j)
     84PassOwnPtr<CCLayerTilingData::Tile> CCLayerTilingData::takeTile(int i, int j)
    8585{
    8686    return m_tiles.take(make_pair(i, j));
     
    8989CCLayerTilingData::Tile* CCLayerTilingData::tileAt(int i, int j) const
    9090{
    91     Tile* tile = m_tiles.get(make_pair(i, j)).get();
    92     ASSERT(!tile || tile->refCount() == 1);
    93     return tile;
     91    return m_tiles.get(make_pair(i, j));
    9492}
    9593
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h

    r103972 r107645  
    3535#include <wtf/HashTraits.h>
    3636#include <wtf/PassOwnPtr.h>
    37 #include <wtf/RefCounted.h>
    3837
    3938namespace WebCore {
     
    6261    const CCLayerTilingData& operator=(const CCLayerTilingData&);
    6362
    64     class Tile: public RefCounted<Tile> {
     63    class Tile {
    6564        WTF_MAKE_NONCOPYABLE(Tile);
    6665    public:
     
    8584        static bool isDeletedValue(TileMapKey value) { return value.first == -2 && value.second == -2; }
    8685    };
    87     // FIXME: The mapped value in TileMap should really be an OwnPtr, as the
    88     // refcount of a Tile should never be more than 1. However, HashMap
    89     // doesn't easily support OwnPtr as a value.
    90     typedef HashMap<TileMapKey, RefPtr<Tile>, DefaultHash<TileMapKey>::Hash, TileMapKeyTraits> TileMap;
     86    typedef HashMap<TileMapKey, OwnPtr<Tile>, DefaultHash<TileMapKey>::Hash, TileMapKeyTraits> TileMap;
    9187
    92     void addTile(PassRefPtr<Tile>, int, int);
    93     PassRefPtr<Tile> takeTile(int, int);
     88    void addTile(PassOwnPtr<Tile>, int, int);
     89    PassOwnPtr<Tile> takeTile(int, int);
    9490    Tile* tileAt(int, int) const;
    9591    const TileMap& tiles() const { return m_tiles; }
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp

    r106300 r107645  
    4848    WTF_MAKE_NONCOPYABLE(DrawableTile);
    4949public:
    50     DrawableTile() : m_textureId(0) { }
     50    static PassOwnPtr<DrawableTile> create() { return adoptPtr(new DrawableTile()); }
    5151
    5252    Platform3DObject textureId() const { return m_textureId; }
     
    5757
    5858private:
     59    DrawableTile() : m_textureId(0) { }
     60
    5961    Platform3DObject m_textureId;
    6062    IntRect m_opaqueRect;
     
    104106DrawableTile* CCTiledLayerImpl::createTile(int i, int j)
    105107{
    106     RefPtr<DrawableTile> tile = adoptRef(new DrawableTile());
    107     m_tiler->addTile(tile, i, j);
    108     return tile.get();
     108    OwnPtr<DrawableTile> tile(DrawableTile::create());
     109    DrawableTile* addedTile = tile.get();
     110    m_tiler->addTile(tile.release(), i, j);
     111    return addedTile;
    109112}
    110113
Note: See TracChangeset for help on using the changeset viewer.