| 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" |
| 11 #include "cc/test/fake_output_surface.h" | 11 #include "cc/test/fake_output_surface.h" |
| 12 #include "cc/test/fake_output_surface_client.h" | 12 #include "cc/test/fake_output_surface_client.h" |
| 13 #include "cc/test/fake_proxy.h" | 13 #include "cc/test/fake_proxy.h" |
| 14 #include "cc/test/tiled_layer_test_common.h" | 14 #include "cc/test/tiled_layer_test_common.h" |
| 15 #include "cc/trees/single_thread_proxy.h" // For DebugScopedSetImplThread | 15 #include "cc/trees/single_thread_proxy.h" // For DebugScopedSetImplThread |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 | 19 |
| 20 class PrioritizedResourceTest : public testing::Test { | 20 class PrioritizedResourceTest : public testing::Test { |
| 21 public: | 21 public: |
| 22 PrioritizedResourceTest() | 22 PrioritizedResourceTest() |
| 23 : texture_size_(256, 256), | 23 : texture_size_(256, 256), |
| 24 texture_format_(RGBA_8888), | 24 texture_format_(RGBA_8888), |
| 25 output_surface_(FakeOutputSurface::Create3d()) { | 25 output_surface_(FakeOutputSurface::Create3d()) { |
| 26 DebugScopedSetImplThread impl_thread(&proxy_); | 26 DebugScopedSetImplThread impl_thread(&proxy_); |
| 27 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 27 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 28 resource_provider_ = | 28 resource_provider_ = |
| 29 ResourceProvider::Create(output_surface_.get(), NULL, 0, false); | 29 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual ~PrioritizedResourceTest() { | 32 virtual ~PrioritizedResourceTest() { |
| 33 DebugScopedSetImplThread impl_thread(&proxy_); | 33 DebugScopedSetImplThread impl_thread(&proxy_); |
| 34 resource_provider_.reset(); | 34 resource_provider_.reset(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 size_t TexturesMemorySize(size_t texture_count) { | 37 size_t TexturesMemorySize(size_t texture_count) { |
| 38 return Resource::MemorySizeBytes(texture_size_, texture_format_) * | 38 return Resource::MemorySizeBytes(texture_size_, texture_format_) * |
| 39 texture_count; | 39 texture_count; |
| (...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 resource_manager->MemoryVisibleAndNearbyBytes()); | 1094 resource_manager->MemoryVisibleAndNearbyBytes()); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 DebugScopedSetImplThreadAndMainThreadBlocked | 1097 DebugScopedSetImplThreadAndMainThreadBlocked |
| 1098 impl_thread_and_main_thread_blocked(&proxy_); | 1098 impl_thread_and_main_thread_blocked(&proxy_); |
| 1099 resource_manager->ClearAllMemory(ResourceProvider()); | 1099 resource_manager->ClearAllMemory(ResourceProvider()); |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 } // namespace | 1102 } // namespace |
| 1103 } // namespace cc | 1103 } // namespace cc |
| OLD | NEW |