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/prioritized_resource_manager.h" | 5 #include "cc/resources/prioritized_resource_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/resources/prioritized_resource.h" | 10 #include "cc/resources/prioritized_resource.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 // we can delete the resource while the main thread is running, but we cannot | 474 // we can delete the resource while the main thread is running, but we cannot |
475 // unlink backings while the main thread is running. | 475 // unlink backings while the main thread is running. |
476 backing->DeleteResource(resource_provider); | 476 backing->DeleteResource(resource_provider); |
477 memory_use_bytes_ -= backing->bytes(); | 477 memory_use_bytes_ -= backing->bytes(); |
478 backings_.pop_front(); | 478 backings_.pop_front(); |
479 base::AutoLock scoped_lock(evicted_backings_lock_); | 479 base::AutoLock scoped_lock(evicted_backings_lock_); |
480 evicted_backings_.push_back(backing); | 480 evicted_backings_.push_back(backing); |
481 } | 481 } |
482 | 482 |
483 void PrioritizedResourceManager::AssertInvariants() { | 483 void PrioritizedResourceManager::AssertInvariants() { |
484 #if DCHECK_IS_ON | 484 #if DCHECK_IS_ON() |
485 DCHECK(proxy_->IsImplThread() && proxy_->IsMainThreadBlocked()); | 485 DCHECK(proxy_->IsImplThread() && proxy_->IsMainThreadBlocked()); |
486 | 486 |
487 // If we hit any of these asserts, there is a bug in this class. To see | 487 // If we hit any of these asserts, there is a bug in this class. To see |
488 // where the bug is, call this function at the beginning and end of | 488 // where the bug is, call this function at the beginning and end of |
489 // every public function. | 489 // every public function. |
490 | 490 |
491 // Backings/textures must be doubly-linked and only to other backings/textures | 491 // Backings/textures must be doubly-linked and only to other backings/textures |
492 // in this manager. | 492 // in this manager. |
493 for (BackingList::iterator it = backings_.begin(); it != backings_.end(); | 493 for (BackingList::iterator it = backings_.begin(); it != backings_.end(); |
494 ++it) { | 494 ++it) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 !backing->was_above_priority_cutoff_at_last_priority_update())) | 533 !backing->was_above_priority_cutoff_at_last_priority_update())) |
534 DCHECK(CompareBackings(previous_backing, backing)); | 534 DCHECK(CompareBackings(previous_backing, backing)); |
535 if (!backing->CanBeRecycledIfNotInExternalUse()) | 535 if (!backing->CanBeRecycledIfNotInExternalUse()) |
536 reached_unrecyclable = true; | 536 reached_unrecyclable = true; |
537 if (reached_unrecyclable) | 537 if (reached_unrecyclable) |
538 DCHECK(!backing->CanBeRecycledIfNotInExternalUse()); | 538 DCHECK(!backing->CanBeRecycledIfNotInExternalUse()); |
539 else | 539 else |
540 DCHECK(backing->CanBeRecycledIfNotInExternalUse()); | 540 DCHECK(backing->CanBeRecycledIfNotInExternalUse()); |
541 previous_backing = backing; | 541 previous_backing = backing; |
542 } | 542 } |
543 #endif // DCHECK_IS_ON | 543 #endif // DCHECK_IS_ON() |
544 } | 544 } |
545 | 545 |
546 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { | 546 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { |
547 return proxy_; | 547 return proxy_; |
548 } | 548 } |
549 | 549 |
550 } // namespace cc | 550 } // namespace cc |
OLD | NEW |