| Index: cc/tile_manager.cc
|
| diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc
|
| index 06b5090ccfcf5407a7a4bfc2ab7641dd42b4d263..9c2b4caf76688f9170cd17ce1fc1aa435df8ae96 100644
|
| --- a/cc/tile_manager.cc
|
| +++ b/cc/tile_manager.cc
|
| @@ -69,11 +69,12 @@ class RasterThread : public base::Thread {
|
|
|
| void PostImageDecodingTaskAndReply(const tracked_objects::Location& from_here,
|
| skia::LazyPixelRef* pixel_ref,
|
| + RenderingStats* stats,
|
| const base::Closure& reply) {
|
| ++num_pending_tasks_;
|
| message_loop_proxy()->PostTaskAndReply(
|
| from_here,
|
| - base::Bind(&RunImageDecodeTask, base::Unretained(pixel_ref)),
|
| + base::Bind(&RunImageDecodeTask, pixel_ref, stats),
|
| base::Bind(&RasterThread::RunReply, base::Unretained(this), reply));
|
| }
|
|
|
| @@ -98,9 +99,13 @@ class RasterThread : public base::Thread {
|
| stats);
|
| }
|
|
|
| - static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref) {
|
| + static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref,
|
| + RenderingStats* stats) {
|
| TRACE_EVENT0("cc", "RasterThread::RunImageDecodeTask");
|
| + base::TimeTicks decodeBeginTime = base::TimeTicks::Now();
|
| pixel_ref->Decode();
|
| + stats->totalDeferredImageDecodeTimeInSeconds +=
|
| + (base::TimeTicks::Now() - decodeBeginTime).InSecondsF();
|
| }
|
|
|
| void RunReply(const base::Closure& reply) {
|
| @@ -329,8 +334,17 @@ void TileManager::CheckForCompletedSetPixels() {
|
|
|
| void TileManager::renderingStats(RenderingStats* stats) {
|
| stats->totalRasterizeTimeInSeconds =
|
| - rendering_stats_.totalRasterizeTimeInSeconds;
|
| + rendering_stats_.totalRasterizeTimeInSeconds;
|
| stats->totalPixelsRasterized = rendering_stats_.totalPixelsRasterized;
|
| + stats->totalDeferredImageDecodeCount =
|
| + rendering_stats_.totalDeferredImageDecodeCount;
|
| + stats->totalDeferredImageCacheHitCount =
|
| + rendering_stats_.totalDeferredImageCacheHitCount;
|
| + stats->totalPixelGatheringCount = rendering_stats_.totalPixelGatheringCount;
|
| + stats->totalDeferredImageDecodeTimeInSeconds =
|
| + rendering_stats_.totalDeferredImageDecodeTimeInSeconds;
|
| + stats->totalPixelGatheringTimeInSeconds =
|
| + rendering_stats_.totalPixelGatheringTimeInSeconds;
|
| }
|
|
|
| void TileManager::AssignGpuMemoryToTiles() {
|
| @@ -455,8 +469,12 @@ void TileManager::DispatchImageDecodingTasksForTile(Tile* tile) {
|
| if (managed_state.need_to_gather_pixel_refs) {
|
| TRACE_EVENT0("cc",
|
| "TileManager::DispatchImageDecodingTaskForTile: Gather PixelRefs");
|
| + base::TimeTicks gatherBeginTime = base::TimeTicks::Now();
|
| const_cast<PicturePileImpl *>(tile->picture_pile())->GatherPixelRefs(
|
| tile->content_rect_, managed_state.pending_pixel_refs);
|
| + rendering_stats_.totalPixelGatheringCount++;
|
| + rendering_stats_.totalPixelGatheringTimeInSeconds +=
|
| + (base::TimeTicks::Now() - gatherBeginTime).InSecondsF();
|
| managed_state.need_to_gather_pixel_refs = false;
|
| }
|
|
|
| @@ -471,11 +489,13 @@ void TileManager::DispatchImageDecodingTasksForTile(Tile* tile) {
|
| }
|
| // TODO(qinmin): passing correct image size to PrepareToDecode().
|
| if ((*it)->PrepareToDecode(skia::LazyPixelRef::PrepareParams())) {
|
| + rendering_stats_.totalDeferredImageCacheHitCount++;
|
| pending_pixel_refs.erase(it++);
|
| } else {
|
| RasterThread* thread = GetFreeRasterThread();
|
| - if (thread)
|
| - DispatchOneImageDecodingTask(thread, tile, *it);
|
| + if (!thread)
|
| + return;
|
| + DispatchOneImageDecodingTask(thread, tile, *it);
|
| ++it;
|
| }
|
| }
|
| @@ -489,21 +509,28 @@ void TileManager::DispatchOneImageDecodingTask(RasterThread* thread,
|
| DCHECK(pending_decode_tasks_.end() ==
|
| pending_decode_tasks_.find(pixel_ref_id));
|
| pending_decode_tasks_[pixel_ref_id] = pixel_ref;
|
| + RenderingStats* stats = new RenderingStats();
|
|
|
| thread->PostImageDecodingTaskAndReply(
|
| FROM_HERE,
|
| pixel_ref,
|
| + stats,
|
| base::Bind(&TileManager::OnImageDecodingTaskCompleted,
|
| base::Unretained(this),
|
| tile,
|
| - pixel_ref_id));
|
| + pixel_ref_id,
|
| + stats));
|
| }
|
|
|
| void TileManager::OnImageDecodingTaskCompleted(scoped_refptr<Tile> tile,
|
| - uint32_t pixel_ref_id) {
|
| + uint32_t pixel_ref_id,
|
| + RenderingStats* stats) {
|
| TRACE_EVENT0("cc", "TileManager::OnImageDecoded");
|
| pending_decode_tasks_.erase(pixel_ref_id);
|
| -
|
| + rendering_stats_.totalDeferredImageDecodeTimeInSeconds +=
|
| + stats->totalDeferredImageDecodeTimeInSeconds;
|
| + rendering_stats_.totalDeferredImageDecodeCount++;
|
| + delete stats;
|
| for (TileList::iterator it = tiles_with_image_decoding_tasks_.begin();
|
| it != tiles_with_image_decoding_tasks_.end(); ++it) {
|
| std::list<skia::LazyPixelRef*>& pixel_refs =
|
|
|