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...) 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, | 454 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, |
455 GL_TEXTURE_2D, | 455 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
456 GL_CLAMP_TO_EDGE, | |
457 ResourceProvider::TextureHintImmutable, | |
458 format); | |
459 PrioritizedResource::Backing* backing = new PrioritizedResource::Backing( | 456 PrioritizedResource::Backing* backing = new PrioritizedResource::Backing( |
460 resource_id, resource_provider, size, format); | 457 resource_id, resource_provider, size, format); |
461 memory_use_bytes_ += backing->bytes(); | 458 memory_use_bytes_ += backing->bytes(); |
462 return backing; | 459 return backing; |
463 } | 460 } |
464 | 461 |
465 void PrioritizedResourceManager::EvictFirstBackingResource( | 462 void PrioritizedResourceManager::EvictFirstBackingResource( |
466 ResourceProvider* resource_provider) { | 463 ResourceProvider* resource_provider) { |
467 DCHECK(proxy_->IsImplThread()); | 464 DCHECK(proxy_->IsImplThread()); |
468 DCHECK(resource_provider); | 465 DCHECK(resource_provider); |
(...skipping 72 matching lines...) Loading... |
541 previous_backing = backing; | 538 previous_backing = backing; |
542 } | 539 } |
543 #endif // DCHECK_IS_ON() | 540 #endif // DCHECK_IS_ON() |
544 } | 541 } |
545 | 542 |
546 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { | 543 const Proxy* PrioritizedResourceManager::ProxyForDebug() const { |
547 return proxy_; | 544 return proxy_; |
548 } | 545 } |
549 | 546 |
550 } // namespace cc | 547 } // namespace cc |
OLD | NEW |