| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 base::saturated_cast<int>(stats.completed_count)); | 180 base::saturated_cast<int>(stats.completed_count)); |
| 181 state->SetInteger("canceled_count", | 181 state->SetInteger("canceled_count", |
| 182 base::saturated_cast<int>(stats.canceled_count)); | 182 base::saturated_cast<int>(stats.canceled_count)); |
| 183 return state; | 183 return state; |
| 184 } | 184 } |
| 185 | 185 |
| 186 // static | 186 // static |
| 187 scoped_ptr<TileManager> TileManager::Create( | 187 scoped_ptr<TileManager> TileManager::Create( |
| 188 TileManagerClient* client, | 188 TileManagerClient* client, |
| 189 base::SequencedTaskRunner* task_runner, | 189 base::SequencedTaskRunner* task_runner, |
| 190 size_t scheduled_raster_task_limit) { | 190 size_t scheduled_raster_task_limit, |
| 191 return make_scoped_ptr( | 191 bool use_partial_raster) { |
| 192 new TileManager(client, task_runner, scheduled_raster_task_limit)); | 192 return make_scoped_ptr(new TileManager( |
| 193 client, task_runner, scheduled_raster_task_limit, use_partial_raster)); |
| 193 } | 194 } |
| 194 | 195 |
| 195 TileManager::TileManager( | 196 TileManager::TileManager( |
| 196 TileManagerClient* client, | 197 TileManagerClient* client, |
| 197 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 198 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 198 size_t scheduled_raster_task_limit) | 199 size_t scheduled_raster_task_limit, |
| 200 bool use_partial_raster) |
| 199 : client_(client), | 201 : client_(client), |
| 200 task_runner_(task_runner), | 202 task_runner_(task_runner), |
| 201 resource_pool_(nullptr), | 203 resource_pool_(nullptr), |
| 202 tile_task_runner_(nullptr), | 204 tile_task_runner_(nullptr), |
| 203 scheduled_raster_task_limit_(scheduled_raster_task_limit), | 205 scheduled_raster_task_limit_(scheduled_raster_task_limit), |
| 206 use_partial_raster_(use_partial_raster), |
| 204 all_tiles_that_need_to_be_rasterized_are_scheduled_(true), | 207 all_tiles_that_need_to_be_rasterized_are_scheduled_(true), |
| 205 did_check_for_completed_tasks_since_last_schedule_tasks_(true), | 208 did_check_for_completed_tasks_since_last_schedule_tasks_(true), |
| 206 did_oom_on_last_assign_(false), | 209 did_oom_on_last_assign_(false), |
| 207 more_tiles_need_prepare_check_notifier_( | 210 more_tiles_need_prepare_check_notifier_( |
| 208 task_runner_.get(), | 211 task_runner_.get(), |
| 209 base::Bind(&TileManager::CheckIfMoreTilesNeedToBePrepared, | 212 base::Bind(&TileManager::CheckIfMoreTilesNeedToBePrepared, |
| 210 base::Unretained(this))), | 213 base::Unretained(this))), |
| 211 signals_check_notifier_(task_runner_.get(), | 214 signals_check_notifier_(task_runner_.get(), |
| 212 base::Bind(&TileManager::CheckAndIssueSignals, | 215 base::Bind(&TileManager::CheckAndIssueSignals, |
| 213 base::Unretained(this))), | 216 base::Unretained(this))), |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 orphan_raster_tasks_.clear(); | 655 orphan_raster_tasks_.clear(); |
| 653 | 656 |
| 654 did_check_for_completed_tasks_since_last_schedule_tasks_ = false; | 657 did_check_for_completed_tasks_since_last_schedule_tasks_ = false; |
| 655 } | 658 } |
| 656 | 659 |
| 657 scoped_refptr<RasterTask> TileManager::CreateRasterTask( | 660 scoped_refptr<RasterTask> TileManager::CreateRasterTask( |
| 658 const PrioritizedTile& prioritized_tile) { | 661 const PrioritizedTile& prioritized_tile) { |
| 659 Tile* tile = prioritized_tile.tile(); | 662 Tile* tile = prioritized_tile.tile(); |
| 660 uint64_t resource_content_id = 0; | 663 uint64_t resource_content_id = 0; |
| 661 Resource* resource = nullptr; | 664 Resource* resource = nullptr; |
| 662 if (tile->invalidated_id()) { | 665 if (use_partial_raster_ && tile->invalidated_id()) { |
| 663 // TODO(danakj): For resources that are in use, we should still grab them | 666 // TODO(danakj): For resources that are in use, we should still grab them |
| 664 // and copy from them instead of rastering everything. crbug.com/492754 | 667 // and copy from them instead of rastering everything. crbug.com/492754 |
| 665 resource = | 668 resource = |
| 666 resource_pool_->TryAcquireResourceWithContentId(tile->invalidated_id()); | 669 resource_pool_->TryAcquireResourceWithContentId(tile->invalidated_id()); |
| 667 } | 670 } |
| 668 if (resource) { | 671 if (resource) { |
| 669 resource_content_id = tile->invalidated_id(); | 672 resource_content_id = tile->invalidated_id(); |
| 670 DCHECK_EQ(DetermineResourceFormat(tile), resource->format()); | 673 DCHECK_EQ(DetermineResourceFormat(tile), resource->format()); |
| 671 DCHECK_EQ(tile->desired_texture_size().ToString(), | 674 DCHECK_EQ(tile->desired_texture_size().ToString(), |
| 672 resource->size().ToString()); | 675 resource->size().ToString()); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 void TileManager::Signals::reset() { | 1005 void TileManager::Signals::reset() { |
| 1003 ready_to_activate = false; | 1006 ready_to_activate = false; |
| 1004 did_notify_ready_to_activate = false; | 1007 did_notify_ready_to_activate = false; |
| 1005 ready_to_draw = false; | 1008 ready_to_draw = false; |
| 1006 did_notify_ready_to_draw = false; | 1009 did_notify_ready_to_draw = false; |
| 1007 all_tile_tasks_completed = false; | 1010 all_tile_tasks_completed = false; |
| 1008 did_notify_all_tile_tasks_completed = false; | 1011 did_notify_all_tile_tasks_completed = false; |
| 1009 } | 1012 } |
| 1010 | 1013 |
| 1011 } // namespace cc | 1014 } // namespace cc |
| OLD | NEW |