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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/prioritized_texture.h" | 7 #include "cc/prioritized_texture.h" |
8 | 8 |
9 #include "cc/prioritized_texture_manager.h" | 9 #include "cc/prioritized_texture_manager.h" |
10 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread | 10 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
11 #include "cc/test/fake_graphics_context.h" | 11 #include "cc/test/fake_graphics_context.h" |
| 12 #include "cc/test/fake_proxy.h" |
12 #include "cc/test/tiled_layer_test_common.h" | 13 #include "cc/test/tiled_layer_test_common.h" |
13 #include "cc/test/web_compositor_initializer.h" | 14 #include "cc/test/web_compositor_initializer.h" |
14 #include "cc/texture.h" | 15 #include "cc/texture.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 using namespace cc; | 18 using namespace cc; |
18 using namespace WebKitTests; | 19 using namespace WebKitTests; |
19 | 20 |
20 namespace cc { | 21 namespace cc { |
21 | 22 |
22 class PrioritizedTextureTest : public testing::Test { | 23 class PrioritizedTextureTest : public testing::Test { |
23 public: | 24 public: |
24 PrioritizedTextureTest() | 25 PrioritizedTextureTest() |
25 : m_textureSize(256, 256) | 26 : m_proxy(0) |
| 27 , m_textureSize(256, 256) |
26 , m_textureFormat(GL_RGBA) | 28 , m_textureFormat(GL_RGBA) |
27 , m_compositorInitializer(0) | 29 , m_compositorInitializer(0) |
28 , m_context(WebKit::createFakeGraphicsContext()) | 30 , m_context(WebKit::createFakeGraphicsContext()) |
29 { | 31 { |
30 DebugScopedSetImplThread implThread; | 32 DebugScopedSetImplThread implThread(&m_proxy); |
31 m_resourceProvider = ResourceProvider::create(m_context.get()); | 33 m_resourceProvider = ResourceProvider::create(m_context.get()); |
32 } | 34 } |
33 | 35 |
34 virtual ~PrioritizedTextureTest() | 36 virtual ~PrioritizedTextureTest() |
35 { | 37 { |
36 DebugScopedSetImplThread implThread; | 38 DebugScopedSetImplThread implThread(&m_proxy); |
37 m_resourceProvider.reset(); | 39 m_resourceProvider.reset(); |
38 } | 40 } |
39 | 41 |
40 size_t texturesMemorySize(size_t textureCount) | 42 size_t texturesMemorySize(size_t textureCount) |
41 { | 43 { |
42 return Texture::memorySizeBytes(m_textureSize, m_textureFormat) * textur
eCount; | 44 return Texture::memorySizeBytes(m_textureSize, m_textureFormat) * textur
eCount; |
43 } | 45 } |
44 | 46 |
45 scoped_ptr<PrioritizedTextureManager> createManager(size_t maxTextures) | 47 scoped_ptr<PrioritizedTextureManager> createManager(size_t maxTextures) |
46 { | 48 { |
47 return PrioritizedTextureManager::create(texturesMemorySize(maxTextures)
, 1024, 0); | 49 return PrioritizedTextureManager::create(texturesMemorySize(maxTextures)
, 1024, 0, &m_proxy); |
48 } | 50 } |
49 | 51 |
50 bool validateTexture(scoped_ptr<PrioritizedTexture>& texture, bool requestLa
te) | 52 bool validateTexture(scoped_ptr<PrioritizedTexture>& texture, bool requestLa
te) |
51 { | 53 { |
52 textureManagerAssertInvariants(texture->textureManager()); | 54 textureManagerAssertInvariants(texture->textureManager()); |
53 if (requestLate) | 55 if (requestLate) |
54 texture->requestLate(); | 56 texture->requestLate(); |
55 textureManagerAssertInvariants(texture->textureManager()); | 57 textureManagerAssertInvariants(texture->textureManager()); |
56 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 58 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
57 bool success = texture->canAcquireBackingTexture(); | 59 bool success = texture->canAcquireBackingTexture(); |
58 if (success) | 60 if (success) |
59 texture->acquireBackingTexture(resourceProvider()); | 61 texture->acquireBackingTexture(resourceProvider()); |
60 return success; | 62 return success; |
61 } | 63 } |
62 | 64 |
63 void prioritizeTexturesAndBackings(PrioritizedTextureManager* textureManager
) | 65 void prioritizeTexturesAndBackings(PrioritizedTextureManager* textureManager
) |
64 { | 66 { |
65 textureManager->prioritizeTextures(); | 67 textureManager->prioritizeTextures(); |
66 textureManagerUpdateBackingsPriorities(textureManager); | 68 textureManagerUpdateBackingsPriorities(textureManager); |
67 } | 69 } |
68 | 70 |
69 void textureManagerUpdateBackingsPriorities(PrioritizedTextureManager* textu
reManager) | 71 void textureManagerUpdateBackingsPriorities(PrioritizedTextureManager* textu
reManager) |
70 { | 72 { |
71 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 73 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
72 textureManager->pushTexturePrioritiesToBackings(); | 74 textureManager->pushTexturePrioritiesToBackings(); |
73 } | 75 } |
74 | 76 |
75 ResourceProvider* resourceProvider() | 77 ResourceProvider* resourceProvider() |
76 { | 78 { |
77 return m_resourceProvider.get(); | 79 return m_resourceProvider.get(); |
78 } | 80 } |
79 | 81 |
80 void textureManagerAssertInvariants(PrioritizedTextureManager* textureManage
r) | 82 void textureManagerAssertInvariants(PrioritizedTextureManager* textureManage
r) |
81 { | 83 { |
82 #ifndef NDEBUG | 84 #ifndef NDEBUG |
83 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 85 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
84 textureManager->assertInvariants(); | 86 textureManager->assertInvariants(); |
85 #endif | 87 #endif |
86 } | 88 } |
87 | 89 |
88 bool textureBackingIsAbovePriorityCutoff(PrioritizedTexture* texture) | 90 bool textureBackingIsAbovePriorityCutoff(PrioritizedTexture* texture) |
89 { | 91 { |
90 return texture->m_backing->wasAbovePriorityCutoffAtLastPriorityUpdate(); | 92 return texture->m_backing->wasAbovePriorityCutoffAtLastPriorityUpdate(); |
91 } | 93 } |
92 | 94 |
93 protected: | 95 protected: |
| 96 FakeProxy m_proxy; |
94 const IntSize m_textureSize; | 97 const IntSize m_textureSize; |
95 const GLenum m_textureFormat; | 98 const GLenum m_textureFormat; |
96 WebCompositorInitializer m_compositorInitializer; | 99 WebCompositorInitializer m_compositorInitializer; |
97 scoped_ptr<GraphicsContext> m_context; | 100 scoped_ptr<GraphicsContext> m_context; |
98 scoped_ptr<ResourceProvider> m_resourceProvider; | 101 scoped_ptr<ResourceProvider> m_resourceProvider; |
99 }; | 102 }; |
100 | 103 |
101 } | 104 } |
102 | 105 |
103 namespace { | 106 namespace { |
(...skipping 27 matching lines...) Expand all Loading... |
131 // Only upper half should be available. | 134 // Only upper half should be available. |
132 prioritizeTexturesAndBackings(textureManager.get()); | 135 prioritizeTexturesAndBackings(textureManager.get()); |
133 EXPECT_FALSE(validateTexture(textures[0], false)); | 136 EXPECT_FALSE(validateTexture(textures[0], false)); |
134 EXPECT_FALSE(validateTexture(textures[7], false)); | 137 EXPECT_FALSE(validateTexture(textures[7], false)); |
135 EXPECT_TRUE(validateTexture(textures[8], false)); | 138 EXPECT_TRUE(validateTexture(textures[8], false)); |
136 EXPECT_TRUE(validateTexture(textures[15], false)); | 139 EXPECT_TRUE(validateTexture(textures[15], false)); |
137 | 140 |
138 EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->memoryAboveCutoff
Bytes()); | 141 EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->memoryAboveCutoff
Bytes()); |
139 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); | 142 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); |
140 | 143 |
141 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 144 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
142 textureManager->clearAllMemory(resourceProvider()); | 145 textureManager->clearAllMemory(resourceProvider()); |
143 } | 146 } |
144 | 147 |
145 TEST_F(PrioritizedTextureTest, changeMemoryLimits) | 148 TEST_F(PrioritizedTextureTest, changeMemoryLimits) |
146 { | 149 { |
147 const size_t maxTextures = 8; | 150 const size_t maxTextures = 8; |
148 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); | 151 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); |
149 scoped_ptr<PrioritizedTexture> textures[maxTextures]; | 152 scoped_ptr<PrioritizedTexture> textures[maxTextures]; |
150 | 153 |
151 for (size_t i = 0; i < maxTextures; ++i) | 154 for (size_t i = 0; i < maxTextures; ++i) |
152 textures[i] = textureManager->createTexture(m_textureSize, m_textureForm
at); | 155 textures[i] = textureManager->createTexture(m_textureSize, m_textureForm
at); |
153 for (size_t i = 0; i < maxTextures; ++i) | 156 for (size_t i = 0; i < maxTextures; ++i) |
154 textures[i]->setRequestPriority(100 + i); | 157 textures[i]->setRequestPriority(100 + i); |
155 | 158 |
156 // Set max limit to 8 textures | 159 // Set max limit to 8 textures |
157 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); | 160 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); |
158 prioritizeTexturesAndBackings(textureManager.get()); | 161 prioritizeTexturesAndBackings(textureManager.get()); |
159 for (size_t i = 0; i < maxTextures; ++i) | 162 for (size_t i = 0; i < maxTextures; ++i) |
160 validateTexture(textures[i], false); | 163 validateTexture(textures[i], false); |
161 { | 164 { |
162 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 165 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
163 textureManager->reduceMemory(resourceProvider()); | 166 textureManager->reduceMemory(resourceProvider()); |
164 } | 167 } |
165 | 168 |
166 EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes()); | 169 EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes()); |
167 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); | 170 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); |
168 | 171 |
169 // Set max limit to 5 textures | 172 // Set max limit to 5 textures |
170 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(5)); | 173 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(5)); |
171 prioritizeTexturesAndBackings(textureManager.get()); | 174 prioritizeTexturesAndBackings(textureManager.get()); |
172 for (size_t i = 0; i < maxTextures; ++i) | 175 for (size_t i = 0; i < maxTextures; ++i) |
173 EXPECT_EQ(validateTexture(textures[i], false), i < 5); | 176 EXPECT_EQ(validateTexture(textures[i], false), i < 5); |
174 { | 177 { |
175 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 178 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
176 textureManager->reduceMemory(resourceProvider()); | 179 textureManager->reduceMemory(resourceProvider()); |
177 } | 180 } |
178 | 181 |
179 EXPECT_EQ(texturesMemorySize(5), textureManager->memoryAboveCutoffBytes()); | 182 EXPECT_EQ(texturesMemorySize(5), textureManager->memoryAboveCutoffBytes()); |
180 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); | 183 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); |
181 | 184 |
182 // Set max limit to 4 textures | 185 // Set max limit to 4 textures |
183 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(4)); | 186 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(4)); |
184 prioritizeTexturesAndBackings(textureManager.get()); | 187 prioritizeTexturesAndBackings(textureManager.get()); |
185 for (size_t i = 0; i < maxTextures; ++i) | 188 for (size_t i = 0; i < maxTextures; ++i) |
186 EXPECT_EQ(validateTexture(textures[i], false), i < 4); | 189 EXPECT_EQ(validateTexture(textures[i], false), i < 4); |
187 { | 190 { |
188 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 191 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
189 textureManager->reduceMemory(resourceProvider()); | 192 textureManager->reduceMemory(resourceProvider()); |
190 } | 193 } |
191 | 194 |
192 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); | 195 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); |
193 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); | 196 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); |
194 | 197 |
195 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 198 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
196 textureManager->clearAllMemory(resourceProvider()); | 199 textureManager->clearAllMemory(resourceProvider()); |
197 } | 200 } |
198 | 201 |
199 TEST_F(PrioritizedTextureTest, changePriorityCutoff) | 202 TEST_F(PrioritizedTextureTest, changePriorityCutoff) |
200 { | 203 { |
201 const size_t maxTextures = 8; | 204 const size_t maxTextures = 8; |
202 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); | 205 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); |
203 scoped_ptr<PrioritizedTexture> textures[maxTextures]; | 206 scoped_ptr<PrioritizedTexture> textures[maxTextures]; |
204 | 207 |
205 for (size_t i = 0; i < maxTextures; ++i) | 208 for (size_t i = 0; i < maxTextures; ++i) |
206 textures[i] = textureManager->createTexture(m_textureSize, m_textureForm
at); | 209 textures[i] = textureManager->createTexture(m_textureSize, m_textureForm
at); |
207 for (size_t i = 0; i < maxTextures; ++i) | 210 for (size_t i = 0; i < maxTextures; ++i) |
208 textures[i]->setRequestPriority(100 + i); | 211 textures[i]->setRequestPriority(100 + i); |
209 | 212 |
210 // Set the cutoff to drop two textures. Try to requestLate on all textures,
and | 213 // Set the cutoff to drop two textures. Try to requestLate on all textures,
and |
211 // make sure that requestLate doesn't work on a texture with equal priority
to | 214 // make sure that requestLate doesn't work on a texture with equal priority
to |
212 // the cutoff. | 215 // the cutoff. |
213 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); | 216 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); |
214 textureManager->setExternalPriorityCutoff(106); | 217 textureManager->setExternalPriorityCutoff(106); |
215 prioritizeTexturesAndBackings(textureManager.get()); | 218 prioritizeTexturesAndBackings(textureManager.get()); |
216 for (size_t i = 0; i < maxTextures; ++i) | 219 for (size_t i = 0; i < maxTextures; ++i) |
217 EXPECT_EQ(validateTexture(textures[i], true), i < 6); | 220 EXPECT_EQ(validateTexture(textures[i], true), i < 6); |
218 { | 221 { |
219 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 222 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
220 textureManager->reduceMemory(resourceProvider()); | 223 textureManager->reduceMemory(resourceProvider()); |
221 } | 224 } |
222 EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes()); | 225 EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes()); |
223 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); | 226 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); |
224 | 227 |
225 // Set the cutoff to drop two more textures. | 228 // Set the cutoff to drop two more textures. |
226 textureManager->setExternalPriorityCutoff(104); | 229 textureManager->setExternalPriorityCutoff(104); |
227 prioritizeTexturesAndBackings(textureManager.get()); | 230 prioritizeTexturesAndBackings(textureManager.get()); |
228 for (size_t i = 0; i < maxTextures; ++i) | 231 for (size_t i = 0; i < maxTextures; ++i) |
229 EXPECT_EQ(validateTexture(textures[i], false), i < 4); | 232 EXPECT_EQ(validateTexture(textures[i], false), i < 4); |
230 { | 233 { |
231 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 234 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
232 textureManager->reduceMemory(resourceProvider()); | 235 textureManager->reduceMemory(resourceProvider()); |
233 } | 236 } |
234 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); | 237 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); |
235 | 238 |
236 // Do a one-time eviction for one more texture based on priority cutoff | 239 // Do a one-time eviction for one more texture based on priority cutoff |
237 PrioritizedTextureManager::BackingList evictedBackings; | 240 PrioritizedTextureManager::BackingList evictedBackings; |
238 { | 241 { |
239 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 242 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
240 textureManager->reduceMemoryOnImplThread(texturesMemorySize(8), 104, res
ourceProvider()); | 243 textureManager->reduceMemoryOnImplThread(texturesMemorySize(8), 104, res
ourceProvider()); |
241 textureManager->getEvictedBackings(evictedBackings); | 244 textureManager->getEvictedBackings(evictedBackings); |
242 EXPECT_EQ(0, evictedBackings.size()); | 245 EXPECT_EQ(0, evictedBackings.size()); |
243 textureManager->reduceMemoryOnImplThread(texturesMemorySize(8), 103, res
ourceProvider()); | 246 textureManager->reduceMemoryOnImplThread(texturesMemorySize(8), 103, res
ourceProvider()); |
244 textureManager->getEvictedBackings(evictedBackings); | 247 textureManager->getEvictedBackings(evictedBackings); |
245 EXPECT_EQ(1, evictedBackings.size()); | 248 EXPECT_EQ(1, evictedBackings.size()); |
246 } | 249 } |
247 textureManager->unlinkEvictedBackings(evictedBackings); | 250 textureManager->unlinkEvictedBackings(evictedBackings); |
248 EXPECT_EQ(texturesMemorySize(3), textureManager->memoryUseBytes()); | 251 EXPECT_EQ(texturesMemorySize(3), textureManager->memoryUseBytes()); |
249 | 252 |
250 // Re-allocate the the texture after the one-time drop. | 253 // Re-allocate the the texture after the one-time drop. |
251 prioritizeTexturesAndBackings(textureManager.get()); | 254 prioritizeTexturesAndBackings(textureManager.get()); |
252 for (size_t i = 0; i < maxTextures; ++i) | 255 for (size_t i = 0; i < maxTextures; ++i) |
253 EXPECT_EQ(validateTexture(textures[i], false), i < 4); | 256 EXPECT_EQ(validateTexture(textures[i], false), i < 4); |
254 { | 257 { |
255 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 258 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
256 textureManager->reduceMemory(resourceProvider()); | 259 textureManager->reduceMemory(resourceProvider()); |
257 } | 260 } |
258 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); | 261 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); |
259 | 262 |
260 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 263 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
261 textureManager->clearAllMemory(resourceProvider()); | 264 textureManager->clearAllMemory(resourceProvider()); |
262 } | 265 } |
263 | 266 |
264 TEST_F(PrioritizedTextureTest, textureManagerPartialUpdateTextures) | 267 TEST_F(PrioritizedTextureTest, textureManagerPartialUpdateTextures) |
265 { | 268 { |
266 const size_t maxTextures = 4; | 269 const size_t maxTextures = 4; |
267 const size_t numTextures = 4; | 270 const size_t numTextures = 4; |
268 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); | 271 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); |
269 scoped_ptr<PrioritizedTexture> textures[numTextures]; | 272 scoped_ptr<PrioritizedTexture> textures[numTextures]; |
270 scoped_ptr<PrioritizedTexture> moreTextures[numTextures]; | 273 scoped_ptr<PrioritizedTexture> moreTextures[numTextures]; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 EXPECT_TRUE(validateTexture(moreTextures[1], false)); | 313 EXPECT_TRUE(validateTexture(moreTextures[1], false)); |
311 EXPECT_TRUE(validateTexture(moreTextures[2], false)); | 314 EXPECT_TRUE(validateTexture(moreTextures[2], false)); |
312 EXPECT_TRUE(validateTexture(moreTextures[3], false)); | 315 EXPECT_TRUE(validateTexture(moreTextures[3], false)); |
313 | 316 |
314 // Lower priority have been fully evicted. | 317 // Lower priority have been fully evicted. |
315 EXPECT_FALSE(textures[0]->haveBackingTexture()); | 318 EXPECT_FALSE(textures[0]->haveBackingTexture()); |
316 EXPECT_FALSE(textures[1]->haveBackingTexture()); | 319 EXPECT_FALSE(textures[1]->haveBackingTexture()); |
317 EXPECT_FALSE(textures[2]->haveBackingTexture()); | 320 EXPECT_FALSE(textures[2]->haveBackingTexture()); |
318 EXPECT_FALSE(textures[3]->haveBackingTexture()); | 321 EXPECT_FALSE(textures[3]->haveBackingTexture()); |
319 | 322 |
320 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 323 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
321 textureManager->clearAllMemory(resourceProvider()); | 324 textureManager->clearAllMemory(resourceProvider()); |
322 } | 325 } |
323 | 326 |
324 TEST_F(PrioritizedTextureTest, textureManagerPrioritiesAreEqual) | 327 TEST_F(PrioritizedTextureTest, textureManagerPrioritiesAreEqual) |
325 { | 328 { |
326 const size_t maxTextures = 16; | 329 const size_t maxTextures = 16; |
327 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); | 330 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); |
328 scoped_ptr<PrioritizedTexture> textures[maxTextures]; | 331 scoped_ptr<PrioritizedTexture> textures[maxTextures]; |
329 | 332 |
330 for (size_t i = 0; i < maxTextures; ++i) | 333 for (size_t i = 0; i < maxTextures; ++i) |
(...skipping 19 matching lines...) Expand all Loading... |
350 | 353 |
351 // Manually reserving textures should only succeed on the higher priority te
xtures, | 354 // Manually reserving textures should only succeed on the higher priority te
xtures, |
352 // and on remaining textures up to the memory limit. | 355 // and on remaining textures up to the memory limit. |
353 for (size_t i = 0; i < 8; i++) | 356 for (size_t i = 0; i < 8; i++) |
354 EXPECT_TRUE(validateTexture(textures[i], true)); | 357 EXPECT_TRUE(validateTexture(textures[i], true)); |
355 for (size_t i = 9; i < maxTextures; i++) | 358 for (size_t i = 9; i < maxTextures; i++) |
356 EXPECT_FALSE(validateTexture(textures[i], true)); | 359 EXPECT_FALSE(validateTexture(textures[i], true)); |
357 EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes()); | 360 EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes()); |
358 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); | 361 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); |
359 | 362 |
360 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 363 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
361 textureManager->clearAllMemory(resourceProvider()); | 364 textureManager->clearAllMemory(resourceProvider()); |
362 } | 365 } |
363 | 366 |
364 TEST_F(PrioritizedTextureTest, textureManagerDestroyedFirst) | 367 TEST_F(PrioritizedTextureTest, textureManagerDestroyedFirst) |
365 { | 368 { |
366 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(1); | 369 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(1); |
367 scoped_ptr<PrioritizedTexture> texture = textureManager->createTexture(m_tex
tureSize, m_textureFormat); | 370 scoped_ptr<PrioritizedTexture> texture = textureManager->createTexture(m_tex
tureSize, m_textureFormat); |
368 | 371 |
369 // Texture is initially invalid, but it will become available. | 372 // Texture is initially invalid, but it will become available. |
370 EXPECT_FALSE(texture->haveBackingTexture()); | 373 EXPECT_FALSE(texture->haveBackingTexture()); |
371 | 374 |
372 texture->setRequestPriority(100); | 375 texture->setRequestPriority(100); |
373 prioritizeTexturesAndBackings(textureManager.get()); | 376 prioritizeTexturesAndBackings(textureManager.get()); |
374 | 377 |
375 EXPECT_TRUE(validateTexture(texture, false)); | 378 EXPECT_TRUE(validateTexture(texture, false)); |
376 EXPECT_TRUE(texture->canAcquireBackingTexture()); | 379 EXPECT_TRUE(texture->canAcquireBackingTexture()); |
377 EXPECT_TRUE(texture->haveBackingTexture()); | 380 EXPECT_TRUE(texture->haveBackingTexture()); |
378 | 381 |
379 { | 382 { |
380 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 383 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
381 textureManager->clearAllMemory(resourceProvider()); | 384 textureManager->clearAllMemory(resourceProvider()); |
382 } | 385 } |
383 textureManager.reset(); | 386 textureManager.reset(); |
384 | 387 |
385 EXPECT_FALSE(texture->canAcquireBackingTexture()); | 388 EXPECT_FALSE(texture->canAcquireBackingTexture()); |
386 EXPECT_FALSE(texture->haveBackingTexture()); | 389 EXPECT_FALSE(texture->haveBackingTexture()); |
387 } | 390 } |
388 | 391 |
389 TEST_F(PrioritizedTextureTest, textureMovedToNewManager) | 392 TEST_F(PrioritizedTextureTest, textureMovedToNewManager) |
390 { | 393 { |
391 scoped_ptr<PrioritizedTextureManager> textureManagerOne = createManager(1); | 394 scoped_ptr<PrioritizedTextureManager> textureManagerOne = createManager(1); |
392 scoped_ptr<PrioritizedTextureManager> textureManagerTwo = createManager(1); | 395 scoped_ptr<PrioritizedTextureManager> textureManagerTwo = createManager(1); |
393 scoped_ptr<PrioritizedTexture> texture = textureManagerOne->createTexture(m_
textureSize, m_textureFormat); | 396 scoped_ptr<PrioritizedTexture> texture = textureManagerOne->createTexture(m_
textureSize, m_textureFormat); |
394 | 397 |
395 // Texture is initially invalid, but it will become available. | 398 // Texture is initially invalid, but it will become available. |
396 EXPECT_FALSE(texture->haveBackingTexture()); | 399 EXPECT_FALSE(texture->haveBackingTexture()); |
397 | 400 |
398 texture->setRequestPriority(100); | 401 texture->setRequestPriority(100); |
399 prioritizeTexturesAndBackings(textureManagerOne.get()); | 402 prioritizeTexturesAndBackings(textureManagerOne.get()); |
400 | 403 |
401 EXPECT_TRUE(validateTexture(texture, false)); | 404 EXPECT_TRUE(validateTexture(texture, false)); |
402 EXPECT_TRUE(texture->canAcquireBackingTexture()); | 405 EXPECT_TRUE(texture->canAcquireBackingTexture()); |
403 EXPECT_TRUE(texture->haveBackingTexture()); | 406 EXPECT_TRUE(texture->haveBackingTexture()); |
404 | 407 |
405 texture->setTextureManager(0); | 408 texture->setTextureManager(0); |
406 | 409 |
407 { | 410 { |
408 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked; | 411 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(&m_proxy); |
409 textureManagerOne->clearAllMemory(resourceProvider()); | 412 textureManagerOne->clearAllMemory(resourceProvider()); |
410 } | 413 } |
411 textureManagerOne.reset(); | 414 textureManagerOne.reset(); |
412 | 415 |
413 EXPECT_FALSE(texture->canAcquireBackingTexture()); | 416 EXPECT_FALSE(texture->canAcquireBackingTexture()); |
414 EXPECT_FALSE(texture->haveBackingTexture()); | 417 EXPECT_FALSE(texture->haveBackingTexture()); |
415 | 418 |
416 texture->setTextureManager(textureManagerTwo.get()); | 419 texture->setTextureManager(textureManagerTwo.get()); |
417 | 420 |
418 prioritizeTexturesAndBackings(textureManagerTwo.get()); | 421 prioritizeTexturesAndBackings(textureManagerTwo.get()); |
419 | 422 |
420 EXPECT_TRUE(validateTexture(texture, false)); | 423 EXPECT_TRUE(validateTexture(texture, false)); |
421 EXPECT_TRUE(texture->canAcquireBackingTexture()); | 424 EXPECT_TRUE(texture->canAcquireBackingTexture()); |
422 EXPECT_TRUE(texture->haveBackingTexture()); | 425 EXPECT_TRUE(texture->haveBackingTexture()); |
423 | 426 |
424 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 427 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
425 textureManagerTwo->clearAllMemory(resourceProvider()); | 428 textureManagerTwo->clearAllMemory(resourceProvider()); |
426 } | 429 } |
427 | 430 |
428 TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootSur
face) | 431 TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootSur
face) |
429 { | 432 { |
430 const size_t maxTextures = 8; | 433 const size_t maxTextures = 8; |
431 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); | 434 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); |
432 | 435 |
433 // Half of the memory is taken by surfaces (with high priority place-holder) | 436 // Half of the memory is taken by surfaces (with high priority place-holder) |
434 scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->cr
eateTexture(m_textureSize, m_textureFormat); | 437 scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->cr
eateTexture(m_textureSize, m_textureFormat); |
(...skipping 25 matching lines...) Expand all Loading... |
460 prioritizeTexturesAndBackings(textureManager.get()); | 463 prioritizeTexturesAndBackings(textureManager.get()); |
461 EXPECT_FALSE(validateTexture(textures[0], false)); | 464 EXPECT_FALSE(validateTexture(textures[0], false)); |
462 EXPECT_FALSE(validateTexture(textures[3], false)); | 465 EXPECT_FALSE(validateTexture(textures[3], false)); |
463 EXPECT_TRUE(validateTexture(textures[4], false)); | 466 EXPECT_TRUE(validateTexture(textures[4], false)); |
464 EXPECT_TRUE(validateTexture(textures[7], false)); | 467 EXPECT_TRUE(validateTexture(textures[7], false)); |
465 | 468 |
466 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); | 469 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); |
467 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTexture
s()); | 470 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTexture
s()); |
468 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); | 471 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); |
469 | 472 |
470 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 473 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
471 textureManager->clearAllMemory(resourceProvider()); | 474 textureManager->clearAllMemory(resourceProvider()); |
472 } | 475 } |
473 | 476 |
474 TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLate
) | 477 TEST_F(PrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLate
) |
475 { | 478 { |
476 const size_t maxTextures = 8; | 479 const size_t maxTextures = 8; |
477 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); | 480 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); |
478 | 481 |
479 // Half of the memory is taken by surfaces (with high priority place-holder) | 482 // Half of the memory is taken by surfaces (with high priority place-holder) |
480 scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->cr
eateTexture(m_textureSize, m_textureFormat); | 483 scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->cr
eateTexture(m_textureSize, m_textureFormat); |
(...skipping 16 matching lines...) Expand all Loading... |
497 EXPECT_FALSE(validateTexture(textures[i], false)); | 500 EXPECT_FALSE(validateTexture(textures[i], false)); |
498 for (unsigned i = 0; i < maxTextures; i += 2) | 501 for (unsigned i = 0; i < maxTextures; i += 2) |
499 EXPECT_TRUE(validateTexture(textures[i], true)); | 502 EXPECT_TRUE(validateTexture(textures[i], true)); |
500 for (unsigned i = 1; i < maxTextures; i += 2) | 503 for (unsigned i = 1; i < maxTextures; i += 2) |
501 EXPECT_FALSE(validateTexture(textures[i], true)); | 504 EXPECT_FALSE(validateTexture(textures[i], true)); |
502 | 505 |
503 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); | 506 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); |
504 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTexture
s()); | 507 EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTexture
s()); |
505 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); | 508 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); |
506 | 509 |
507 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 510 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
508 textureManager->clearAllMemory(resourceProvider()); | 511 textureManager->clearAllMemory(resourceProvider()); |
509 } | 512 } |
510 | 513 |
511 TEST_F(PrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvail
able) | 514 TEST_F(PrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAvail
able) |
512 { | 515 { |
513 const size_t maxTextures = 8; | 516 const size_t maxTextures = 8; |
514 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); | 517 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); |
515 | 518 |
516 // Half of the memory is taken by surfaces (with high priority place-holder) | 519 // Half of the memory is taken by surfaces (with high priority place-holder) |
517 scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->cr
eateTexture(m_textureSize, m_textureFormat); | 520 scoped_ptr<PrioritizedTexture> renderSurfacePlaceHolder = textureManager->cr
eateTexture(m_textureSize, m_textureFormat); |
(...skipping 19 matching lines...) Expand all Loading... |
537 EXPECT_FALSE(validateTexture(textures[7], true)); | 540 EXPECT_FALSE(validateTexture(textures[7], true)); |
538 | 541 |
539 // Root surface textures are valid. | 542 // Root surface textures are valid. |
540 for (size_t i = 0; i < 6; ++i) | 543 for (size_t i = 0; i < 6; ++i) |
541 EXPECT_TRUE(validateTexture(textures[i], false)); | 544 EXPECT_TRUE(validateTexture(textures[i], false)); |
542 | 545 |
543 EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes()); | 546 EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes()); |
544 EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTexture
s()); | 547 EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTexture
s()); |
545 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); | 548 EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutof
fBytes()); |
546 | 549 |
547 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 550 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
548 textureManager->clearAllMemory(resourceProvider()); | 551 textureManager->clearAllMemory(resourceProvider()); |
549 } | 552 } |
550 | 553 |
551 TEST_F(PrioritizedTextureTest, requestLateBackingsSorting) | 554 TEST_F(PrioritizedTextureTest, requestLateBackingsSorting) |
552 { | 555 { |
553 const size_t maxTextures = 8; | 556 const size_t maxTextures = 8; |
554 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); | 557 scoped_ptr<PrioritizedTextureManager> textureManager = createManager(maxText
ures); |
555 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); | 558 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); |
556 | 559 |
557 // Create textures to fill our memory limit. | 560 // Create textures to fill our memory limit. |
(...skipping 27 matching lines...) Expand all Loading... |
585 // Make sure that we have backings for all of the textures. | 588 // Make sure that we have backings for all of the textures. |
586 for (size_t i = 0; i < maxTextures; ++i) | 589 for (size_t i = 0; i < maxTextures; ++i) |
587 EXPECT_TRUE(textures[i]->haveBackingTexture()); | 590 EXPECT_TRUE(textures[i]->haveBackingTexture()); |
588 | 591 |
589 // Make sure that only the requestLate textures are above the priority cutof
f | 592 // Make sure that only the requestLate textures are above the priority cutof
f |
590 for (size_t i = 0; i < maxTextures; i += 2) | 593 for (size_t i = 0; i < maxTextures; i += 2) |
591 EXPECT_TRUE(textureBackingIsAbovePriorityCutoff(textures[i].get())); | 594 EXPECT_TRUE(textureBackingIsAbovePriorityCutoff(textures[i].get())); |
592 for (size_t i = 1; i < maxTextures; i += 2) | 595 for (size_t i = 1; i < maxTextures; i += 2) |
593 EXPECT_FALSE(textureBackingIsAbovePriorityCutoff(textures[i].get())); | 596 EXPECT_FALSE(textureBackingIsAbovePriorityCutoff(textures[i].get())); |
594 | 597 |
595 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 598 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
596 textureManager->clearAllMemory(resourceProvider()); | 599 textureManager->clearAllMemory(resourceProvider()); |
597 } | 600 } |
598 | 601 |
599 TEST_F(PrioritizedTextureTest, clearUploadsToEvictedResources) | 602 TEST_F(PrioritizedTextureTest, clearUploadsToEvictedResources) |
600 { | 603 { |
601 const size_t maxTextures = 4; | 604 const size_t maxTextures = 4; |
602 scoped_ptr<PrioritizedTextureManager> textureManager = | 605 scoped_ptr<PrioritizedTextureManager> textureManager = |
603 createManager(maxTextures); | 606 createManager(maxTextures); |
604 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); | 607 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); |
605 | 608 |
606 // Create textures to fill our memory limit. | 609 // Create textures to fill our memory limit. |
607 scoped_ptr<PrioritizedTexture> textures[maxTextures]; | 610 scoped_ptr<PrioritizedTexture> textures[maxTextures]; |
608 | 611 |
609 for (size_t i = 0; i < maxTextures; ++i) | 612 for (size_t i = 0; i < maxTextures; ++i) |
610 textures[i] = textureManager->createTexture(m_textureSize, m_textureForm
at); | 613 textures[i] = textureManager->createTexture(m_textureSize, m_textureForm
at); |
611 | 614 |
612 // Set equal priorities, and allocate backings for all textures. | 615 // Set equal priorities, and allocate backings for all textures. |
613 for (size_t i = 0; i < maxTextures; ++i) | 616 for (size_t i = 0; i < maxTextures; ++i) |
614 textures[i]->setRequestPriority(100); | 617 textures[i]->setRequestPriority(100); |
615 prioritizeTexturesAndBackings(textureManager.get()); | 618 prioritizeTexturesAndBackings(textureManager.get()); |
616 for (unsigned i = 0; i < maxTextures; ++i) | 619 for (unsigned i = 0; i < maxTextures; ++i) |
617 EXPECT_TRUE(validateTexture(textures[i], false)); | 620 EXPECT_TRUE(validateTexture(textures[i], false)); |
618 | 621 |
619 TextureUpdateQueue queue; | 622 TextureUpdateQueue queue; |
620 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; | 623 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
621 for (size_t i = 0; i < maxTextures; ++i) { | 624 for (size_t i = 0; i < maxTextures; ++i) { |
622 const ResourceUpdate upload = ResourceUpdate::Create( | 625 const ResourceUpdate upload = ResourceUpdate::Create( |
623 textures[i].get(), NULL, IntRect(), IntRect(), IntSize()); | 626 textures[i].get(), NULL, IntRect(), IntRect(), IntSize()); |
624 queue.appendFullUpload(upload); | 627 queue.appendFullUpload(upload); |
625 } | 628 } |
626 | 629 |
627 // Make sure that we have backings for all of the textures. | 630 // Make sure that we have backings for all of the textures. |
628 for (size_t i = 0; i < maxTextures; ++i) | 631 for (size_t i = 0; i < maxTextures; ++i) |
629 EXPECT_TRUE(textures[i]->haveBackingTexture()); | 632 EXPECT_TRUE(textures[i]->haveBackingTexture()); |
630 | 633 |
631 queue.clearUploadsToEvictedResources(); | 634 queue.clearUploadsToEvictedResources(); |
632 EXPECT_EQ(4, queue.fullUploadSize()); | 635 EXPECT_EQ(4, queue.fullUploadSize()); |
633 | 636 |
634 textureManager->reduceMemoryOnImplThread( | 637 textureManager->reduceMemoryOnImplThread( |
635 texturesMemorySize(1), PriorityCalculator::allowEverythingCutoff(), reso
urceProvider()); | 638 texturesMemorySize(1), PriorityCalculator::allowEverythingCutoff(), reso
urceProvider()); |
636 queue.clearUploadsToEvictedResources(); | 639 queue.clearUploadsToEvictedResources(); |
637 EXPECT_EQ(1, queue.fullUploadSize()); | 640 EXPECT_EQ(1, queue.fullUploadSize()); |
638 | 641 |
639 textureManager->reduceMemoryOnImplThread(0, PriorityCalculator::allowEveryt
hingCutoff(), resourceProvider()); | 642 textureManager->reduceMemoryOnImplThread(0, PriorityCalculator::allowEveryt
hingCutoff(), resourceProvider()); |
640 queue.clearUploadsToEvictedResources(); | 643 queue.clearUploadsToEvictedResources(); |
641 EXPECT_EQ(0, queue.fullUploadSize()); | 644 EXPECT_EQ(0, queue.fullUploadSize()); |
642 | 645 |
643 } | 646 } |
644 | 647 |
645 } // namespace | 648 } // namespace |
OLD | NEW |