OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/resources/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
11 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "cc/debug/devtools_instrumentation.h" | 15 #include "cc/debug/devtools_instrumentation.h" |
15 #include "cc/resources/platform_color.h" | 16 #include "cc/resources/platform_color.h" |
16 #include "cc/resources/raster_worker_pool.h" | 17 #include "cc/resources/raster_worker_pool.h" |
17 #include "cc/resources/resource_pool.h" | 18 #include "cc/resources/resource_pool.h" |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 new_bytes_pending += tile->bytes_consumed_if_allocated(); | 643 new_bytes_pending += tile->bytes_consumed_if_allocated(); |
643 return new_bytes_pending <= kMaxPendingUploadBytes && | 644 return new_bytes_pending <= kMaxPendingUploadBytes && |
644 tiles_with_pending_upload_.size() < kMaxPendingUploads; | 645 tiles_with_pending_upload_.size() < kMaxPendingUploads; |
645 } | 646 } |
646 | 647 |
647 void TileManager::DispatchMoreTasks() { | 648 void TileManager::DispatchMoreTasks() { |
648 // Because tiles in the image decoding list have higher priorities, we | 649 // Because tiles in the image decoding list have higher priorities, we |
649 // need to process those tiles first before we start to handle the tiles | 650 // need to process those tiles first before we start to handle the tiles |
650 // in the need_to_be_rasterized queue. Note that solid/transparent tiles | 651 // in the need_to_be_rasterized queue. Note that solid/transparent tiles |
651 // will not be put into the decoding list. | 652 // will not be put into the decoding list. |
652 for(TileList::iterator it = tiles_with_image_decoding_tasks_.begin(); | 653 for (TileList::iterator it = tiles_with_image_decoding_tasks_.begin(); |
653 it != tiles_with_image_decoding_tasks_.end(); ) { | 654 it != tiles_with_image_decoding_tasks_.end(); ) { |
654 ManagedTileState& managed_tile_state = (*it)->managed_state(); | 655 ManagedTileState& managed_tile_state = (*it)->managed_state(); |
655 DispatchImageDecodeTasksForTile(*it); | 656 DispatchImageDecodeTasksForTile(*it); |
656 if (managed_tile_state.pending_pixel_refs.empty()) { | 657 if (managed_tile_state.pending_pixel_refs.empty()) { |
657 if (!CanDispatchRasterTask(*it)) | 658 if (!CanDispatchRasterTask(*it)) |
658 return; | 659 return; |
659 DispatchOneRasterTask(*it); | 660 DispatchOneRasterTask(*it); |
660 tiles_with_image_decoding_tasks_.erase(it++); | 661 tiles_with_image_decoding_tasks_.erase(it++); |
661 } else { | 662 } else { |
662 ++it; | 663 ++it; |
663 } | 664 } |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 SkColor actual_color = *actual_colors; | 1049 SkColor actual_color = *actual_colors; |
1049 for (unsigned int i = 0; i < color_count; ++i) { | 1050 for (unsigned int i = 0; i < color_count; ++i) { |
1050 SkColor current_color = actual_colors[i]; | 1051 SkColor current_color = actual_colors[i]; |
1051 if (current_color != actual_color || | 1052 if (current_color != actual_color || |
1052 SkColorGetA(current_color) != 255) | 1053 SkColorGetA(current_color) != 255) |
1053 is_actually_solid = false; | 1054 is_actually_solid = false; |
1054 | 1055 |
1055 if (SkColorGetA(current_color) != 0) | 1056 if (SkColorGetA(current_color) != 0) |
1056 is_transparent = false; | 1057 is_transparent = false; |
1057 | 1058 |
1058 if(!is_actually_solid && !is_transparent) | 1059 if (!is_actually_solid && !is_transparent) |
1059 break; | 1060 break; |
1060 } | 1061 } |
1061 | 1062 |
1062 if (is_predicted_solid && !is_actually_solid) | 1063 if (is_predicted_solid && !is_actually_solid) |
1063 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualNotSolid", true); | 1064 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualNotSolid", true); |
1064 else if (is_predicted_solid && | 1065 else if (is_predicted_solid && |
1065 is_actually_solid && | 1066 is_actually_solid && |
1066 predicted_color != actual_color) | 1067 predicted_color != actual_color) |
1067 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongColor", true); | 1068 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongColor", true); |
1068 else if (!is_predicted_solid && is_actually_solid) | 1069 else if (!is_predicted_solid && is_actually_solid) |
(...skipping 21 matching lines...) Expand all Loading... |
1090 skia::LazyPixelRef* pixel_ref, | 1091 skia::LazyPixelRef* pixel_ref, |
1091 RenderingStatsInstrumentation* stats_instrumentation) { | 1092 RenderingStatsInstrumentation* stats_instrumentation) { |
1092 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); | 1093 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
1093 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 1094 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
1094 pixel_ref->Decode(); | 1095 pixel_ref->Decode(); |
1095 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); | 1096 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); |
1096 stats_instrumentation->AddDeferredImageDecode(duration); | 1097 stats_instrumentation->AddDeferredImageDecode(duration); |
1097 } | 1098 } |
1098 | 1099 |
1099 } // namespace cc | 1100 } // namespace cc |
OLD | NEW |