Chromium Code Reviews| Index: cc/resources/tile_manager.cc |
| diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc |
| index 61a28f7b82dae162ed7699e7d3e6f5f4b27153d7..94c0689c77e1a399ad756dcc12a5d6ca8988b5d2 100644 |
| --- a/cc/resources/tile_manager.cc |
| +++ b/cc/resources/tile_manager.cc |
| @@ -120,7 +120,6 @@ TileManager::TileManager( |
| resource_pool_(ResourcePool::Create(resource_provider)), |
| raster_worker_pool_(RasterWorkerPool::Create(this, num_raster_threads)), |
| manage_tiles_pending_(false), |
| - manage_tiles_call_count_(0), |
| bytes_pending_upload_(0), |
| has_performed_uploads_since_last_flush_(false), |
| ever_exceeded_memory_budget_(false), |
| @@ -128,7 +127,6 @@ TileManager::TileManager( |
| use_color_estimator_(use_color_estimator), |
| prediction_benchmarking_(prediction_benchmarking), |
| did_initialize_visible_tile_(false), |
| - pending_tasks_(0), |
| max_pending_tasks_(kMaxNumPendingTasksPerThread * num_raster_threads) { |
| } |
| @@ -290,7 +288,6 @@ void TileManager::ManageTiles() { |
| TRACE_COUNTER_ID1("cc", "TileCount", this, tiles_.size()); |
| manage_tiles_pending_ = false; |
| - ++manage_tiles_call_count_; |
| AssignBinsToTiles(); |
| SortTiles(); |
| @@ -299,8 +296,8 @@ void TileManager::ManageTiles() { |
| TRACE_EVENT_INSTANT1("cc", "DidManage", TRACE_EVENT_SCOPE_THREAD, |
| "state", ValueToString(BasicStateAsValue())); |
| - // Finally, kick the rasterizer. |
| - DispatchMoreTasks(); |
| + // Finally, schedule rasterizer tasks. |
| + ScheduleTasks(); |
| } |
| void TileManager::CheckForCompletedTileUploads() { |
| @@ -327,7 +324,7 @@ void TileManager::CheckForCompletedTileUploads() { |
| tiles_with_pending_upload_.pop(); |
| } |
| - DispatchMoreTasks(); |
| + ScheduleTasks(); |
| } |
| void TileManager::AbortPendingTileUploads() { |
| @@ -438,7 +435,7 @@ void TileManager::DidFinishDispatchingWorkerPoolCompletionCallbacks() { |
| has_performed_uploads_since_last_flush_ = false; |
| } |
| - DispatchMoreTasks(); |
| + ScheduleTasks(); |
| } |
| void TileManager::AssignGpuMemoryToTiles() { |
| @@ -452,7 +449,7 @@ void TileManager::AssignGpuMemoryToTiles() { |
| // By clearing the tiles_that_need_to_be_rasterized_ vector list |
| // above we move all tiles currently waiting for raster to idle state. |
| // Some memory cannot be released. We figure out how much in this |
| - // loop as well. |
| + // loop. |
| for (TileVector::const_iterator it = tiles_.begin(); |
| it != tiles_.end(); |
| ++it) { |
| @@ -471,6 +468,7 @@ void TileManager::AssignGpuMemoryToTiles() { |
| size_t bytes_left = bytes_allocatable; |
| size_t bytes_oom_in_now_bin_on_pending_tree = 0; |
| TileVector tiles_requiring_memory_but_oomed; |
| + bool higher_priority_tile_oomed = false; |
| for (TileVector::iterator it = tiles_.begin(); |
| it != tiles_.end(); |
| ++it) { |
| @@ -478,36 +476,47 @@ void TileManager::AssignGpuMemoryToTiles() { |
| ManagedTileState& mts = tile->managed_state(); |
| ManagedTileState::DrawingInfo& drawing_info = tile->drawing_info(); |
| - // If this tile doesn't need a resource, or if the memory |
| - // is unreleasable, then we do not need to do anything. |
| - if (!drawing_info.requires_resource() || |
| - drawing_info.memory_state_ == USING_UNRELEASABLE_MEMORY) { |
| + // If this tile doesn't need a resource, then we do not need |
| + // to do anything. |
| + if (!drawing_info.requires_resource()) |
| continue; |
| - } |
| size_t tile_bytes = tile->bytes_consumed_if_allocated(); |
| + // Memory is already reserved for tile with unreleasable memory |
| + // so adding it to |tiles_that_need_to_be_rasterized_| doesn't |
| + // affect bytes_allocatable. |
| + if (drawing_info.memory_state_ == USING_UNRELEASABLE_MEMORY) |
| + tile_bytes = 0; |
| + |
| // If the tile is not needed, free it up. |
| if (mts.is_in_never_bin_on_both_trees()) { |
| - FreeResourcesForTile(tile); |
| - drawing_info.memory_state_ = NOT_ALLOWED_TO_USE_MEMORY; |
| + if (drawing_info.memory_state_ != USING_UNRELEASABLE_MEMORY) { |
| + FreeResourcesForTile(tile); |
| + drawing_info.memory_state_ = NOT_ALLOWED_TO_USE_MEMORY; |
| + } |
| continue; |
| } |
| // Tile is OOM. |
| if (tile_bytes > bytes_left) { |
| - FreeResourcesForTile(tile); |
| tile->drawing_info().set_rasterize_on_demand(); |
| if (mts.tree_bin[PENDING_TREE] == NOW_BIN) { |
| tiles_requiring_memory_but_oomed.push_back(tile); |
| bytes_oom_in_now_bin_on_pending_tree += tile_bytes; |
| } |
| + FreeResourcesForTile(tile); |
| + higher_priority_tile_oomed = true; |
| continue; |
| } |
| drawing_info.set_use_resource(); |
| bytes_left -= tile_bytes; |
| - if (!drawing_info.resource_ && |
| - drawing_info.memory_state_ == CAN_USE_MEMORY) { |
| + // Tile shouldn't be rasterized if we've failed to assign |
|
vmpstr
2013/05/06 18:05:51
If a large tile is OOM, followed by a smaller tile
reveman
2013/05/06 21:36:27
Yes, being assigned memory is not the same as bein
|
| + // gpu memory to a higher priority tile. This is important for |
| + // two reasons: |
| + // 1. Tile size should not impact raster priority. |
| + // 2. Tile with unreleasable memory could otherwise incorrectly |
| + // be added as it's not affected by |bytes_allocatable|. |
| + if (!drawing_info.resource_ && !higher_priority_tile_oomed) |
| tiles_that_need_to_be_rasterized_.push_back(tile); |
| - } |
| } |
| // In OOM situation, we iterate tiles_, remove the memory for active tree |
| @@ -563,16 +572,10 @@ void TileManager::AssignGpuMemoryToTiles() { |
| memory_stats_from_last_assign_.bytes_unreleasable = unreleasable_bytes; |
| memory_stats_from_last_assign_.bytes_over = |
| bytes_that_exceeded_memory_budget_in_now_bin; |
| - |
| - // Reverse two tiles_that_need_* vectors such that pop_back gets |
| - // the highest priority tile. |
| - std::reverse( |
| - tiles_that_need_to_be_rasterized_.begin(), |
| - tiles_that_need_to_be_rasterized_.end()); |
| } |
| void TileManager::FreeResourcesForTile(Tile* tile) { |
| - DCHECK(tile->drawing_info().memory_state_ != USING_UNRELEASABLE_MEMORY); |
| + DCHECK_NE(USING_UNRELEASABLE_MEMORY, tile->drawing_info().memory_state_); |
|
vmpstr
2013/05/06 18:05:51
nit: I kinda prefer the constant to be the second
reveman
2013/05/06 21:36:27
DCHECK_NE is used in both ways throughout chromium
|
| if (tile->drawing_info().resource_) { |
| resource_pool_->ReleaseResource( |
| tile->drawing_info().resource_.Pass()); |
| @@ -580,145 +583,172 @@ void TileManager::FreeResourcesForTile(Tile* tile) { |
| tile->drawing_info().memory_state_ = NOT_ALLOWED_TO_USE_MEMORY; |
| } |
| -bool TileManager::CanDispatchRasterTask(Tile* tile) const { |
| - if (pending_tasks_ >= max_pending_tasks_) |
| - return false; |
| - size_t new_bytes_pending = bytes_pending_upload_; |
| - new_bytes_pending += tile->bytes_consumed_if_allocated(); |
| - return new_bytes_pending <= kMaxPendingUploadBytes && |
| - tiles_with_pending_upload_.size() < kMaxPendingUploads; |
| -} |
| +void TileManager::ScheduleTasks() { |
| + TRACE_EVENT0("cc", "TileManager::ScheduleTasks"); |
| + RasterWorkerPool::Task::Queue task_queue; |
| -void TileManager::DispatchMoreTasks() { |
| - TileVector tiles_with_image_decoding_tasks; |
| + size_t bytes_pending_upload = bytes_pending_upload_; |
| + ManagedTileState::PixelRefSet decode_tasks; |
| + // Build a new task queue containing all task currently needed. Tasks |
| + // are added to queue in order of priority, highest priority task first. |
| + // |
| // Process all tiles in the need_to_be_rasterized queue: |
| - // 1. Dispatch image decode tasks. |
| - // 2. If the image decode isn't done, save the tile for later processing. |
| - // 3. Attempt to dispatch a raster task, or break out of the loop. |
| - while (!tiles_that_need_to_be_rasterized_.empty()) { |
| - Tile* tile = tiles_that_need_to_be_rasterized_.back(); |
| - |
| - DCHECK(tile->drawing_info().requires_resource()); |
| + // 1. Queue image decode tasks for tile. |
| + // 2. If the image decode is pending, skip tile for later processing. |
| + // 3. Attempt to queue a raster task, or break out of the loop. |
| + for (TileVector::iterator it = tiles_that_need_to_be_rasterized_.begin(); |
| + it != tiles_that_need_to_be_rasterized_.end(); |
| + ++it) { |
| + Tile* tile = *it; |
| - if (DispatchImageDecodeTasksForTile(tile)) { |
| - tiles_with_image_decoding_tasks.push_back(tile); |
| - } else if (!CanDispatchRasterTask(tile)) { |
| - break; |
| - } else { |
| - DispatchOneRasterTask(tile); |
| - } |
| - tiles_that_need_to_be_rasterized_.pop_back(); |
| - } |
| + // Skip tile if determined to not require resource. |
| + if (!tile->drawing_info().requires_resource()) |
| + continue; |
| - // Put the saved tiles back into the queue. The order is reversed |
| - // to preserve original ordering. |
| - tiles_that_need_to_be_rasterized_.insert( |
| - tiles_that_need_to_be_rasterized_.end(), |
| - tiles_with_image_decoding_tasks.rbegin(), |
| - tiles_with_image_decoding_tasks.rend()); |
| + // Skip tile if already rasterized. |
| + if (tile->drawing_info().resource_) |
| + continue; |
| - if (did_initialize_visible_tile_) { |
| - did_initialize_visible_tile_ = false; |
| - client_->DidInitializeVisibleTile(); |
| - } |
| -} |
| + bool pending_decode_tasks = false; |
| + ManagedTileState& mts = tile->managed_state(); |
| -bool TileManager::DispatchImageDecodeTasksForTile(Tile* tile) { |
|
vmpstr
2013/05/06 18:05:51
I guess my earlier comment is asking to just renam
reveman
2013/05/06 21:36:27
Done.
|
| - TRACE_EVENT0("cc", "TileManager::DispatchImageDecodeTasksForTile"); |
| - ManagedTileState& mts = tile->managed_state(); |
| - bool pending_decode_tasks = false; |
| + for (PicturePileImpl::PixelRefIterator iter(tile->content_rect(), |
|
vmpstr
2013/05/06 18:05:51
Is it possible to refactor this loop into a separa
reveman
2013/05/06 21:36:27
Done.
|
| + tile->contents_scale(), |
| + tile->picture_pile()); |
| + iter; ++iter) { |
| + skia::LazyPixelRef* pixel_ref = *iter; |
| + uint32_t id = pixel_ref->getGenerationID(); |
| - for (PicturePileImpl::PixelRefIterator iter(tile->content_rect(), |
| - tile->contents_scale(), |
| - tile->picture_pile()); |
| - iter; ++iter) { |
| - skia::LazyPixelRef* pixel_ref = *iter; |
| - uint32_t id = pixel_ref->getGenerationID(); |
| + // Check if image has already been decoded for this tile. |
| + if (mts.decoded_pixel_refs.find(id) != mts.decoded_pixel_refs.end()) |
| + continue; |
| - // Check if image has already been decoded. |
| - if (mts.decoded_pixel_refs.find(id) != mts.decoded_pixel_refs.end()) |
| - continue; |
| + // TODO(qinmin): passing correct image size to PrepareToDecode(). |
| + if (pixel_ref->PrepareToDecode(skia::LazyPixelRef::PrepareParams())) { |
| + rendering_stats_instrumentation_->IncrementDeferredImageCacheHitCount(); |
| + mts.decoded_pixel_refs.insert(id); |
| + continue; |
| + } |
| - // Check if decode task is already pending. |
| - if (pending_decode_tasks_.find(id) != pending_decode_tasks_.end()) { |
| pending_decode_tasks = true; |
| - continue; |
| + |
| + // TODO(reveman): Remove max pending tasks throttling. |
| + if (task_queue.size() >= max_pending_tasks_) |
| + break; |
| + |
| + // Check if already added to |task_queue|. There should only be |
| + // one task per pixel ref. |
| + if (decode_tasks.find(id) != decode_tasks.end()) |
| + continue; |
| + decode_tasks.insert(id); |
| + |
| + // Queue existing task if available. |
| + PixelRefMap::iterator decode_task_it = pending_decode_tasks_.find(id); |
| + if (decode_task_it != pending_decode_tasks_.end()) { |
| + task_queue.Append(decode_task_it->second); |
| + continue; |
| + } |
| + |
| + // Create and queue new image decode task for this pixel ref. |
| + RasterWorkerPool::Task decode_task = CreateImageDecodeTask( |
| + tile, pixel_ref); |
| + task_queue.Append(decode_task); |
| + pending_decode_tasks_[id] = decode_task; |
| } |
| - // TODO(qinmin): passing correct image size to PrepareToDecode(). |
| - if (pixel_ref->PrepareToDecode(skia::LazyPixelRef::PrepareParams())) { |
| - rendering_stats_instrumentation_->IncrementDeferredImageCacheHitCount(); |
| - mts.decoded_pixel_refs.insert(id); |
| + // Skip tile if image decode is pending. |
| + if (pending_decode_tasks) |
| continue; |
| - } |
| - if (pending_tasks_ >= max_pending_tasks_) |
| + // TODO(reveman): Remove throttling based on max pending tasks. |
| + if (task_queue.size() >= max_pending_tasks_) |
| break; |
| - DispatchOneImageDecodeTask(tile, pixel_ref); |
| - pending_decode_tasks = true; |
| + // TODO(reveman): Remove throttling based on max pending uploads. |
| + if (tiles_with_pending_upload_.size() >= kMaxPendingUploads) |
| + break; |
| + |
| + // TODO(reveman): Throttle based on shared memory usage rather |
| + // than bytes pending upload. |
| + size_t new_bytes_pending = bytes_pending_upload; |
| + new_bytes_pending += tile->bytes_consumed_if_allocated(); |
| + if (new_bytes_pending > kMaxPendingUploadBytes) |
| + break; |
| + bytes_pending_upload = new_bytes_pending; |
| + |
| + // Create raster task for this tile if necessary. |
| + if (mts.raster_task.is_null()) |
| + mts.raster_task = CreateRasterTask(tile); |
| + |
| + // Finally queue raster task for tile. |
| + task_queue.Append(mts.raster_task); |
| } |
| - return pending_decode_tasks; |
| + // Schedule running of tasks in |task_queue|. This replaces any |
| + // previously scheduled tasks and effectively cancels any tasks |
|
vmpstr
2013/05/06 18:05:51
How do we cancel an upload? (or ensure upload cont
reveman
2013/05/06 21:36:27
We can't cancel an upload at the moment but that's
|
| + // not present in |task_queue|. |
| + raster_worker_pool_->ScheduleTasks(&task_queue); |
| + |
| + if (did_initialize_visible_tile_) { |
| + did_initialize_visible_tile_ = false; |
| + client_->DidInitializeVisibleTile(); |
| + } |
| } |
| -void TileManager::DispatchOneImageDecodeTask( |
| - scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref) { |
| - TRACE_EVENT0("cc", "TileManager::DispatchOneImageDecodeTask"); |
| - uint32_t pixel_ref_id = pixel_ref->getGenerationID(); |
| - DCHECK(pending_decode_tasks_.end() == |
| - pending_decode_tasks_.find(pixel_ref_id)); |
| - pending_decode_tasks_.insert(pixel_ref_id); |
| +RasterWorkerPool::Task TileManager::CreateImageDecodeTask( |
| + Tile* tile, skia::LazyPixelRef* pixel_ref) { |
| + TRACE_EVENT0("cc", "TileManager::CreateImageDecodeTask"); |
| - raster_worker_pool_->PostTaskAndReply( |
| + return RasterWorkerPool::Task( |
| base::Bind(&TileManager::RunImageDecodeTask, |
| pixel_ref, |
| rendering_stats_instrumentation_), |
| base::Bind(&TileManager::OnImageDecodeTaskCompleted, |
| base::Unretained(this), |
| - tile, |
| - pixel_ref_id)); |
| - pending_tasks_++; |
| + make_scoped_refptr(tile), |
| + pixel_ref->getGenerationID())); |
| } |
| -void TileManager::OnImageDecodeTaskCompleted( |
| - scoped_refptr<Tile> tile, uint32_t pixel_ref_id) { |
| +void TileManager::OnImageDecodeTaskCompleted(scoped_refptr<Tile> tile, |
| + uint32_t pixel_ref_id, |
| + bool was_cancelled) { |
| TRACE_EVENT0("cc", "TileManager::OnImageDecodeTaskCompleted"); |
| + DCHECK(pending_decode_tasks_.find(pixel_ref_id) != |
| + pending_decode_tasks_.end()); |
| + pending_decode_tasks_.erase(pixel_ref_id); |
| + if (was_cancelled) |
| + return; |
| ManagedTileState& mts = tile->managed_state(); |
| + // Note: |decoded_pixel_refs| might already contain |pixel_ref_id| as |
| + // the PrepareToDecode() check in ScheduleTasks() could have added it. |
| mts.decoded_pixel_refs.insert(pixel_ref_id); |
| - pending_decode_tasks_.erase(pixel_ref_id); |
| - pending_tasks_--; |
| } |
| -scoped_ptr<ResourcePool::Resource> TileManager::PrepareTileForRaster( |
| - Tile* tile) { |
| - scoped_ptr<ResourcePool::Resource> resource = resource_pool_->AcquireResource( |
| - tile->tile_size_.size(), |
| - tile->drawing_info().resource_format_); |
| +RasterWorkerPool::Task TileManager::CreateRasterTask(Tile* tile) { |
| + TRACE_EVENT0("cc", "TileManager::CreateRasterTask"); |
| + |
| + scoped_ptr<ResourcePool::Resource> resource = |
| + resource_pool_->AcquireResource( |
| + tile->tile_size_.size(), |
| + tile->drawing_info().resource_format_); |
| resource_pool_->resource_provider()->AcquirePixelBuffer(resource->id()); |
| + DCHECK_EQ(CAN_USE_MEMORY, tile->drawing_info().memory_state_); |
| tile->drawing_info().memory_state_ = USING_UNRELEASABLE_MEMORY; |
| - return resource.Pass(); |
| -} |
| - |
| -void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { |
| - TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask"); |
| - scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile); |
| - ResourceProvider::ResourceId resource_id = resource->id(); |
| PicturePileImpl::Analysis* analysis = new PicturePileImpl::Analysis; |
| // MapPixelBuffer() returns NULL if context was lost at the time |
| // AcquirePixelBuffer() was called. For simplicity we still post |
| // a raster task that is essentially a noop in these situations. |
| uint8* buffer = resource_pool_->resource_provider()->MapPixelBuffer( |
| - resource_id); |
| + resource->id()); |
| // skia requires that our buffer be 4-byte aligned |
| CHECK(!(reinterpret_cast<intptr_t>(buffer) & 3)); |
|
vmpstr
2013/05/06 18:05:51
I would vote that this moves into MapPixelBuffer,
reveman
2013/05/06 21:36:27
I agree. Moving it RP and closer to the source as
|
| - raster_worker_pool_->PostRasterTaskAndReply( |
| + return RasterWorkerPool::PictureTask( |
| tile->picture_pile(), |
| base::Bind(&TileManager::RunAnalyzeAndRasterTask, |
| base::Bind(&TileManager::RunAnalyzeTask, |
| @@ -737,11 +767,9 @@ void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { |
| rendering_stats_instrumentation_)), |
| base::Bind(&TileManager::OnRasterTaskCompleted, |
| base::Unretained(this), |
| - tile, |
| + make_scoped_refptr(tile), |
| base::Passed(&resource), |
| - base::Owned(analysis), |
| - manage_tiles_call_count_)); |
| - pending_tasks_++; |
| + base::Owned(analysis))); |
| } |
| TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata( |
| @@ -760,19 +788,28 @@ void TileManager::OnRasterTaskCompleted( |
| scoped_refptr<Tile> tile, |
| scoped_ptr<ResourcePool::Resource> resource, |
| PicturePileImpl::Analysis* analysis, |
| - int manage_tiles_call_count_when_dispatched) { |
| + bool was_cancelled) { |
| TRACE_EVENT0("cc", "TileManager::OnRasterTaskCompleted"); |
| - pending_tasks_--; |
| + ManagedTileState& mts = tile->managed_state(); |
| + DCHECK(!mts.raster_task.is_null()); |
| + mts.raster_task.Reset(); |
| + |
| + // Tile resources can't be freed until upload has completed. |
| + DCHECK_EQ(USING_UNRELEASABLE_MEMORY, tile->drawing_info().memory_state_); |
| // Release raster resources. |
| resource_pool_->resource_provider()->UnmapPixelBuffer(resource->id()); |
| - tile->drawing_info().memory_state_ = USING_RELEASABLE_MEMORY; |
| + if (was_cancelled) { |
| + tile->drawing_info().memory_state_ = CAN_USE_MEMORY; |
|
vmpstr
2013/05/06 18:05:51
Why can use memory? I would think that if it was c
reveman
2013/05/06 21:36:27
The tile will always be allowed to use memory at t
|
| + resource_pool_->resource_provider()->ReleasePixelBuffer(resource->id()); |
| + resource_pool_->ReleaseResource(resource.Pass()); |
| + return; |
| + } |
| - ManagedTileState& managed_tile_state = tile->managed_state(); |
| - managed_tile_state.picture_pile_analysis = *analysis; |
| - managed_tile_state.picture_pile_analyzed = true; |
| + mts.picture_pile_analysis = *analysis; |
| + mts.picture_pile_analyzed = true; |
| if (analysis->is_solid_color) { |
| tile->drawing_info().set_solid_color(analysis->solid_color); |
| @@ -782,31 +819,13 @@ void TileManager::OnRasterTaskCompleted( |
| return; |
| } |
| - // Tile can be freed after the completion of the raster task. Call |
| - // AssignGpuMemoryToTiles() to re-assign gpu memory to highest priority |
| - // tiles if ManageTiles() was called since task was dispatched. The result |
| - // of this could be that this tile is no longer allowed to use gpu |
| - // memory and in that case we need to abort initialization and free all |
| - // associated resources before calling DispatchMoreTasks(). |
| - if (manage_tiles_call_count_when_dispatched != manage_tiles_call_count_) |
| - AssignGpuMemoryToTiles(); |
| - |
| - // Finish resource initialization we're still using memory. |
| - if (tile->drawing_info().memory_state_ == USING_RELEASABLE_MEMORY) { |
| - // Tile resources can't be freed until upload has completed. |
| - tile->drawing_info().memory_state_ = USING_UNRELEASABLE_MEMORY; |
| + resource_pool_->resource_provider()->BeginSetPixels(resource->id()); |
| + has_performed_uploads_since_last_flush_ = true; |
| - resource_pool_->resource_provider()->BeginSetPixels(resource->id()); |
| - has_performed_uploads_since_last_flush_ = true; |
| + tile->drawing_info().resource_ = resource.Pass(); |
| - tile->drawing_info().resource_ = resource.Pass(); |
| - |
| - bytes_pending_upload_ += tile->bytes_consumed_if_allocated(); |
| - tiles_with_pending_upload_.push(tile); |
| - } else { |
| - resource_pool_->resource_provider()->ReleasePixelBuffer(resource->id()); |
| - resource_pool_->ReleaseResource(resource.Pass()); |
| - } |
| + bytes_pending_upload_ += tile->bytes_consumed_if_allocated(); |
| + tiles_with_pending_upload_.push(tile); |
| } |
| void TileManager::DidFinishTileInitialization(Tile* tile) { |
| @@ -822,9 +841,20 @@ void TileManager::DidTileTreeBinChange(Tile* tile, |
| } |
| // static |
| +void TileManager::RunImageDecodeTask( |
| + skia::LazyPixelRef* pixel_ref, |
| + RenderingStatsInstrumentation* stats_instrumentation) { |
| + TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
| + base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
| + pixel_ref->Decode(); |
| + base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
| + stats_instrumentation->AddDeferredImageDecode(duration); |
| +} |
| + |
| +// static |
| void TileManager::RunAnalyzeAndRasterTask( |
| - const RasterWorkerPool::RasterCallback& analyze_task, |
| - const RasterWorkerPool::RasterCallback& raster_task, |
| + const RasterWorkerPool::PictureTask::Callback& analyze_task, |
| + const RasterWorkerPool::PictureTask::Callback& raster_task, |
| PicturePileImpl* picture_pile) { |
| analyze_task.Run(picture_pile); |
| raster_task.Run(picture_pile); |
| @@ -926,17 +956,6 @@ void TileManager::RunRasterTask( |
| } |
| // static |
| -void TileManager::RunImageDecodeTask( |
| - skia::LazyPixelRef* pixel_ref, |
| - RenderingStatsInstrumentation* stats_instrumentation) { |
| - TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
| - base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
| - pixel_ref->Decode(); |
| - base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
| - stats_instrumentation->AddDeferredImageDecode(duration); |
| -} |
| - |
| -// static |
| void TileManager::RecordSolidColorPredictorResults( |
| const SkPMColor* actual_colors, |
| size_t color_count, |