| Index: cc/prioritized_texture_unittest.cc
|
| ===================================================================
|
| --- cc/prioritized_texture_unittest.cc (revision 165906)
|
| +++ cc/prioritized_texture_unittest.cc (working copy)
|
| @@ -9,7 +9,6 @@
|
| #include "cc/prioritized_texture_manager.h"
|
| #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread
|
| #include "cc/test/fake_graphics_context.h"
|
| -#include "cc/test/fake_proxy.h"
|
| #include "cc/test/tiled_layer_test_common.h"
|
| #include "cc/texture.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -22,18 +21,17 @@
|
| class PrioritizedTextureTest : public testing::Test {
|
| public:
|
| PrioritizedTextureTest()
|
| - : m_proxy(scoped_ptr<Thread>(NULL))
|
| - , m_textureSize(256, 256)
|
| + : m_textureSize(256, 256)
|
| , m_textureFormat(GL_RGBA)
|
| , m_context(WebKit::createFakeGraphicsContext())
|
| {
|
| - DebugScopedSetImplThread implThread(&m_proxy);
|
| + DebugScopedSetImplThread implThread;
|
| m_resourceProvider = ResourceProvider::create(m_context.get());
|
| }
|
|
|
| virtual ~PrioritizedTextureTest()
|
| {
|
| - DebugScopedSetImplThread implThread(&m_proxy);
|
| + DebugScopedSetImplThread implThread;
|
| m_resourceProvider.reset();
|
| }
|
|
|
| @@ -44,7 +42,7 @@
|
|
|
| scoped_ptr<PrioritizedTextureManager> createManager(size_t maxTextures)
|
| {
|
| - return PrioritizedTextureManager::create(texturesMemorySize(maxTextures), 1024, 0, &m_proxy);
|
| + return PrioritizedTextureManager::create(texturesMemorySize(maxTextures), 1024, 0);
|
| }
|
|
|
| bool validateTexture(scoped_ptr<PrioritizedTexture>& texture, bool requestLate)
|
| @@ -53,7 +51,7 @@
|
| if (requestLate)
|
| texture->requestLate();
|
| textureManagerAssertInvariants(texture->textureManager());
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| bool success = texture->canAcquireBackingTexture();
|
| if (success)
|
| texture->acquireBackingTexture(resourceProvider());
|
| @@ -68,7 +66,7 @@
|
|
|
| void textureManagerUpdateBackingsPriorities(PrioritizedTextureManager* textureManager)
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->pushTexturePrioritiesToBackings();
|
| }
|
|
|
| @@ -80,7 +78,7 @@
|
| void textureManagerAssertInvariants(PrioritizedTextureManager* textureManager)
|
| {
|
| #ifndef NDEBUG
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->assertInvariants();
|
| #endif
|
| }
|
| @@ -91,7 +89,6 @@
|
| }
|
|
|
| protected:
|
| - FakeProxy m_proxy;
|
| const gfx::Size m_textureSize;
|
| const GLenum m_textureFormat;
|
| scoped_ptr<GraphicsContext> m_context;
|
| @@ -138,7 +135,7 @@
|
| EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->memoryAboveCutoffBytes());
|
| EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -159,7 +156,7 @@
|
| for (size_t i = 0; i < maxTextures; ++i)
|
| validateTexture(textures[i], false);
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->reduceMemory(resourceProvider());
|
| }
|
|
|
| @@ -172,7 +169,7 @@
|
| for (size_t i = 0; i < maxTextures; ++i)
|
| EXPECT_EQ(validateTexture(textures[i], false), i < 5);
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->reduceMemory(resourceProvider());
|
| }
|
|
|
| @@ -185,14 +182,14 @@
|
| for (size_t i = 0; i < maxTextures; ++i)
|
| EXPECT_EQ(validateTexture(textures[i], false), i < 4);
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->reduceMemory(resourceProvider());
|
| }
|
|
|
| EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes());
|
| EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -216,7 +213,7 @@
|
| for (size_t i = 0; i < maxTextures; ++i)
|
| EXPECT_EQ(validateTexture(textures[i], true), i < 6);
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->reduceMemory(resourceProvider());
|
| }
|
| EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes());
|
| @@ -228,7 +225,7 @@
|
| for (size_t i = 0; i < maxTextures; ++i)
|
| EXPECT_EQ(validateTexture(textures[i], false), i < 4);
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->reduceMemory(resourceProvider());
|
| }
|
| EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes());
|
| @@ -236,7 +233,7 @@
|
| // Do a one-time eviction for one more texture based on priority cutoff
|
| PrioritizedTextureManager::BackingList evictedBackings;
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->reduceMemoryOnImplThread(texturesMemorySize(8), 104, resourceProvider());
|
| textureManager->getEvictedBackings(evictedBackings);
|
| EXPECT_EQ(0, evictedBackings.size());
|
| @@ -252,12 +249,12 @@
|
| for (size_t i = 0; i < maxTextures; ++i)
|
| EXPECT_EQ(validateTexture(textures[i], false), i < 4);
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->reduceMemory(resourceProvider());
|
| }
|
| EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes());
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -317,7 +314,7 @@
|
| EXPECT_FALSE(textures[2]->haveBackingTexture());
|
| EXPECT_FALSE(textures[3]->haveBackingTexture());
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -357,7 +354,7 @@
|
| EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes());
|
| EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -377,7 +374,7 @@
|
| EXPECT_TRUE(texture->haveBackingTexture());
|
|
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
| textureManager.reset();
|
| @@ -405,7 +402,7 @@
|
| texture->setTextureManager(0);
|
|
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManagerOne->clearAllMemory(resourceProvider());
|
| }
|
| textureManagerOne.reset();
|
| @@ -421,7 +418,7 @@
|
| EXPECT_TRUE(texture->canAcquireBackingTexture());
|
| EXPECT_TRUE(texture->haveBackingTexture());
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManagerTwo->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -467,7 +464,7 @@
|
| EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures());
|
| EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -504,7 +501,7 @@
|
| EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures());
|
| EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -544,7 +541,7 @@
|
| EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTextures());
|
| EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes());
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -592,7 +589,7 @@
|
| for (size_t i = 1; i < maxTextures; i += 2)
|
| EXPECT_FALSE(textureBackingIsAbovePriorityCutoff(textures[i].get()));
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
| @@ -617,7 +614,7 @@
|
| EXPECT_TRUE(validateTexture(textures[i], false));
|
|
|
| ResourceUpdateQueue queue;
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| for (size_t i = 0; i < maxTextures; ++i) {
|
| const ResourceUpdate upload = ResourceUpdate::Create(
|
| textures[i].get(), NULL, gfx::Rect(), gfx::Rect(), gfx::Vector2d());
|
| @@ -669,7 +666,7 @@
|
|
|
| // Validate the statistics.
|
| {
|
| - DebugScopedSetImplThread implThread(&m_proxy);
|
| + DebugScopedSetImplThread implThread;
|
| EXPECT_EQ(texturesMemorySize(2), textureManager->memoryUseBytes());
|
| EXPECT_EQ(texturesMemorySize(1), textureManager->memoryVisibleBytes());
|
| EXPECT_EQ(texturesMemorySize(3), textureManager->memoryVisibleAndNearbyBytes());
|
| @@ -685,7 +682,7 @@
|
|
|
| // Verify that we still see the old values.
|
| {
|
| - DebugScopedSetImplThread implThread(&m_proxy);
|
| + DebugScopedSetImplThread implThread;
|
| EXPECT_EQ(texturesMemorySize(2), textureManager->memoryUseBytes());
|
| EXPECT_EQ(texturesMemorySize(1), textureManager->memoryVisibleBytes());
|
| EXPECT_EQ(texturesMemorySize(3), textureManager->memoryVisibleAndNearbyBytes());
|
| @@ -693,14 +690,14 @@
|
|
|
| // Push priorities to backings, and verify we see the new values.
|
| {
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->pushTexturePrioritiesToBackings();
|
| EXPECT_EQ(texturesMemorySize(2), textureManager->memoryUseBytes());
|
| EXPECT_EQ(texturesMemorySize(3), textureManager->memoryVisibleBytes());
|
| EXPECT_EQ(texturesMemorySize(4), textureManager->memoryVisibleAndNearbyBytes());
|
| }
|
|
|
| - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy);
|
| + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
|
| textureManager->clearAllMemory(resourceProvider());
|
| }
|
|
|
|
|