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 <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; | 359 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; |
360 } | 360 } |
361 | 361 |
362 FreeResourcesForReleasedTiles(); | 362 FreeResourcesForReleasedTiles(); |
363 CleanUpReleasedTiles(); | 363 CleanUpReleasedTiles(); |
364 | 364 |
365 TileVector tiles_that_need_to_be_rasterized; | 365 TileVector tiles_that_need_to_be_rasterized; |
366 scoped_ptr<RasterTilePriorityQueue> raster_priority_queue( | 366 scoped_ptr<RasterTilePriorityQueue> raster_priority_queue( |
367 client_->BuildRasterQueue(global_state_.tree_priority, | 367 client_->BuildRasterQueue(global_state_.tree_priority, |
368 RasterTilePriorityQueue::Type::ALL)); | 368 RasterTilePriorityQueue::Type::ALL)); |
369 // Inform the client that will likely require a draw if the top tile is | |
370 // required for draw. | |
371 client_->SetIsLikelyToRequireADraw( | |
372 !raster_priority_queue->IsEmpty() && | |
373 raster_priority_queue->Top()->required_for_draw()); | |
374 AssignGpuMemoryToTiles(raster_priority_queue.get(), | 369 AssignGpuMemoryToTiles(raster_priority_queue.get(), |
375 scheduled_raster_task_limit_, | 370 scheduled_raster_task_limit_, |
376 &tiles_that_need_to_be_rasterized); | 371 &tiles_that_need_to_be_rasterized); |
377 | 372 |
| 373 // Inform the client that will likely require a draw if the highest priority |
| 374 // tile that will be rasterized is required for draw. |
| 375 client_->SetIsLikelyToRequireADraw( |
| 376 !tiles_that_need_to_be_rasterized.empty() && |
| 377 (*tiles_that_need_to_be_rasterized.begin())->required_for_draw()); |
| 378 |
378 // Schedule tile tasks. | 379 // Schedule tile tasks. |
379 ScheduleTasks(tiles_that_need_to_be_rasterized); | 380 ScheduleTasks(tiles_that_need_to_be_rasterized); |
380 | 381 |
381 did_notify_ready_to_activate_ = false; | 382 did_notify_ready_to_activate_ = false; |
382 did_notify_ready_to_draw_ = false; | 383 did_notify_ready_to_draw_ = false; |
383 } else { | 384 } else { |
384 if (global_state_.hard_memory_limit_in_bytes == 0) { | 385 if (global_state_.hard_memory_limit_in_bytes == 0) { |
385 resource_pool_->CheckBusyResources(false); | 386 resource_pool_->CheckBusyResources(false); |
386 MemoryUsage memory_limit(0, 0); | 387 MemoryUsage memory_limit(0, 0); |
387 MemoryUsage memory_usage(resource_pool_->acquired_memory_usage_bytes(), | 388 MemoryUsage memory_usage(resource_pool_->acquired_memory_usage_bytes(), |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 result -= other; | 1053 result -= other; |
1053 return result; | 1054 return result; |
1054 } | 1055 } |
1055 | 1056 |
1056 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 1057 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
1057 return memory_bytes_ > limit.memory_bytes_ || | 1058 return memory_bytes_ > limit.memory_bytes_ || |
1058 resource_count_ > limit.resource_count_; | 1059 resource_count_ > limit.resource_count_; |
1059 } | 1060 } |
1060 | 1061 |
1061 } // namespace cc | 1062 } // namespace cc |
OLD | NEW |