Chromium Code Reviews| 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/tile_manager.h" | 5 #include "cc/tile_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 state->Set("resolution", TileResolutionAsValue(resolution).release()); | 170 state->Set("resolution", TileResolutionAsValue(resolution).release()); |
| 171 state->Set("time_to_needed_in_seconds", MathUtil::asValueSafely(time_to_needed _in_seconds).release()); | 171 state->Set("time_to_needed_in_seconds", MathUtil::asValueSafely(time_to_needed _in_seconds).release()); |
| 172 state->Set("distance_to_visible_in_pixels", MathUtil::asValueSafely(distance_t o_visible_in_pixels).release()); | 172 state->Set("distance_to_visible_in_pixels", MathUtil::asValueSafely(distance_t o_visible_in_pixels).release()); |
| 173 return state.PassAs<base::Value>(); | 173 return state.PassAs<base::Value>(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 TileManager::TileManager( | 176 TileManager::TileManager( |
| 177 TileManagerClient* client, | 177 TileManagerClient* client, |
| 178 ResourceProvider* resource_provider, | 178 ResourceProvider* resource_provider, |
| 179 size_t num_raster_threads, | 179 size_t num_raster_threads, |
| 180 bool use_cheapness_estimator) | 180 bool use_cheapness_estimator, |
| 181 bool use_color_estimator, | |
| 182 bool prediction_benchmarking) | |
| 181 : client_(client), | 183 : client_(client), |
| 182 resource_pool_(ResourcePool::Create(resource_provider)), | 184 resource_pool_(ResourcePool::Create(resource_provider)), |
| 183 raster_worker_pool_(RasterWorkerPool::Create(this, num_raster_threads)), | 185 raster_worker_pool_(RasterWorkerPool::Create(this, num_raster_threads)), |
| 184 manage_tiles_pending_(false), | 186 manage_tiles_pending_(false), |
| 185 manage_tiles_call_count_(0), | 187 manage_tiles_call_count_(0), |
| 186 bytes_pending_upload_(0), | 188 bytes_pending_upload_(0), |
| 187 has_performed_uploads_since_last_flush_(false), | 189 has_performed_uploads_since_last_flush_(false), |
| 188 ever_exceeded_memory_budget_(false), | 190 ever_exceeded_memory_budget_(false), |
| 189 record_rendering_stats_(false), | 191 record_rendering_stats_(false), |
| 190 use_cheapness_estimator_(use_cheapness_estimator), | 192 use_cheapness_estimator_(use_cheapness_estimator), |
| 193 use_color_estimator_(use_color_estimator), | |
| 191 allow_cheap_tasks_(true), | 194 allow_cheap_tasks_(true), |
| 192 did_schedule_cheap_tasks_(false) { | 195 did_schedule_cheap_tasks_(false), |
| 196 prediction_benchmarking_(prediction_benchmarking) { | |
| 193 for (int i = 0; i < NUM_STATES; ++i) { | 197 for (int i = 0; i < NUM_STATES; ++i) { |
| 194 for (int j = 0; j < NUM_TREES; ++j) { | 198 for (int j = 0; j < NUM_TREES; ++j) { |
| 195 for (int k = 0; k < NUM_BINS; ++k) | 199 for (int k = 0; k < NUM_BINS; ++k) |
| 196 raster_state_count_[i][j][k] = 0; | 200 raster_state_count_[i][j][k] = 0; |
| 197 } | 201 } |
| 198 } | 202 } |
| 199 } | 203 } |
| 200 | 204 |
| 201 TileManager::~TileManager() { | 205 TileManager::~TileManager() { |
| 202 // Reset global state and manage. This should cause | 206 // Reset global state and manage. This should cause |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 DidTileTreeBinChange(tile, | 368 DidTileTreeBinChange(tile, |
| 365 bin_map[BinFromTilePriority(tile->priority(ACTIVE_TREE))], | 369 bin_map[BinFromTilePriority(tile->priority(ACTIVE_TREE))], |
| 366 ACTIVE_TREE); | 370 ACTIVE_TREE); |
| 367 DidTileTreeBinChange(tile, | 371 DidTileTreeBinChange(tile, |
| 368 bin_map[BinFromTilePriority(tile->priority(PENDING_TREE))], | 372 bin_map[BinFromTilePriority(tile->priority(PENDING_TREE))], |
| 369 PENDING_TREE); | 373 PENDING_TREE); |
| 370 | 374 |
| 371 for (int i = 0; i < NUM_BIN_PRIORITIES; ++i) | 375 for (int i = 0; i < NUM_BIN_PRIORITIES; ++i) |
| 372 mts.bin[i] = bin_map[mts.bin[i]]; | 376 mts.bin[i] = bin_map[mts.bin[i]]; |
| 373 | 377 |
| 374 if (tile->priority(ACTIVE_TREE).is_live || | 378 if (tile->managed_state().resource || |
| 375 tile->priority(PENDING_TREE).is_live || | |
| 376 tile->managed_state().resource || | |
| 377 tile->managed_state().resource_is_being_initialized) { | 379 tile->managed_state().resource_is_being_initialized) { |
| 378 live_or_allocated_tiles_.push_back(tile); | 380 live_or_allocated_tiles_.push_back(tile); |
| 381 } else if (tile->priority(ACTIVE_TREE).is_live || | |
| 382 tile->priority(PENDING_TREE).is_live) { | |
| 383 if (use_cheapness_estimator_ || use_color_estimator_) | |
| 384 tile->picture_pile()->AnalyzeInRect(tile->content_rect(), | |
|
reveman
2013/02/28 21:23:10
I'm worried that this is too expensive to do for e
reveman
2013/02/28 21:54:28
I changed my mind after talking about this. If it'
| |
| 385 tile->contents_scale(), | |
| 386 &mts.picture_pile_analysis); | |
| 387 live_or_allocated_tiles_.push_back(tile); | |
| 379 } | 388 } |
| 380 } | 389 } |
| 381 TRACE_COUNTER_ID1("cc", "LiveOrAllocatedTileCount", this, | 390 TRACE_COUNTER_ID1("cc", "LiveOrAllocatedTileCount", this, |
| 382 live_or_allocated_tiles_.size()); | 391 live_or_allocated_tiles_.size()); |
| 383 | 392 |
| 384 SortTiles(); | 393 SortTiles(); |
| 385 | 394 |
| 386 // Assign gpu memory and determine what tiles need to be rasterized. | 395 // Assign gpu memory and determine what tiles need to be rasterized. |
| 387 AssignGpuMemoryToTiles(); | 396 AssignGpuMemoryToTiles(); |
| 388 | 397 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 // By clearing the tiles_that_need_to_be_rasterized_ vector and | 581 // By clearing the tiles_that_need_to_be_rasterized_ vector and |
| 573 // tiles_with_image_decoding_tasks_ list above we move all tiles | 582 // tiles_with_image_decoding_tasks_ list above we move all tiles |
| 574 // currently waiting for raster to idle state. | 583 // currently waiting for raster to idle state. |
| 575 // Call DidTileRasterStateChange() for each of these tiles to | 584 // Call DidTileRasterStateChange() for each of these tiles to |
| 576 // have this state change take effect. | 585 // have this state change take effect. |
| 577 // Some memory cannot be released. We figure out how much in this | 586 // Some memory cannot be released. We figure out how much in this |
| 578 // loop as well. | 587 // loop as well. |
| 579 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); | 588 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); |
| 580 it != live_or_allocated_tiles_.end(); ++it) { | 589 it != live_or_allocated_tiles_.end(); ++it) { |
| 581 Tile* tile = *it; | 590 Tile* tile = *it; |
| 582 if (!tile->managed_state().can_be_freed) | 591 if (tile->is_solid_color() || tile->is_transparent()) |
| 592 continue; | |
| 593 | |
| 594 ManagedTileState& managed_state = tile->managed_state(); | |
| 595 if (!managed_state.can_be_freed) | |
| 583 unreleasable_bytes += tile->bytes_consumed_if_allocated(); | 596 unreleasable_bytes += tile->bytes_consumed_if_allocated(); |
| 584 if (tile->managed_state().raster_state == WAITING_FOR_RASTER_STATE) | 597 if (managed_state.raster_state == WAITING_FOR_RASTER_STATE) |
| 585 DidTileRasterStateChange(tile, IDLE_STATE); | 598 DidTileRasterStateChange(tile, IDLE_STATE); |
| 586 } | 599 } |
| 587 | 600 |
| 588 size_t bytes_allocatable = global_state_.memory_limit_in_bytes - unreleasable_ bytes; | 601 size_t bytes_allocatable = global_state_.memory_limit_in_bytes - unreleasable_ bytes; |
| 589 size_t bytes_that_exceeded_memory_budget_in_now_bin = 0; | 602 size_t bytes_that_exceeded_memory_budget_in_now_bin = 0; |
| 590 size_t bytes_left = bytes_allocatable; | 603 size_t bytes_left = bytes_allocatable; |
| 591 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); it != live_or _allocated_tiles_.end(); ++it) { | 604 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); it != live_or _allocated_tiles_.end(); ++it) { |
| 592 Tile* tile = *it; | 605 Tile* tile = *it; |
| 606 if (tile->is_solid_color() || tile->is_transparent()) | |
| 607 continue; | |
| 608 | |
| 609 ManagedTileState& managed_state = tile->managed_state(); | |
| 593 size_t tile_bytes = tile->bytes_consumed_if_allocated(); | 610 size_t tile_bytes = tile->bytes_consumed_if_allocated(); |
| 594 ManagedTileState& managed_tile_state = tile->managed_state(); | 611 if (!managed_state.can_be_freed) |
| 595 if (!managed_tile_state.can_be_freed) | |
| 596 continue; | 612 continue; |
| 597 if (managed_tile_state.bin[HIGH_PRIORITY_BIN] == NEVER_BIN && | 613 if (managed_state.bin[HIGH_PRIORITY_BIN] == NEVER_BIN && |
| 598 managed_tile_state.bin[LOW_PRIORITY_BIN] == NEVER_BIN) { | 614 managed_state.bin[LOW_PRIORITY_BIN] == NEVER_BIN) { |
| 599 managed_tile_state.can_use_gpu_memory = false; | 615 managed_state.can_use_gpu_memory = false; |
| 600 FreeResourcesForTile(tile); | 616 FreeResourcesForTile(tile); |
| 601 continue; | 617 continue; |
| 602 } | 618 } |
| 603 if (tile_bytes > bytes_left) { | 619 if (tile_bytes > bytes_left) { |
| 604 managed_tile_state.can_use_gpu_memory = false; | 620 managed_state.can_use_gpu_memory = false; |
| 605 if (managed_tile_state.bin[HIGH_PRIORITY_BIN] == NOW_BIN || | 621 if (managed_state.bin[HIGH_PRIORITY_BIN] == NOW_BIN || |
| 606 managed_tile_state.bin[LOW_PRIORITY_BIN] == NOW_BIN) | 622 managed_state.bin[LOW_PRIORITY_BIN] == NOW_BIN) |
| 607 bytes_that_exceeded_memory_budget_in_now_bin += tile_bytes; | 623 bytes_that_exceeded_memory_budget_in_now_bin += tile_bytes; |
| 608 FreeResourcesForTile(tile); | 624 FreeResourcesForTile(tile); |
| 609 continue; | 625 continue; |
| 610 } | 626 } |
| 611 bytes_left -= tile_bytes; | 627 bytes_left -= tile_bytes; |
| 612 managed_tile_state.can_use_gpu_memory = true; | 628 managed_state.can_use_gpu_memory = true; |
| 613 if (!managed_tile_state.resource && | 629 if (!managed_state.resource && |
| 614 !managed_tile_state.resource_is_being_initialized) { | 630 !managed_state.resource_is_being_initialized) { |
| 615 tiles_that_need_to_be_rasterized_.push_back(tile); | 631 tiles_that_need_to_be_rasterized_.push_back(tile); |
| 616 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); | 632 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); |
| 617 } | 633 } |
| 618 } | 634 } |
| 619 | 635 |
| 620 ever_exceeded_memory_budget_ |= | 636 ever_exceeded_memory_budget_ |= |
| 621 bytes_that_exceeded_memory_budget_in_now_bin > 0; | 637 bytes_that_exceeded_memory_budget_in_now_bin > 0; |
| 622 if (ever_exceeded_memory_budget_) { | 638 if (ever_exceeded_memory_budget_) { |
| 623 TRACE_COUNTER_ID2("cc", "over_memory_budget", this, | 639 TRACE_COUNTER_ID2("cc", "over_memory_budget", this, |
| 624 "budget", global_state_.memory_limit_in_bytes, | 640 "budget", global_state_.memory_limit_in_bytes, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 return resource.Pass(); | 803 return resource.Pass(); |
| 788 } | 804 } |
| 789 | 805 |
| 790 void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { | 806 void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { |
| 791 TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask"); | 807 TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask"); |
| 792 scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile); | 808 scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile); |
| 793 ResourceProvider::ResourceId resource_id = resource->id(); | 809 ResourceProvider::ResourceId resource_id = resource->id(); |
| 794 uint8* buffer = | 810 uint8* buffer = |
| 795 resource_pool_->resource_provider()->mapPixelBuffer(resource_id); | 811 resource_pool_->resource_provider()->mapPixelBuffer(resource_id); |
| 796 | 812 |
| 797 bool is_cheap = use_cheapness_estimator_ && allow_cheap_tasks_ && | 813 ManagedTileState& managed_state = tile->managed_state(); |
| 798 tile->picture_pile()->IsCheapInRect(tile->content_rect_, | 814 bool is_cheap_to_raster = |
| 799 tile->contents_scale()); | 815 managed_state.picture_pile_analysis.is_cheap_to_raster(); |
| 800 raster_worker_pool_->PostRasterTaskAndReply( | 816 raster_worker_pool_->PostRasterTaskAndReply( |
| 801 tile->picture_pile(), | 817 tile->picture_pile(), |
| 802 is_cheap, | 818 allow_cheap_tasks_ && is_cheap_to_raster, |
| 803 base::Bind(&TileManager::RunRasterTask, | 819 base::Bind(&TileManager::RunRasterTask, |
| 804 buffer, | 820 buffer, |
| 805 tile->content_rect(), | 821 tile->content_rect(), |
| 806 tile->contents_scale(), | 822 tile->contents_scale(), |
| 807 GetRasterTaskMetadata(*tile)), | 823 GetRasterTaskMetadata(*tile)), |
| 808 base::Bind(&TileManager::OnRasterTaskCompleted, | 824 base::Bind(&TileManager::OnRasterTaskCompleted, |
| 809 base::Unretained(this), | 825 base::Unretained(this), |
| 810 tile, | 826 tile, |
| 811 base::Passed(&resource), | 827 base::Passed(&resource), |
| 812 manage_tiles_call_count_)); | 828 manage_tiles_call_count_)); |
| 813 did_schedule_cheap_tasks_ |= is_cheap; | 829 did_schedule_cheap_tasks_ |= (allow_cheap_tasks_ && is_cheap_to_raster); |
| 814 } | 830 } |
| 815 | 831 |
| 816 TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata( | 832 TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata( |
| 817 const Tile& tile) const { | 833 const Tile& tile) const { |
| 818 RasterTaskMetadata metadata; | 834 RasterTaskMetadata metadata; |
| 819 const ManagedTileState& mts = tile.managed_state(); | 835 const ManagedTileState& mts = tile.managed_state(); |
| 820 metadata.use_cheapness_estimator = use_cheapness_estimator_; | 836 metadata.prediction_benchmarking = prediction_benchmarking_; |
| 821 metadata.is_tile_in_pending_tree_now_bin = | 837 metadata.is_tile_in_pending_tree_now_bin = |
| 822 mts.tree_bin[PENDING_TREE] == NOW_BIN; | 838 mts.tree_bin[PENDING_TREE] == NOW_BIN; |
| 823 metadata.tile_resolution = mts.resolution; | 839 metadata.tile_resolution = mts.resolution; |
| 824 metadata.layer_id = tile.layer_id(); | 840 metadata.layer_id = tile.layer_id(); |
| 825 return metadata; | 841 return metadata; |
| 826 } | 842 } |
| 827 | 843 |
| 828 void TileManager::OnRasterTaskCompleted( | 844 void TileManager::OnRasterTaskCompleted( |
| 829 scoped_refptr<Tile> tile, | 845 scoped_refptr<Tile> tile, |
| 830 scoped_ptr<ResourcePool::Resource> resource, | 846 scoped_ptr<ResourcePool::Resource> resource, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 935 SkDevice device(bitmap); | 951 SkDevice device(bitmap); |
| 936 SkCanvas canvas(&device); | 952 SkCanvas canvas(&device); |
| 937 | 953 |
| 938 base::TimeTicks begin_time; | 954 base::TimeTicks begin_time; |
| 939 if (stats) | 955 if (stats) |
| 940 begin_time = base::TimeTicks::HighResNow(); | 956 begin_time = base::TimeTicks::HighResNow(); |
| 941 | 957 |
| 942 int64 total_pixels_rasterized = 0; | 958 int64 total_pixels_rasterized = 0; |
| 943 picture_pile->Raster(&canvas, rect, contents_scale, | 959 picture_pile->Raster(&canvas, rect, contents_scale, |
| 944 &total_pixels_rasterized); | 960 &total_pixels_rasterized); |
| 945 | |
| 946 if (stats) { | 961 if (stats) { |
| 947 stats->totalPixelsRasterized += total_pixels_rasterized; | 962 stats->totalPixelsRasterized += total_pixels_rasterized; |
| 948 | 963 |
| 949 base::TimeTicks end_time = base::TimeTicks::HighResNow(); | 964 base::TimeTicks end_time = base::TimeTicks::HighResNow(); |
| 950 base::TimeDelta duration = end_time - begin_time; | 965 base::TimeDelta duration = end_time - begin_time; |
| 951 stats->totalRasterizeTime += duration; | 966 stats->totalRasterizeTime += duration; |
| 952 if (metadata.is_tile_in_pending_tree_now_bin) | 967 if (metadata.is_tile_in_pending_tree_now_bin) |
| 953 stats->totalRasterizeTimeForNowBinsOnPendingTree += duration; | 968 stats->totalRasterizeTimeForNowBinsOnPendingTree += duration; |
| 954 | 969 |
| 955 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeMS", | 970 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeMS", |
| 956 duration.InMilliseconds(), | 971 duration.InMilliseconds(), |
| 957 0, | 972 0, |
| 958 10, | 973 10, |
| 959 10); | 974 10); |
| 960 | 975 |
| 961 if (metadata.use_cheapness_estimator) { | 976 if (metadata.prediction_benchmarking) { |
| 962 bool is_predicted_cheap = | 977 PicturePileImpl::Analysis analysis; |
| 963 picture_pile->IsCheapInRect(rect, contents_scale); | 978 picture_pile->AnalyzeInRect(rect, contents_scale, &analysis); |
| 979 bool is_predicted_cheap = analysis.is_cheap_to_raster(); | |
| 964 bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f; | 980 bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f; |
| 965 RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap); | 981 RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap); |
| 982 | |
| 983 SkColor solid_color; | |
| 984 bool is_predicted_solid = analysis.is_solid_color(); | |
| 985 if (is_predicted_solid) | |
| 986 solid_color = analysis.get_solid_color(); | |
| 987 bool is_predicted_transparent = analysis.is_transparent(); | |
| 988 | |
| 989 RecordSolidColorPredictorResults( | |
| 990 reinterpret_cast<SkColor*>(bitmap.getPixels()), | |
| 991 bitmap.getSize() / bitmap.bytesPerPixel(), | |
| 992 is_predicted_solid, | |
| 993 solid_color, | |
| 994 is_predicted_transparent); | |
| 966 } | 995 } |
| 967 } | 996 } |
| 968 } | 997 } |
| 969 | 998 |
| 970 // static | 999 // static |
| 971 void TileManager::RecordCheapnessPredictorResults(bool is_predicted_cheap, | 1000 void TileManager::RecordCheapnessPredictorResults(bool is_predicted_cheap, |
| 972 bool is_actually_cheap) { | 1001 bool is_actually_cheap) { |
| 973 if (is_predicted_cheap && !is_actually_cheap) | 1002 if (is_predicted_cheap && !is_actually_cheap) |
| 974 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorBadlyWrong", true); | 1003 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorBadlyWrong", true); |
| 975 else if (!is_predicted_cheap && is_actually_cheap) | 1004 else if (!is_predicted_cheap && is_actually_cheap) |
| 976 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorSafelyWrong", true); | 1005 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorSafelyWrong", true); |
| 977 | 1006 |
| 978 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorAccuracy", | 1007 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorAccuracy", |
| 979 is_predicted_cheap == is_actually_cheap); | 1008 is_predicted_cheap == is_actually_cheap); |
| 980 } | 1009 } |
| 981 | 1010 |
| 982 // static | 1011 // static |
| 1012 void TileManager::RecordSolidColorPredictorResults( | |
| 1013 const SkColor* actual_colors, | |
| 1014 size_t color_count, | |
| 1015 bool is_predicted_solid, | |
| 1016 SkColor predicted_color, | |
| 1017 bool is_predicted_transparent) { | |
| 1018 DCHECK_GT(color_count, 0); | |
| 1019 | |
| 1020 bool is_actually_solid = true; | |
| 1021 bool is_transparent = true; | |
| 1022 | |
| 1023 SkColor actual_color = *actual_colors; | |
| 1024 for (int i = 0; i < color_count; ++i) { | |
| 1025 SkColor current_color = actual_colors[i]; | |
| 1026 if (current_color != actual_color || | |
| 1027 SkColorGetA(current_color) != 255) | |
| 1028 is_actually_solid = false; | |
| 1029 | |
| 1030 if (SkColorGetA(current_color) != 0) | |
| 1031 is_transparent = false; | |
| 1032 } | |
| 1033 | |
| 1034 if (is_predicted_solid && !is_actually_solid) | |
| 1035 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualNotSolid", true); | |
| 1036 else if (is_predicted_solid && | |
| 1037 is_actually_solid && | |
| 1038 predicted_color != actual_color) | |
| 1039 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongColor", true); | |
| 1040 else if (!is_predicted_solid && is_actually_solid) | |
| 1041 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualSolid", true); | |
| 1042 | |
| 1043 bool correct_guess = (is_predicted_solid && is_actually_solid && | |
| 1044 predicted_color == actual_color) || | |
| 1045 (!is_predicted_solid && !is_actually_solid); | |
| 1046 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.Accuracy", correct_guess); | |
| 1047 | |
| 1048 if (correct_guess) | |
| 1049 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsCorrectSolid", | |
| 1050 is_predicted_solid); | |
| 1051 | |
| 1052 if (is_predicted_transparent) | |
| 1053 UMA_HISTOGRAM_BOOLEAN( | |
| 1054 "Renderer4.ColorPredictor.PredictedTransparentIsActually", | |
| 1055 is_transparent); | |
| 1056 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsActuallyTransparent", | |
| 1057 is_transparent); | |
| 1058 } | |
| 1059 | |
| 1060 // static | |
| 983 void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, | 1061 void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, |
| 984 RenderingStats* stats) { | 1062 RenderingStats* stats) { |
| 985 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); | 1063 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
| 986 base::TimeTicks decode_begin_time; | 1064 base::TimeTicks decode_begin_time; |
| 987 if (stats) | 1065 if (stats) |
| 988 decode_begin_time = base::TimeTicks::HighResNow(); | 1066 decode_begin_time = base::TimeTicks::HighResNow(); |
| 989 pixel_ref->Decode(); | 1067 pixel_ref->Decode(); |
| 990 if (stats) { | 1068 if (stats) { |
| 991 stats->totalDeferredImageDecodeCount++; | 1069 stats->totalDeferredImageDecodeCount++; |
| 992 stats->totalDeferredImageDecodeTime += | 1070 stats->totalDeferredImageDecodeTime += |
| 993 base::TimeTicks::HighResNow() - decode_begin_time; | 1071 base::TimeTicks::HighResNow() - decode_begin_time; |
| 994 } | 1072 } |
| 995 } | 1073 } |
| 996 | 1074 |
| 997 } // namespace cc | 1075 } // namespace cc |
| OLD | NEW |