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) { |
|
reveman
2013/02/28 23:17:53
lets keep this a bit cleaner by just adding the An
| |
| 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_ || | |
| 384 use_color_estimator_) && | |
| 385 !mts.picture_pile_analyzed) { | |
| 386 tile->picture_pile()->AnalyzeInRect(tile->content_rect(), | |
| 387 tile->contents_scale(), | |
| 388 &mts.picture_pile_analysis); | |
| 389 mts.picture_pile_analyzed = true; | |
| 390 } | |
| 391 live_or_allocated_tiles_.push_back(tile); | |
| 379 } | 392 } |
| 380 } | 393 } |
| 381 TRACE_COUNTER_ID1("cc", "LiveOrAllocatedTileCount", this, | 394 TRACE_COUNTER_ID1("cc", "LiveOrAllocatedTileCount", this, |
| 382 live_or_allocated_tiles_.size()); | 395 live_or_allocated_tiles_.size()); |
| 383 | 396 |
| 384 SortTiles(); | 397 SortTiles(); |
| 385 | 398 |
| 386 // Assign gpu memory and determine what tiles need to be rasterized. | 399 // Assign gpu memory and determine what tiles need to be rasterized. |
| 387 AssignGpuMemoryToTiles(); | 400 AssignGpuMemoryToTiles(); |
| 388 | 401 |
| (...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 | 585 // By clearing the tiles_that_need_to_be_rasterized_ vector and |
| 573 // tiles_with_image_decoding_tasks_ list above we move all tiles | 586 // tiles_with_image_decoding_tasks_ list above we move all tiles |
| 574 // currently waiting for raster to idle state. | 587 // currently waiting for raster to idle state. |
| 575 // Call DidTileRasterStateChange() for each of these tiles to | 588 // Call DidTileRasterStateChange() for each of these tiles to |
| 576 // have this state change take effect. | 589 // have this state change take effect. |
| 577 // Some memory cannot be released. We figure out how much in this | 590 // Some memory cannot be released. We figure out how much in this |
| 578 // loop as well. | 591 // loop as well. |
| 579 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); | 592 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); |
| 580 it != live_or_allocated_tiles_.end(); ++it) { | 593 it != live_or_allocated_tiles_.end(); ++it) { |
| 581 Tile* tile = *it; | 594 Tile* tile = *it; |
| 582 if (!tile->managed_state().can_be_freed) | 595 if (tile->is_solid_color() || tile->is_transparent()) |
| 596 continue; | |
| 597 | |
| 598 ManagedTileState& managed_state = tile->managed_state(); | |
| 599 if (!managed_state.can_be_freed) | |
| 583 unreleasable_bytes += tile->bytes_consumed_if_allocated(); | 600 unreleasable_bytes += tile->bytes_consumed_if_allocated(); |
| 584 if (tile->managed_state().raster_state == WAITING_FOR_RASTER_STATE) | 601 if (managed_state.raster_state == WAITING_FOR_RASTER_STATE) |
| 585 DidTileRasterStateChange(tile, IDLE_STATE); | 602 DidTileRasterStateChange(tile, IDLE_STATE); |
| 586 } | 603 } |
| 587 | 604 |
| 588 size_t bytes_allocatable = global_state_.memory_limit_in_bytes - unreleasable_ bytes; | 605 size_t bytes_allocatable = global_state_.memory_limit_in_bytes - unreleasable_ bytes; |
| 589 size_t bytes_that_exceeded_memory_budget_in_now_bin = 0; | 606 size_t bytes_that_exceeded_memory_budget_in_now_bin = 0; |
| 590 size_t bytes_left = bytes_allocatable; | 607 size_t bytes_left = bytes_allocatable; |
| 591 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); it != live_or _allocated_tiles_.end(); ++it) { | 608 for (TileVector::iterator it = live_or_allocated_tiles_.begin(); it != live_or _allocated_tiles_.end(); ++it) { |
| 592 Tile* tile = *it; | 609 Tile* tile = *it; |
| 610 if (tile->is_solid_color() || tile->is_transparent()) | |
| 611 continue; | |
| 612 | |
| 613 ManagedTileState& managed_state = tile->managed_state(); | |
| 593 size_t tile_bytes = tile->bytes_consumed_if_allocated(); | 614 size_t tile_bytes = tile->bytes_consumed_if_allocated(); |
| 594 ManagedTileState& managed_tile_state = tile->managed_state(); | 615 if (!managed_state.can_be_freed) |
| 595 if (!managed_tile_state.can_be_freed) | |
| 596 continue; | 616 continue; |
| 597 if (managed_tile_state.bin[HIGH_PRIORITY_BIN] == NEVER_BIN && | 617 if (managed_state.bin[HIGH_PRIORITY_BIN] == NEVER_BIN && |
| 598 managed_tile_state.bin[LOW_PRIORITY_BIN] == NEVER_BIN) { | 618 managed_state.bin[LOW_PRIORITY_BIN] == NEVER_BIN) { |
| 599 managed_tile_state.can_use_gpu_memory = false; | 619 managed_state.can_use_gpu_memory = false; |
| 600 FreeResourcesForTile(tile); | 620 FreeResourcesForTile(tile); |
| 601 continue; | 621 continue; |
| 602 } | 622 } |
| 603 if (tile_bytes > bytes_left) { | 623 if (tile_bytes > bytes_left) { |
| 604 managed_tile_state.can_use_gpu_memory = false; | 624 managed_state.can_use_gpu_memory = false; |
| 605 if (managed_tile_state.bin[HIGH_PRIORITY_BIN] == NOW_BIN || | 625 if (managed_state.bin[HIGH_PRIORITY_BIN] == NOW_BIN || |
| 606 managed_tile_state.bin[LOW_PRIORITY_BIN] == NOW_BIN) | 626 managed_state.bin[LOW_PRIORITY_BIN] == NOW_BIN) |
| 607 bytes_that_exceeded_memory_budget_in_now_bin += tile_bytes; | 627 bytes_that_exceeded_memory_budget_in_now_bin += tile_bytes; |
| 608 FreeResourcesForTile(tile); | 628 FreeResourcesForTile(tile); |
| 609 continue; | 629 continue; |
| 610 } | 630 } |
| 611 bytes_left -= tile_bytes; | 631 bytes_left -= tile_bytes; |
| 612 managed_tile_state.can_use_gpu_memory = true; | 632 managed_state.can_use_gpu_memory = true; |
| 613 if (!managed_tile_state.resource && | 633 if (!managed_state.resource && |
| 614 !managed_tile_state.resource_is_being_initialized) { | 634 !managed_state.resource_is_being_initialized) { |
| 615 tiles_that_need_to_be_rasterized_.push_back(tile); | 635 tiles_that_need_to_be_rasterized_.push_back(tile); |
| 616 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); | 636 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); |
| 617 } | 637 } |
| 618 } | 638 } |
| 619 | 639 |
| 620 ever_exceeded_memory_budget_ |= | 640 ever_exceeded_memory_budget_ |= |
| 621 bytes_that_exceeded_memory_budget_in_now_bin > 0; | 641 bytes_that_exceeded_memory_budget_in_now_bin > 0; |
| 622 if (ever_exceeded_memory_budget_) { | 642 if (ever_exceeded_memory_budget_) { |
| 623 TRACE_COUNTER_ID2("cc", "over_memory_budget", this, | 643 TRACE_COUNTER_ID2("cc", "over_memory_budget", this, |
| 624 "budget", global_state_.memory_limit_in_bytes, | 644 "budget", global_state_.memory_limit_in_bytes, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 return resource.Pass(); | 807 return resource.Pass(); |
| 788 } | 808 } |
| 789 | 809 |
| 790 void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { | 810 void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { |
| 791 TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask"); | 811 TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask"); |
| 792 scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile); | 812 scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile); |
| 793 ResourceProvider::ResourceId resource_id = resource->id(); | 813 ResourceProvider::ResourceId resource_id = resource->id(); |
| 794 uint8* buffer = | 814 uint8* buffer = |
| 795 resource_pool_->resource_provider()->mapPixelBuffer(resource_id); | 815 resource_pool_->resource_provider()->mapPixelBuffer(resource_id); |
| 796 | 816 |
| 797 bool is_cheap = use_cheapness_estimator_ && allow_cheap_tasks_ && | 817 ManagedTileState& managed_state = tile->managed_state(); |
| 798 tile->picture_pile()->IsCheapInRect(tile->content_rect_, | 818 bool is_cheap_to_raster = |
| 799 tile->contents_scale()); | 819 managed_state.picture_pile_analysis.is_cheap_to_raster; |
| 800 raster_worker_pool_->PostRasterTaskAndReply( | 820 raster_worker_pool_->PostRasterTaskAndReply( |
| 801 tile->picture_pile(), | 821 tile->picture_pile(), |
| 802 is_cheap, | 822 allow_cheap_tasks_ && is_cheap_to_raster, |
| 803 base::Bind(&TileManager::RunRasterTask, | 823 base::Bind(&TileManager::RunRasterTask, |
| 804 buffer, | 824 buffer, |
| 805 tile->content_rect(), | 825 tile->content_rect(), |
| 806 tile->contents_scale(), | 826 tile->contents_scale(), |
| 807 GetRasterTaskMetadata(*tile)), | 827 GetRasterTaskMetadata(*tile)), |
| 808 base::Bind(&TileManager::OnRasterTaskCompleted, | 828 base::Bind(&TileManager::OnRasterTaskCompleted, |
| 809 base::Unretained(this), | 829 base::Unretained(this), |
| 810 tile, | 830 tile, |
| 811 base::Passed(&resource), | 831 base::Passed(&resource), |
| 812 manage_tiles_call_count_)); | 832 manage_tiles_call_count_)); |
| 813 did_schedule_cheap_tasks_ |= is_cheap; | 833 did_schedule_cheap_tasks_ |= (allow_cheap_tasks_ && is_cheap_to_raster); |
| 814 } | 834 } |
| 815 | 835 |
| 816 TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata( | 836 TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata( |
| 817 const Tile& tile) const { | 837 const Tile& tile) const { |
| 818 RasterTaskMetadata metadata; | 838 RasterTaskMetadata metadata; |
| 819 const ManagedTileState& mts = tile.managed_state(); | 839 const ManagedTileState& mts = tile.managed_state(); |
| 820 metadata.use_cheapness_estimator = use_cheapness_estimator_; | 840 metadata.prediction_benchmarking = prediction_benchmarking_; |
| 821 metadata.is_tile_in_pending_tree_now_bin = | 841 metadata.is_tile_in_pending_tree_now_bin = |
| 822 mts.tree_bin[PENDING_TREE] == NOW_BIN; | 842 mts.tree_bin[PENDING_TREE] == NOW_BIN; |
| 823 metadata.tile_resolution = mts.resolution; | 843 metadata.tile_resolution = mts.resolution; |
| 824 metadata.layer_id = tile.layer_id(); | 844 metadata.layer_id = tile.layer_id(); |
| 825 return metadata; | 845 return metadata; |
| 826 } | 846 } |
| 827 | 847 |
| 828 void TileManager::OnRasterTaskCompleted( | 848 void TileManager::OnRasterTaskCompleted( |
| 829 scoped_refptr<Tile> tile, | 849 scoped_refptr<Tile> tile, |
| 830 scoped_ptr<ResourcePool::Resource> resource, | 850 scoped_ptr<ResourcePool::Resource> resource, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 935 SkDevice device(bitmap); | 955 SkDevice device(bitmap); |
| 936 SkCanvas canvas(&device); | 956 SkCanvas canvas(&device); |
| 937 | 957 |
| 938 base::TimeTicks begin_time; | 958 base::TimeTicks begin_time; |
| 939 if (stats) | 959 if (stats) |
| 940 begin_time = base::TimeTicks::HighResNow(); | 960 begin_time = base::TimeTicks::HighResNow(); |
| 941 | 961 |
| 942 int64 total_pixels_rasterized = 0; | 962 int64 total_pixels_rasterized = 0; |
| 943 picture_pile->Raster(&canvas, rect, contents_scale, | 963 picture_pile->Raster(&canvas, rect, contents_scale, |
| 944 &total_pixels_rasterized); | 964 &total_pixels_rasterized); |
| 945 | |
|
reveman
2013/02/28 23:17:53
nit: no need to remove this line.
| |
| 946 if (stats) { | 965 if (stats) { |
| 947 stats->totalPixelsRasterized += total_pixels_rasterized; | 966 stats->totalPixelsRasterized += total_pixels_rasterized; |
| 948 | 967 |
| 949 base::TimeTicks end_time = base::TimeTicks::HighResNow(); | 968 base::TimeTicks end_time = base::TimeTicks::HighResNow(); |
| 950 base::TimeDelta duration = end_time - begin_time; | 969 base::TimeDelta duration = end_time - begin_time; |
| 951 stats->totalRasterizeTime += duration; | 970 stats->totalRasterizeTime += duration; |
| 952 if (metadata.is_tile_in_pending_tree_now_bin) | 971 if (metadata.is_tile_in_pending_tree_now_bin) |
| 953 stats->totalRasterizeTimeForNowBinsOnPendingTree += duration; | 972 stats->totalRasterizeTimeForNowBinsOnPendingTree += duration; |
| 954 | 973 |
| 955 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeMS", | 974 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.PictureRasterTimeMS", |
| 956 duration.InMilliseconds(), | 975 duration.InMilliseconds(), |
| 957 0, | 976 0, |
| 958 10, | 977 10, |
| 959 10); | 978 10); |
| 960 | 979 |
| 961 if (metadata.use_cheapness_estimator) { | 980 if (metadata.prediction_benchmarking) { |
| 962 bool is_predicted_cheap = | 981 Picture::Analysis analysis; |
| 963 picture_pile->IsCheapInRect(rect, contents_scale); | 982 picture_pile->AnalyzeInRect(rect, contents_scale, &analysis); |
| 983 bool is_predicted_cheap = analysis.is_cheap_to_raster; | |
| 964 bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f; | 984 bool is_actually_cheap = duration.InMillisecondsF() <= 1.0f; |
| 965 RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap); | 985 RecordCheapnessPredictorResults(is_predicted_cheap, is_actually_cheap); |
| 986 | |
| 987 RecordSolidColorPredictorResults( | |
| 988 reinterpret_cast<SkColor*>(bitmap.getPixels()), | |
| 989 bitmap.getSize() / bitmap.bytesPerPixel(), | |
| 990 analysis.is_solid_color, | |
| 991 analysis.solid_color, | |
| 992 analysis.is_transparent); | |
| 966 } | 993 } |
| 967 } | 994 } |
| 968 } | 995 } |
| 969 | 996 |
| 970 // static | 997 // static |
| 971 void TileManager::RecordCheapnessPredictorResults(bool is_predicted_cheap, | 998 void TileManager::RecordCheapnessPredictorResults(bool is_predicted_cheap, |
| 972 bool is_actually_cheap) { | 999 bool is_actually_cheap) { |
| 973 if (is_predicted_cheap && !is_actually_cheap) | 1000 if (is_predicted_cheap && !is_actually_cheap) |
| 974 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorBadlyWrong", true); | 1001 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorBadlyWrong", true); |
| 975 else if (!is_predicted_cheap && is_actually_cheap) | 1002 else if (!is_predicted_cheap && is_actually_cheap) |
| 976 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorSafelyWrong", true); | 1003 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorSafelyWrong", true); |
| 977 | 1004 |
| 978 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorAccuracy", | 1005 UMA_HISTOGRAM_BOOLEAN("Renderer4.CheapPredictorAccuracy", |
| 979 is_predicted_cheap == is_actually_cheap); | 1006 is_predicted_cheap == is_actually_cheap); |
| 980 } | 1007 } |
| 981 | 1008 |
| 982 // static | 1009 // static |
| 1010 void TileManager::RecordSolidColorPredictorResults( | |
| 1011 const SkColor* actual_colors, | |
| 1012 size_t color_count, | |
| 1013 bool is_predicted_solid, | |
| 1014 SkColor predicted_color, | |
| 1015 bool is_predicted_transparent) { | |
| 1016 DCHECK_GT(color_count, 0); | |
| 1017 | |
| 1018 bool is_actually_solid = true; | |
| 1019 bool is_transparent = true; | |
| 1020 | |
| 1021 SkColor actual_color = *actual_colors; | |
| 1022 for (int i = 0; i < color_count; ++i) { | |
| 1023 SkColor current_color = actual_colors[i]; | |
| 1024 if (current_color != actual_color || | |
| 1025 SkColorGetA(current_color) != 255) | |
| 1026 is_actually_solid = false; | |
| 1027 | |
| 1028 if (SkColorGetA(current_color) != 0) | |
| 1029 is_transparent = false; | |
| 1030 } | |
| 1031 | |
| 1032 if (is_predicted_solid && !is_actually_solid) | |
| 1033 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualNotSolid", true); | |
| 1034 else if (is_predicted_solid && | |
| 1035 is_actually_solid && | |
| 1036 predicted_color != actual_color) | |
| 1037 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongColor", true); | |
| 1038 else if (!is_predicted_solid && is_actually_solid) | |
| 1039 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.WrongActualSolid", true); | |
| 1040 | |
| 1041 bool correct_guess = (is_predicted_solid && is_actually_solid && | |
| 1042 predicted_color == actual_color) || | |
| 1043 (!is_predicted_solid && !is_actually_solid); | |
| 1044 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.Accuracy", correct_guess); | |
| 1045 | |
| 1046 if (correct_guess) | |
| 1047 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsCorrectSolid", | |
| 1048 is_predicted_solid); | |
| 1049 | |
| 1050 if (is_predicted_transparent) | |
| 1051 UMA_HISTOGRAM_BOOLEAN( | |
| 1052 "Renderer4.ColorPredictor.PredictedTransparentIsActually", | |
| 1053 is_transparent); | |
| 1054 UMA_HISTOGRAM_BOOLEAN("Renderer4.ColorPredictor.IsActuallyTransparent", | |
| 1055 is_transparent); | |
| 1056 } | |
| 1057 | |
| 1058 // static | |
| 983 void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, | 1059 void TileManager::RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, |
| 984 RenderingStats* stats) { | 1060 RenderingStats* stats) { |
| 985 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); | 1061 TRACE_EVENT0("cc", "TileManager::RunImageDecodeTask"); |
| 986 base::TimeTicks decode_begin_time; | 1062 base::TimeTicks decode_begin_time; |
| 987 if (stats) | 1063 if (stats) |
| 988 decode_begin_time = base::TimeTicks::HighResNow(); | 1064 decode_begin_time = base::TimeTicks::HighResNow(); |
| 989 pixel_ref->Decode(); | 1065 pixel_ref->Decode(); |
| 990 if (stats) { | 1066 if (stats) { |
| 991 stats->totalDeferredImageDecodeCount++; | 1067 stats->totalDeferredImageDecodeCount++; |
| 992 stats->totalDeferredImageDecodeTime += | 1068 stats->totalDeferredImageDecodeTime += |
| 993 base::TimeTicks::HighResNow() - decode_begin_time; | 1069 base::TimeTicks::HighResNow() - decode_begin_time; |
| 994 } | 1070 } |
| 995 } | 1071 } |
| 996 | 1072 |
| 997 } // namespace cc | 1073 } // namespace cc |
| OLD | NEW |