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/tiles/tile_manager.h" | 5 #include "cc/tiles/tile_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 reply_(reply) {} | 74 reply_(reply) {} |
| 75 | 75 |
| 76 // Overridden from Task: | 76 // Overridden from Task: |
| 77 void RunOnWorkerThread() override { | 77 void RunOnWorkerThread() override { |
| 78 TRACE_EVENT1("cc", "RasterizerTaskImpl::RunOnWorkerThread", | 78 TRACE_EVENT1("cc", "RasterizerTaskImpl::RunOnWorkerThread", |
| 79 "source_prepare_tiles_id", source_prepare_tiles_id_); | 79 "source_prepare_tiles_id", source_prepare_tiles_id_); |
| 80 | 80 |
| 81 DCHECK(raster_source_.get()); | 81 DCHECK(raster_source_.get()); |
| 82 DCHECK(raster_buffer_); | 82 DCHECK(raster_buffer_); |
| 83 | 83 |
| 84 if (analyze_picture_) { | |
| 85 Analyze(raster_source_.get()); | |
| 86 if (analysis_.is_solid_color) | |
| 87 return; | |
| 88 } | |
| 89 | |
| 90 Raster(raster_source_.get()); | 84 Raster(raster_source_.get()); |
| 91 } | 85 } |
| 92 | 86 |
| 93 // Overridden from TileTask: | 87 // Overridden from TileTask: |
| 94 void ScheduleOnOriginThread(TileTaskClient* client) override { | 88 void ScheduleOnOriginThread(TileTaskClient* client) override { |
| 95 DCHECK(!raster_buffer_); | 89 DCHECK(!raster_buffer_); |
| 96 raster_buffer_ = client->AcquireBufferForRaster( | 90 raster_buffer_ = client->AcquireBufferForRaster( |
| 97 resource_, resource_content_id_, previous_content_id_); | 91 resource_, resource_content_id_, previous_content_id_); |
| 98 } | 92 } |
| 99 void CompleteOnOriginThread(TileTaskClient* client) override { | 93 void CompleteOnOriginThread(TileTaskClient* client) override { |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 715 CreateTaskSetFinishedTask(&TileManager::DidFinishRunningAllTileTasks); | 709 CreateTaskSetFinishedTask(&TileManager::DidFinishRunningAllTileTasks); |
| 716 | 710 |
| 717 // Build a new task queue containing all task currently needed. Tasks | 711 // Build a new task queue containing all task currently needed. Tasks |
| 718 // are added in order of priority, highest priority task first. | 712 // are added in order of priority, highest priority task first. |
| 719 for (auto& prioritized_tile : tiles_that_need_to_be_rasterized) { | 713 for (auto& prioritized_tile : tiles_that_need_to_be_rasterized) { |
| 720 Tile* tile = prioritized_tile.tile(); | 714 Tile* tile = prioritized_tile.tile(); |
| 721 | 715 |
| 722 DCHECK(tile->draw_info().requires_resource()); | 716 DCHECK(tile->draw_info().requires_resource()); |
| 723 DCHECK(!tile->draw_info().resource_); | 717 DCHECK(!tile->draw_info().resource_); |
| 724 | 718 |
| 719 SkColor color = SK_ColorTRANSPARENT; | |
| 720 bool is_solid_color = prioritized_tile.raster_source()->IsSolidColorTile( | |
|
vmpstr
2015/12/17 18:55:47
This is an OK spot to do this. When I was thinking
sohanjg
2015/12/18 12:50:00
Done.
| |
| 721 tile->content_rect(), tile->contents_scale(), &color); | |
| 722 if (is_solid_color) { | |
| 723 tile->draw_info().set_solid_color(color); | |
| 724 continue; | |
| 725 } | |
| 726 | |
| 725 if (!tile->raster_task_) { | 727 if (!tile->raster_task_) { |
| 726 tile->raster_task_ = CreateRasterTask(prioritized_tile); | 728 tile->raster_task_ = CreateRasterTask(prioritized_tile); |
| 727 } | 729 } |
| 728 | 730 |
| 729 RasterTask* task = tile->raster_task_.get(); | 731 RasterTask* task = tile->raster_task_.get(); |
| 730 DCHECK(!task->HasCompleted()); | 732 DCHECK(!task->HasCompleted()); |
| 731 | 733 |
| 732 if (!tile->raster_task_.get()) | 734 if (!tile->raster_task_.get()) |
| 733 tile->raster_task_ = CreateRasterTask(prioritized_tile); | 735 tile->raster_task_ = CreateRasterTask(prioritized_tile); |
| 734 | 736 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 851 } | 853 } |
| 852 | 854 |
| 853 void TileManager::UpdateTileDrawInfo( | 855 void TileManager::UpdateTileDrawInfo( |
| 854 Tile* tile, | 856 Tile* tile, |
| 855 Resource* resource, | 857 Resource* resource, |
| 856 const DisplayListRasterSource::SolidColorAnalysis& analysis) { | 858 const DisplayListRasterSource::SolidColorAnalysis& analysis) { |
| 857 TileDrawInfo& draw_info = tile->draw_info(); | 859 TileDrawInfo& draw_info = tile->draw_info(); |
| 858 | 860 |
| 859 ++flush_stats_.completed_count; | 861 ++flush_stats_.completed_count; |
| 860 | 862 |
| 861 if (analysis.is_solid_color) { | 863 if (draw_info.mode() == TileDrawInfo::SOLID_COLOR_MODE) { |
|
vmpstr
2015/12/17 18:55:47
This shouldn't be possible anymore, right? UpdateT
sohanjg
2015/12/18 12:50:00
Acknowledged.
| |
| 862 draw_info.set_solid_color(analysis.solid_color); | |
| 863 if (resource) { | 864 if (resource) { |
| 864 // TODO(ericrk): If more partial raster work is done in the future, it may | 865 // TODO(ericrk): If more partial raster work is done in the future, it may |
| 865 // be worth returning the resource to the pool with its previous ID (not | 866 // be worth returning the resource to the pool with its previous ID (not |
| 866 // currently tracked). crrev.com/1370333002/#ps40001 has a possible method | 867 // currently tracked). crrev.com/1370333002/#ps40001 has a possible method |
| 867 // of achieving this. | 868 // of achieving this. |
| 868 resource_pool_->ReleaseResource(resource, 0 /* content_id */); | 869 resource_pool_->ReleaseResource(resource, 0 /* content_id */); |
| 869 } | 870 } |
| 870 } else { | 871 } else { |
| 871 DCHECK(resource); | 872 DCHECK(resource); |
| 872 draw_info.set_use_resource(); | 873 draw_info.set_use_resource(); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1164 void TileManager::Signals::reset() { | 1165 void TileManager::Signals::reset() { |
| 1165 ready_to_activate = false; | 1166 ready_to_activate = false; |
| 1166 did_notify_ready_to_activate = false; | 1167 did_notify_ready_to_activate = false; |
| 1167 ready_to_draw = false; | 1168 ready_to_draw = false; |
| 1168 did_notify_ready_to_draw = false; | 1169 did_notify_ready_to_draw = false; |
| 1169 all_tile_tasks_completed = false; | 1170 all_tile_tasks_completed = false; |
| 1170 did_notify_all_tile_tasks_completed = false; | 1171 did_notify_all_tile_tasks_completed = false; |
| 1171 } | 1172 } |
| 1172 | 1173 |
| 1173 } // namespace cc | 1174 } // namespace cc |
| OLD | NEW |