| 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/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/resources/prioritized_resource.h" | 10 #include "cc/resources/prioritized_resource.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 } | 444 } |
| 445 | 445 |
| 446 PrioritizedResource::Backing* PrioritizedResourceManager::CreateBacking( | 446 PrioritizedResource::Backing* PrioritizedResourceManager::CreateBacking( |
| 447 const gfx::Size& size, | 447 const gfx::Size& size, |
| 448 ResourceFormat format, | 448 ResourceFormat format, |
| 449 ResourceProvider* resource_provider) { | 449 ResourceProvider* resource_provider) { |
| 450 DCHECK(proxy_->IsImplThread() && proxy_->IsMainThreadBlocked()); | 450 DCHECK(proxy_->IsImplThread() && proxy_->IsMainThreadBlocked()); |
| 451 DCHECK(resource_provider); | 451 DCHECK(resource_provider); |
| 452 ResourceProvider::ResourceId resource_id = | 452 ResourceProvider::ResourceId resource_id = |
| 453 resource_provider->CreateManagedResource( | 453 resource_provider->CreateManagedResource( |
| 454 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, | 454 size, |
| 455 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 455 GL_TEXTURE_2D, |
| 456 GL_CLAMP_TO_EDGE, |
| 457 ResourceProvider::TextureHintImmutable, |
| 458 format); |
| 456 PrioritizedResource::Backing* backing = new PrioritizedResource::Backing( | 459 PrioritizedResource::Backing* backing = new PrioritizedResource::Backing( |
| 457 resource_id, resource_provider, size, format); | 460 resource_id, resource_provider, size, format); |
| 458 memory_use_bytes_ += backing->bytes(); | 461 memory_use_bytes_ += backing->bytes(); |
| 459 return backing; | 462 return backing; |
| 460 } | 463 } |
| 461 | 464 |
| 462 void PrioritizedResourceManager::EvictFirstBackingResource( | 465 void PrioritizedResourceManager::EvictFirstBackingResource( |
| 463 ResourceProvider* resource_provider) { | 466 ResourceProvider* resource_provider) { |
| 464 DCHECK(proxy_->IsImplThread()); | 467 DCHECK(proxy_->IsImplThread()); |
| 465 DCHECK(resource_provider); | 468 DCHECK(resource_provider); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 previous_backing = backing; | 541 previous_backing = backing; |
| 539 } | 542 } |
| 540 #endif // DCHECK_IS_ON() | 543 #endif // DCHECK_IS_ON() |
| 541 } | 544 } |
| 542 | 545 |
| 543 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { | 546 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { |
| 544 return proxy_; | 547 return proxy_; |
| 545 } | 548 } |
| 546 | 549 |
| 547 } // namespace cc | 550 } // namespace cc |
| OLD | NEW |