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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 ready_to_activate_check_notifier_.Schedule(); | 393 ready_to_activate_check_notifier_.Schedule(); |
394 return; | 394 return; |
395 case REQUIRED_FOR_DRAW: | 395 case REQUIRED_FOR_DRAW: |
396 ready_to_draw_check_notifier_.Schedule(); | 396 ready_to_draw_check_notifier_.Schedule(); |
397 return; | 397 return; |
398 } | 398 } |
399 | 399 |
400 NOTREACHED(); | 400 NOTREACHED(); |
401 } | 401 } |
402 | 402 |
403 void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { | 403 void TileManager::PrepareTiles( |
404 TRACE_EVENT0("cc", "TileManager::ManageTiles"); | 404 const GlobalStateThatImpactsTilePriority& state) { |
| 405 TRACE_EVENT0("cc", "TileManager::PrepareTiles"); |
405 | 406 |
406 global_state_ = state; | 407 global_state_ = state; |
407 | 408 |
408 // We need to call CheckForCompletedTasks() once in-between each call | 409 // We need to call CheckForCompletedTasks() once in-between each call |
409 // to ScheduleTasks() to prevent canceled tasks from being scheduled. | 410 // to ScheduleTasks() to prevent canceled tasks from being scheduled. |
410 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { | 411 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { |
411 rasterizer_->CheckForCompletedTasks(); | 412 rasterizer_->CheckForCompletedTasks(); |
412 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; | 413 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; |
413 } | 414 } |
414 | 415 |
415 FreeResourcesForReleasedTiles(); | 416 FreeResourcesForReleasedTiles(); |
416 CleanUpReleasedTiles(); | 417 CleanUpReleasedTiles(); |
417 | 418 |
418 TileVector tiles_that_need_to_be_rasterized; | 419 TileVector tiles_that_need_to_be_rasterized; |
419 AssignGpuMemoryToTiles(&tiles_that_need_to_be_rasterized); | 420 AssignGpuMemoryToTiles(&tiles_that_need_to_be_rasterized); |
420 | 421 |
421 // Schedule rasterizer tasks. | 422 // Schedule rasterizer tasks. |
422 ScheduleTasks(tiles_that_need_to_be_rasterized); | 423 ScheduleTasks(tiles_that_need_to_be_rasterized); |
423 | 424 |
424 did_notify_ready_to_activate_ = false; | 425 did_notify_ready_to_activate_ = false; |
425 did_notify_ready_to_draw_ = false; | 426 did_notify_ready_to_draw_ = false; |
426 | 427 |
427 TRACE_EVENT_INSTANT1("cc", | 428 TRACE_EVENT_INSTANT1("cc", "DidPrepare", TRACE_EVENT_SCOPE_THREAD, "state", |
428 "DidManage", | |
429 TRACE_EVENT_SCOPE_THREAD, | |
430 "state", | |
431 BasicStateAsValue()); | 429 BasicStateAsValue()); |
432 | 430 |
433 TRACE_COUNTER_ID1("cc", | 431 TRACE_COUNTER_ID1("cc", |
434 "unused_memory_bytes", | 432 "unused_memory_bytes", |
435 this, | 433 this, |
436 resource_pool_->total_memory_usage_bytes() - | 434 resource_pool_->total_memory_usage_bytes() - |
437 resource_pool_->acquired_memory_usage_bytes()); | 435 resource_pool_->acquired_memory_usage_bytes()); |
438 } | 436 } |
439 | 437 |
440 void TileManager::UpdateVisibleTiles() { | 438 void TileManager::UpdateVisibleTiles() { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 result -= other; | 953 result -= other; |
956 return result; | 954 return result; |
957 } | 955 } |
958 | 956 |
959 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 957 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
960 return memory_bytes_ > limit.memory_bytes_ || | 958 return memory_bytes_ > limit.memory_bytes_ || |
961 resource_count_ > limit.resource_count_; | 959 resource_count_ > limit.resource_count_; |
962 } | 960 } |
963 | 961 |
964 } // namespace cc | 962 } // namespace cc |
OLD | NEW |