// the BaseTiles' texture.
TilesManager::instance()->transferQueue()->updateDirtyBaseTiles();
- if (compositedRoot != m_previouslyUsedRoot) {
+ if (compositedRoot != m_previouslyUsedRoot)
TilesManager::instance()->swapLayersTextures(m_previouslyUsedRoot, compositedRoot);
- TilesManager::instance()->cleanupTilesTextures();
- }
bool ret = baseLayer->drawGL(compositedRoot, rect, viewport, webViewRect,
titleBarHeight, clip, scale, pagesSwapped, color);
{
if (m_texture)
m_texture->removeLayer(this);
+ SkSafeUnref(m_texture);
removeChildren();
delete m_extra;
delete m_contentsImage;
if (oldLayer && oldLayer->texture()) {
oldLayer->texture()->replaceLayer(this);
m_texture = oldLayer->texture();
+ SkSafeRef(m_texture);
}
}
#include "config.h"
#include "PaintTileOperation.h"
#include "LayerAndroid.h"
+#include "PaintedSurface.h"
namespace WebCore {
-PaintTileOperation::PaintTileOperation(BaseTile* tile, LayerAndroid* layer)
+PaintTileOperation::PaintTileOperation(BaseTile* tile, PaintedSurface* surface)
: QueuedOperation(QueuedOperation::PaintTile, tile->page())
, m_tile(tile)
- , m_layer(layer)
+ , m_surface(surface)
+ , m_layer(0)
{
if (m_tile)
m_tile->setRepaintPending(true);
+ if (m_surface)
+ m_layer = surface->layer();
+ SkSafeRef(m_surface);
SkSafeRef(m_layer);
}
m_tile->setRepaintPending(false);
m_tile = 0;
}
+ SkSafeUnref(m_surface);
SkSafeUnref(m_layer);
}
namespace WebCore {
class LayerAndroid;
+class PaintedSurface;
class PaintTileOperation : public QueuedOperation {
public:
- PaintTileOperation(BaseTile* tile, LayerAndroid* layer = 0);
+ PaintTileOperation(BaseTile* tile, PaintedSurface* surface = 0);
virtual ~PaintTileOperation();
virtual bool operator==(const QueuedOperation* operation);
virtual void run();
private:
BaseTile* m_tile;
+ PaintedSurface* m_surface;
LayerAndroid* m_layer;
};
#include "ClassTracker.h"
#include "IntRect.h"
#include "LayerAndroid.h"
+#include "SkRefCnt.h"
#include "TextureOwner.h"
#include "TiledTexture.h"
#include "TilesManager.h"
namespace WebCore {
-class PaintedSurface : public TilePainter {
+class PaintedSurface : public SkRefCnt, TilePainter {
public:
PaintedSurface(LayerAndroid* layer)
: m_layer(layer)
removeOperationsForFilter(new PagePaintFilter(page), waitForRunning);
}
-void TexturesGenerator::removeOperationsForPainter(TilePainter* painter, bool waitForRunning)
-{
- removeOperationsForFilter(new TilePainterFilter(painter), waitForRunning);
-}
-
void TexturesGenerator::removeOperationsForFilter(OperationFilter* filter)
{
removeOperationsForFilter(filter, true);
virtual status_t readyToRun();
void removeOperationsForPage(TiledPage* page);
- void removeOperationsForPainter(TilePainter* painter, bool waitForRunning);
void removePaintOperationsForPage(TiledPage* page, bool waitForRunning);
void removeOperationsForFilter(OperationFilter* filter);
void removeOperationsForFilter(OperationFilter* filter, bool waitForRunning);
LayerAndroid* layer = m_surface->layer();
if (schedule && layer && !tile->isRepaintPending()) {
- PaintTileOperation *operation = new PaintTileOperation(tile, layer);
+ PaintTileOperation *operation = new PaintTileOperation(tile, m_surface);
TilesManager::instance()->scheduleOperation(operation);
}
}
void TiledTexture::removeTiles()
{
- TilesManager::instance()->removeOperationsForPainter(this, true);
for (unsigned int i = 0; i < m_tiles.size(); i++) {
delete m_tiles[i];
}
m_paintedSurfaces.append(surface);
}
-void TilesManager::cleanupTilesTextures()
-{
- // release existing surfaces without layers
- WTF::Vector<PaintedSurface*> collect;
- for (unsigned int i = 0; i < m_paintedSurfaces.size(); i++) {
- PaintedSurface* surface = m_paintedSurfaces[i];
- if (!surface->layer() && !surface->busy())
- collect.append(surface);
- }
- XLOG("remove %d / %d PaintedSurfaces", collect.size(), m_paintedSurfaces.size());
- for (unsigned int i = 0; i < collect.size(); i++) {
- m_paintedSurfaces.remove(m_paintedSurfaces.find(collect[i]));
- TilePainter* painter = collect[i]->texture();
- // Mark the current painter to destroy!!
- m_pixmapsGenerationThread->removeOperationsForPainter(painter, true);
- XLOG("destroy %x (%x)", collect[i], painter);
- delete collect[i];
- }
- for (unsigned int i = 0; i < m_tilesTextures.size(); i++) {
- BaseTileTexture* texture = m_tilesTextures[i];
- texture->setUsedLevel(-1);
- if (texture->owner()) {
- bool keep = false;
- for (unsigned int j = 0; j < m_paintedSurfaces.size(); j++) {
- if (m_paintedSurfaces[j]->owns(texture))
- keep = true;
- }
- if (!keep) {
- texture->release(texture->owner());
- }
- }
- }
-}
-
BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner)
{
android::Mutex::Autolock lock(m_texturesLock);
m_pixmapsGenerationThread->removeOperationsForPage(page);
}
- void removeOperationsForPainter(TilePainter* painter, bool waitForCompletion)
- {
- m_pixmapsGenerationThread->removeOperationsForPainter(painter, waitForCompletion);
- }
-
void removePaintOperationsForPage(TiledPage* page, bool waitForCompletion)
{
m_pixmapsGenerationThread->removePaintOperationsForPage(page, waitForCompletion);
BaseTileTexture* getAvailableTexture(BaseTile* owner);
- void cleanupTilesTextures();
-
void markGeneratorAsReady()
{
{