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 "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 void PrioritizedResourceManager::ReturnBackingTexture( | 442 void PrioritizedResourceManager::ReturnBackingTexture( |
443 PrioritizedResource* texture) { | 443 PrioritizedResource* texture) { |
444 DCHECK(proxy_->IsMainThread() || | 444 DCHECK(proxy_->IsMainThread() || |
445 (proxy_->IsImplThread() && proxy_->IsMainThreadBlocked())); | 445 (proxy_->IsImplThread() && proxy_->IsMainThreadBlocked())); |
446 if (texture->backing()) | 446 if (texture->backing()) |
447 texture->Unlink(); | 447 texture->Unlink(); |
448 } | 448 } |
449 | 449 |
450 PrioritizedResource::Backing* PrioritizedResourceManager::CreateBacking( | 450 PrioritizedResource::Backing* PrioritizedResourceManager::CreateBacking( |
451 gfx::Size size, | 451 gfx::Size size, |
452 GLenum format, | 452 ResourceFormat format, |
453 ResourceProvider* resource_provider) { | 453 ResourceProvider* resource_provider) { |
454 DCHECK(proxy_->IsImplThread() && proxy_->IsMainThreadBlocked()); | 454 DCHECK(proxy_->IsImplThread() && proxy_->IsMainThreadBlocked()); |
455 DCHECK(resource_provider); | 455 DCHECK(resource_provider); |
456 ResourceProvider::ResourceId resource_id = | 456 ResourceProvider::ResourceId resource_id = |
457 resource_provider->CreateManagedResource( | 457 resource_provider->CreateManagedResource( |
458 size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny); | 458 size, |
| 459 GL_CLAMP_TO_EDGE, |
| 460 ResourceProvider::TextureUsageAny, |
| 461 format); |
459 PrioritizedResource::Backing* backing = new PrioritizedResource::Backing( | 462 PrioritizedResource::Backing* backing = new PrioritizedResource::Backing( |
460 resource_id, resource_provider, size, format); | 463 resource_id, resource_provider, size, format); |
461 memory_use_bytes_ += backing->bytes(); | 464 memory_use_bytes_ += backing->bytes(); |
462 return backing; | 465 return backing; |
463 } | 466 } |
464 | 467 |
465 void PrioritizedResourceManager::EvictFirstBackingResource( | 468 void PrioritizedResourceManager::EvictFirstBackingResource( |
466 ResourceProvider* resource_provider) { | 469 ResourceProvider* resource_provider) { |
467 DCHECK(proxy_->IsImplThread()); | 470 DCHECK(proxy_->IsImplThread()); |
468 DCHECK(resource_provider); | 471 DCHECK(resource_provider); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 previous_backing = backing; | 544 previous_backing = backing; |
542 } | 545 } |
543 #endif | 546 #endif |
544 } | 547 } |
545 | 548 |
546 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { | 549 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { |
547 return proxy_; | 550 return proxy_; |
548 } | 551 } |
549 | 552 |
550 } // namespace cc | 553 } // namespace cc |
OLD | NEW |