| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 if (texture->backing()) | 442 if (texture->backing()) |
| 443 texture->Unlink(); | 443 texture->Unlink(); |
| 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 ResourceId resource_id = resource_provider->CreateManagedResource( |
| 453 resource_provider->CreateManagedResource( | 453 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, |
| 454 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, | 454 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 455 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | |
| 456 PrioritizedResource::Backing* backing = new PrioritizedResource::Backing( | 455 PrioritizedResource::Backing* backing = new PrioritizedResource::Backing( |
| 457 resource_id, resource_provider, size, format); | 456 resource_id, resource_provider, size, format); |
| 458 memory_use_bytes_ += backing->bytes(); | 457 memory_use_bytes_ += backing->bytes(); |
| 459 return backing; | 458 return backing; |
| 460 } | 459 } |
| 461 | 460 |
| 462 void PrioritizedResourceManager::EvictFirstBackingResource( | 461 void PrioritizedResourceManager::EvictFirstBackingResource( |
| 463 ResourceProvider* resource_provider) { | 462 ResourceProvider* resource_provider) { |
| 464 DCHECK(proxy_->IsImplThread()); | 463 DCHECK(proxy_->IsImplThread()); |
| 465 DCHECK(resource_provider); | 464 DCHECK(resource_provider); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 previous_backing = backing; | 537 previous_backing = backing; |
| 539 } | 538 } |
| 540 #endif // DCHECK_IS_ON() | 539 #endif // DCHECK_IS_ON() |
| 541 } | 540 } |
| 542 | 541 |
| 543 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { | 542 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { |
| 544 return proxy_; | 543 return proxy_; |
| 545 } | 544 } |
| 546 | 545 |
| 547 } // namespace cc | 546 } // namespace cc |
| OLD | NEW |