summaryrefslogtreecommitdiffstats
path: root/cc/tile_manager.cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 12:58:18 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-29 12:58:18 +0000
commit91e89bc85631eb357ead53afc8a5642fe7067b60 (patch)
tree97d0dc2f0c49043c22002f0a36fa08e9cfba65e2 /cc/tile_manager.cc
parenta09159a8a3658a616ebc7e32703c25366ac65a0f (diff)
downloadchromium_src-91e89bc85631eb357ead53afc8a5642fe7067b60.zip
chromium_src-91e89bc85631eb357ead53afc8a5642fe7067b60.tar.gz
chromium_src-91e89bc85631eb357ead53afc8a5642fe7067b60.tar.bz2
cc: Add ref counted PicturePileImpl class and give each Tile instance a ref.
This is required as tiles are reference counted and there's no guarantee that they have been destroyed by the time the layer owning the picture pile is destroyed. BUG=skia:988 TEST=manual Review URL: https://chromiumcodereview.appspot.com/11434016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170170 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/tile_manager.cc')
-rw-r--r--cc/tile_manager.cc16
1 files changed, 5 insertions, 11 deletions
diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc
index 504aa2e..93f05e3 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -16,7 +16,7 @@
namespace {
-void RasterizeTile(cc::PicturePile* picture_pile,
+void RasterizeTile(cc::PicturePileImpl* picture_pile,
uint8_t* mapped_buffer,
const gfx::Rect& rect) {
TRACE_EVENT0("cc", "RasterizeTile");
@@ -287,7 +287,7 @@ void TileManager::DispatchMoreRasterTasks() {
void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) {
TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask");
- scoped_ptr<PicturePile> cloned_picture_pile =
+ scoped_refptr<PicturePileImpl> cloned_picture_pile =
tile->picture_pile()->CloneForDrawing();
ManagedTileState& managed_tile_state = tile->managed_state();
@@ -299,17 +299,12 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) {
managed_tile_state.resource_id_is_being_initialized = true;
managed_tile_state.can_be_freed = false;
- // Get a pointer to the picture pile before the cloned_picture_pile
- // reference is passed to base::Bind.
- PicturePile* picture_pile = cloned_picture_pile.get();
- DCHECK(picture_pile);
-
++pending_raster_tasks_;
worker_pool_->GetTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)->PostTaskAndReply(
FROM_HERE,
base::Bind(&RasterizeTile,
- picture_pile,
+ base::Unretained(cloned_picture_pile.get()),
resource_pool_->resource_provider()->mapPixelBuffer(
resource_id),
tile->rect_inside_picture_),
@@ -317,19 +312,18 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) {
base::Unretained(this),
tile,
resource_id,
- base::Passed(&cloned_picture_pile)));
+ cloned_picture_pile));
}
void TileManager::OnRasterTaskCompleted(
scoped_refptr<Tile> tile,
ResourceProvider::ResourceId resource_id,
- scoped_ptr<PicturePile> cloned_picture_pile) {
+ scoped_refptr<PicturePileImpl> cloned_picture_pile) {
TRACE_EVENT0("cc", "TileManager::OnRasterTaskCompleted");
--pending_raster_tasks_;
// Release raster resources.
resource_pool_->resource_provider()->unmapPixelBuffer(resource_id);
- cloned_picture_pile.reset();
ManagedTileState& managed_tile_state = tile->managed_state();
managed_tile_state.can_be_freed = true;