diff options
Diffstat (limited to 'cc/prioritized_texture_unittest.cc')
-rw-r--r-- | cc/prioritized_texture_unittest.cc | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/cc/prioritized_texture_unittest.cc b/cc/prioritized_texture_unittest.cc index 6511dce..9c37395 100644 --- a/cc/prioritized_texture_unittest.cc +++ b/cc/prioritized_texture_unittest.cc @@ -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 @@ namespace cc { 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 @@ public: 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 @@ public: 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 @@ public: void textureManagerUpdateBackingsPriorities(PrioritizedTextureManager* textureManager) { - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->pushTexturePrioritiesToBackings(); } @@ -80,7 +78,7 @@ public: void textureManagerAssertInvariants(PrioritizedTextureManager* textureManager) { #ifndef NDEBUG - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->assertInvariants(); #endif } @@ -91,7 +89,6 @@ public: } protected: - FakeProxy m_proxy; const IntSize m_textureSize; const GLenum m_textureFormat; scoped_ptr<GraphicsContext> m_context; @@ -138,7 +135,7 @@ TEST_F(PrioritizedTextureTest, requestTextureExceedingMaxLimit) 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 @@ TEST_F(PrioritizedTextureTest, changeMemoryLimits) 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 @@ TEST_F(PrioritizedTextureTest, changeMemoryLimits) 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 @@ TEST_F(PrioritizedTextureTest, changeMemoryLimits) 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 @@ TEST_F(PrioritizedTextureTest, changePriorityCutoff) 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 @@ TEST_F(PrioritizedTextureTest, changePriorityCutoff) 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 @@ TEST_F(PrioritizedTextureTest, changePriorityCutoff) // 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 @@ TEST_F(PrioritizedTextureTest, changePriorityCutoff) 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 @@ TEST_F(PrioritizedTextureTest, textureManagerPartialUpdateTextures) EXPECT_FALSE(textures[2]->haveBackingTexture()); EXPECT_FALSE(textures[3]->haveBackingTexture()); - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -357,7 +354,7 @@ TEST_F(PrioritizedTextureTest, textureManagerPrioritiesAreEqual) 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 @@ TEST_F(PrioritizedTextureTest, textureManagerDestroyedFirst) EXPECT_TRUE(texture->haveBackingTexture()); { - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } textureManager.reset(); @@ -405,7 +402,7 @@ TEST_F(PrioritizedTextureTest, textureMovedToNewManager) texture->setTextureManager(0); { - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManagerOne->clearAllMemory(resourceProvider()); } textureManagerOne.reset(); @@ -421,7 +418,7 @@ TEST_F(PrioritizedTextureTest, textureMovedToNewManager) EXPECT_TRUE(texture->canAcquireBackingTexture()); EXPECT_TRUE(texture->haveBackingTexture()); - DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(&m_proxy); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManagerTwo->clearAllMemory(resourceProvider()); } @@ -467,7 +464,7 @@ TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootSur 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 @@ TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLate 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 @@ TEST_F(PrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvail 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 @@ TEST_F(PrioritizedTextureTest, requestLateBackingsSorting) 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 @@ TEST_F(PrioritizedTextureTest, clearUploadsToEvictedResources) 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 @@ TEST_F(PrioritizedTextureTest, usageStatistics) // 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 @@ TEST_F(PrioritizedTextureTest, usageStatistics) // 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 @@ TEST_F(PrioritizedTextureTest, usageStatistics) // 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()); } |