| 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.h" | 5 #include "cc/resources/prioritized_resource.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "cc/resources/prioritized_resource_manager.h" | 9 #include "cc/resources/prioritized_resource_manager.h" |
| 10 #include "cc/resources/resource.h" | 10 #include "cc/resources/resource.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 PrioritizedResourceTest() | 24 PrioritizedResourceTest() |
| 25 : texture_size_(256, 256), | 25 : texture_size_(256, 256), |
| 26 texture_format_(RGBA_8888), | 26 texture_format_(RGBA_8888), |
| 27 output_surface_(FakeOutputSurface::Create3d()) { | 27 output_surface_(FakeOutputSurface::Create3d()) { |
| 28 DebugScopedSetImplThread impl_thread(&proxy_); | 28 DebugScopedSetImplThread impl_thread(&proxy_); |
| 29 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 29 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 30 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 30 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
| 31 resource_provider_ = ResourceProvider::Create(output_surface_.get(), | 31 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
| 32 shared_bitmap_manager_.get(), | 32 shared_bitmap_manager_.get(), |
| 33 NULL, | 33 nullptr, |
| 34 0, | 34 0, |
| 35 false, | 35 false, |
| 36 1, | 36 1, |
| 37 false); | 37 false); |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual ~PrioritizedResourceTest() { | 40 virtual ~PrioritizedResourceTest() { |
| 41 DebugScopedSetImplThread impl_thread(&proxy_); | 41 DebugScopedSetImplThread impl_thread(&proxy_); |
| 42 resource_provider_ = nullptr; | 42 resource_provider_ = nullptr; |
| 43 } | 43 } |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 // Texture is initially invalid, but it will become available. | 745 // Texture is initially invalid, but it will become available. |
| 746 EXPECT_FALSE(texture->have_backing_texture()); | 746 EXPECT_FALSE(texture->have_backing_texture()); |
| 747 | 747 |
| 748 texture->set_request_priority(100); | 748 texture->set_request_priority(100); |
| 749 PrioritizeTexturesAndBackings(resource_manager_one.get()); | 749 PrioritizeTexturesAndBackings(resource_manager_one.get()); |
| 750 | 750 |
| 751 EXPECT_TRUE(ValidateTexture(texture.get(), false)); | 751 EXPECT_TRUE(ValidateTexture(texture.get(), false)); |
| 752 EXPECT_TRUE(texture->can_acquire_backing_texture()); | 752 EXPECT_TRUE(texture->can_acquire_backing_texture()); |
| 753 EXPECT_TRUE(texture->have_backing_texture()); | 753 EXPECT_TRUE(texture->have_backing_texture()); |
| 754 | 754 |
| 755 texture->SetTextureManager(NULL); | 755 texture->SetTextureManager(nullptr); |
| 756 { | 756 { |
| 757 DebugScopedSetImplThreadAndMainThreadBlocked | 757 DebugScopedSetImplThreadAndMainThreadBlocked |
| 758 impl_thread_and_main_thread_blocked(&proxy_); | 758 impl_thread_and_main_thread_blocked(&proxy_); |
| 759 resource_manager_one->ClearAllMemory(resource_provider()); | 759 resource_manager_one->ClearAllMemory(resource_provider()); |
| 760 } | 760 } |
| 761 resource_manager_one = nullptr; | 761 resource_manager_one = nullptr; |
| 762 | 762 |
| 763 EXPECT_FALSE(texture->can_acquire_backing_texture()); | 763 EXPECT_FALSE(texture->can_acquire_backing_texture()); |
| 764 EXPECT_FALSE(texture->have_backing_texture()); | 764 EXPECT_FALSE(texture->have_backing_texture()); |
| 765 | 765 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 textures[i]->set_request_priority(100); | 1003 textures[i]->set_request_priority(100); |
| 1004 PrioritizeTexturesAndBackings(resource_manager.get()); | 1004 PrioritizeTexturesAndBackings(resource_manager.get()); |
| 1005 for (unsigned i = 0; i < kMaxTextures; ++i) | 1005 for (unsigned i = 0; i < kMaxTextures; ++i) |
| 1006 EXPECT_TRUE(ValidateTexture(textures[i].get(), false)); | 1006 EXPECT_TRUE(ValidateTexture(textures[i].get(), false)); |
| 1007 | 1007 |
| 1008 ResourceUpdateQueue queue; | 1008 ResourceUpdateQueue queue; |
| 1009 DebugScopedSetImplThreadAndMainThreadBlocked | 1009 DebugScopedSetImplThreadAndMainThreadBlocked |
| 1010 impl_thread_and_main_thread_blocked(&proxy_); | 1010 impl_thread_and_main_thread_blocked(&proxy_); |
| 1011 for (size_t i = 0; i < kMaxTextures; ++i) { | 1011 for (size_t i = 0; i < kMaxTextures; ++i) { |
| 1012 const ResourceUpdate upload = ResourceUpdate::Create( | 1012 const ResourceUpdate upload = ResourceUpdate::Create( |
| 1013 textures[i].get(), NULL, gfx::Rect(), gfx::Rect(), gfx::Vector2d()); | 1013 textures[i].get(), nullptr, gfx::Rect(), gfx::Rect(), gfx::Vector2d()); |
| 1014 queue.AppendFullUpload(upload); | 1014 queue.AppendFullUpload(upload); |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 // Make sure that we have backings for all of the textures. | 1017 // Make sure that we have backings for all of the textures. |
| 1018 for (size_t i = 0; i < kMaxTextures; ++i) | 1018 for (size_t i = 0; i < kMaxTextures; ++i) |
| 1019 EXPECT_TRUE(textures[i]->have_backing_texture()); | 1019 EXPECT_TRUE(textures[i]->have_backing_texture()); |
| 1020 | 1020 |
| 1021 queue.ClearUploadsToEvictedResources(); | 1021 queue.ClearUploadsToEvictedResources(); |
| 1022 EXPECT_EQ(4u, queue.FullUploadSize()); | 1022 EXPECT_EQ(4u, queue.FullUploadSize()); |
| 1023 | 1023 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 resource_manager->MemoryVisibleAndNearbyBytes()); | 1108 resource_manager->MemoryVisibleAndNearbyBytes()); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 DebugScopedSetImplThreadAndMainThreadBlocked | 1111 DebugScopedSetImplThreadAndMainThreadBlocked |
| 1112 impl_thread_and_main_thread_blocked(&proxy_); | 1112 impl_thread_and_main_thread_blocked(&proxy_); |
| 1113 resource_manager->ClearAllMemory(resource_provider()); | 1113 resource_manager->ClearAllMemory(resource_provider()); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 } // namespace | 1116 } // namespace |
| 1117 } // namespace cc | 1117 } // namespace cc |
| OLD | NEW |