Changeset 106243 in webkit
- Timestamp:
- Jan 30, 2012 7:24:22 AM (12 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r106223 r106243 1 2012-01-30 Jochen Eisinger <jochen@chromium.org> 2 3 [chromium] remove exit time destructors from TextureManagerTest 4 https://bugs.webkit.org/show_bug.cgi?id=77333 5 6 Reviewed by Tony Gentilcore. 7 8 Non-trivial, global objects require an at-exit time destructor which add 9 unnecessary complexity and delays to shutdown. 10 11 * tests/FakeCCLayerTreeHostClient.h: added newline at EOF 12 * tests/TextureManagerTest.cpp: 13 (WTF::FakeTextureAllocator::~FakeTextureAllocator): 14 (TextureManagerTest): 15 (WTF::TextureManagerTest::TextureManagerTest): 16 (WTF::TextureManagerTest::~TextureManagerTest): 17 (WTF::TextureManagerTest::texturesMemorySize): 18 (WTF::TextureManagerTest::createTextureManager): 19 (WTF::TextureManagerTest::requestTexture): 20 (WTF::TEST_F): 21 1 22 2012-01-30 Hans Wennborg <hans@chromium.org> 2 23 -
trunk/Source/WebKit/chromium/tests/TextureManagerTest.cpp
r104474 r106243 36 36 class FakeTextureAllocator : public TextureAllocator { 37 37 public: 38 virtual ~FakeTextureAllocator() { } 38 39 virtual unsigned createTexture(const IntSize&, GC3Denum) { return 1; } 39 40 virtual void deleteTexture(unsigned, const IntSize&, GC3Denum) { } 40 41 }; 41 42 42 FakeTextureAllocator fakeTextureAllocator; 43 const IntSize textureSize(256, 256); 44 const GC3Denum textureFormat = GraphicsContext3D::RGBA; 45 46 size_t texturesMemorySize(size_t textureCount) 47 { 48 return TextureManager::memoryUseBytes(textureSize, textureFormat) * textureCount; 49 } 50 51 PassOwnPtr<TextureManager> createTextureManager(size_t maxTextures, size_t preferredTextures) 52 { 53 return TextureManager::create(texturesMemorySize(maxTextures), texturesMemorySize(preferredTextures), 1024); 54 } 55 56 bool requestTexture(TextureManager* manager, TextureToken token) 57 { 58 unsigned textureId; 59 bool result = manager->requestTexture(token, textureSize, textureFormat, textureId); 60 if (result) 61 manager->allocateTexture(&fakeTextureAllocator, token); 62 return result; 63 } 64 65 TEST(TextureManagerTest, requestTextureInPreferredLimit) 43 class TextureManagerTest : public testing::Test { 44 public: 45 TextureManagerTest() 46 : m_textureSize(256, 256) 47 , m_textureFormat(GraphicsContext3D::RGBA) 48 { 49 } 50 51 virtual ~TextureManagerTest() 52 { 53 } 54 55 size_t texturesMemorySize(size_t textureCount) 56 { 57 return TextureManager::memoryUseBytes(m_textureSize, m_textureFormat) * textureCount; 58 } 59 60 PassOwnPtr<TextureManager> createTextureManager(size_t maxTextures, size_t preferredTextures) 61 { 62 return TextureManager::create(texturesMemorySize(maxTextures), texturesMemorySize(preferredTextures), 1024); 63 } 64 65 bool requestTexture(TextureManager* manager, TextureToken token) 66 { 67 unsigned textureId; 68 bool result = manager->requestTexture(token, m_textureSize, m_textureFormat, textureId); 69 if (result) 70 manager->allocateTexture(&m_fakeTextureAllocator, token); 71 return result; 72 } 73 74 private: 75 FakeTextureAllocator m_fakeTextureAllocator; 76 const IntSize m_textureSize; 77 const GC3Denum m_textureFormat; 78 }; 79 80 TEST_F(TextureManagerTest, requestTextureInPreferredLimit) 66 81 { 67 82 const size_t preferredTextures = 8; … … 83 98 } 84 99 85 TEST (TextureManagerTest, requestTextureExceedingPreferredLimit)100 TEST_F(TextureManagerTest, requestTextureExceedingPreferredLimit) 86 101 { 87 102 const size_t maxTextures = 8; … … 115 130 } 116 131 117 TEST (TextureManagerTest, requestTextureExceedingMaxLimit)132 TEST_F(TextureManagerTest, requestTextureExceedingMaxLimit) 118 133 { 119 134 const size_t maxTextures = 8; … … 147 162 } 148 163 149 TEST (TextureManagerTest, reduceMemoryToLimit)164 TEST_F(TextureManagerTest, reduceMemoryToLimit) 150 165 { 151 166 const size_t maxTextures = 8; … … 180 195 } 181 196 182 TEST (TextureManagerTest, setMaxMemoryLimitBytes)197 TEST_F(TextureManagerTest, setMaxMemoryLimitBytes) 183 198 { 184 199 const size_t maxTextures = 8; … … 204 219 } 205 220 206 TEST (TextureManagerTest, setPreferredMemoryLimitBytes)221 TEST_F(TextureManagerTest, setPreferredMemoryLimitBytes) 207 222 { 208 223 const size_t maxTextures = 8;
Note: See TracChangeset
for help on using the changeset viewer.