|
Lines 80-93
public:
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec1
|
| 80 |
, m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool)) |
80 |
, m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool)) |
| 81 |
, m_occlusion(0) |
81 |
, m_occlusion(0) |
| 82 |
{ |
82 |
{ |
| 83 |
DebugScopedSetImplThread implThread; |
83 |
WebKit::WebCompositor::initialize(0); |
|
|
84 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 84 |
m_resourceProvider = CCResourceProvider::create(m_context.get()); |
85 |
m_resourceProvider = CCResourceProvider::create(m_context.get()); |
| 85 |
} |
86 |
} |
| 86 |
|
87 |
|
| 87 |
virtual ~TiledLayerChromiumTest() |
88 |
virtual ~TiledLayerChromiumTest() |
| 88 |
{ |
89 |
{ |
| 89 |
DebugScopedSetImplThread implThread; |
90 |
{ |
| 90 |
m_resourceProvider.clear(); |
91 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
|
|
92 |
m_textureManager->clearAllMemory(m_resourceProvider.get()); |
| 93 |
m_resourceProvider.clear(); |
| 94 |
} |
| 95 |
WebKit::WebCompositor::shutdown(); |
| 91 |
} |
96 |
} |
| 92 |
|
97 |
|
| 93 |
void updateTextures(int count = 500) |
98 |
void updateTextures(int count = 500) |
|
Lines 100-118
public:
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec2
|
| 100 |
FakeTiledLayerChromium* layer2 = 0, |
105 |
FakeTiledLayerChromium* layer2 = 0, |
| 101 |
CCLayerImpl* layerImpl2 = 0) |
106 |
CCLayerImpl* layerImpl2 = 0) |
| 102 |
{ |
107 |
{ |
| 103 |
// Get textures |
108 |
{ |
| 104 |
m_textureManager->clearPriorities(); |
109 |
DebugScopedSetMainThread mainThread; |
| 105 |
if (layer1) |
110 |
|
| 106 |
layer1->setTexturePriorities(m_priorityCalculator); |
111 |
// Get textures |
| 107 |
if (layer2) |
112 |
m_textureManager->clearPriorities(); |
| 108 |
layer2->setTexturePriorities(m_priorityCalculator); |
113 |
if (layer1) |
| 109 |
m_textureManager->prioritizeTextures(); |
114 |
layer1->setTexturePriorities(m_priorityCalculator); |
| 110 |
|
115 |
if (layer2) |
| 111 |
// Update content |
116 |
layer2->setTexturePriorities(m_priorityCalculator); |
| 112 |
if (layer1) |
117 |
m_textureManager->prioritizeTextures(); |
| 113 |
layer1->update(m_queue, m_occlusion, m_stats); |
118 |
|
| 114 |
if (layer2) |
119 |
// Update content |
| 115 |
layer2->update(m_queue, m_occlusion, m_stats); |
120 |
if (layer1) |
|
|
121 |
layer1->update(m_queue, m_occlusion, m_stats); |
| 122 |
if (layer2) |
| 123 |
layer2->update(m_queue, m_occlusion, m_stats); |
| 124 |
} |
| 116 |
|
125 |
|
| 117 |
bool needsUpdate = false; |
126 |
bool needsUpdate = false; |
| 118 |
if (layer1) |
127 |
if (layer1) |
|
Lines 130-135
public:
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec3
|
| 130 |
return needsUpdate; |
139 |
return needsUpdate; |
| 131 |
} |
140 |
} |
| 132 |
|
141 |
|
|
|
142 |
void setTexturePrioritiesAndPrioritizeTexturesOnMainThread(FakeTiledLayerChromium* layer) |
| 143 |
{ |
| 144 |
DebugScopedSetMainThread mainThread; |
| 145 |
layer->setTexturePriorities(m_priorityCalculator); |
| 146 |
m_textureManager->prioritizeTextures(); |
| 147 |
} |
| 148 |
|
| 149 |
void updateLayerOnMainThread(FakeTiledLayerChromium* layer, TestCCOcclusionTracker* occluded) |
| 150 |
{ |
| 151 |
DebugScopedSetMainThread mainThread; |
| 152 |
layer->update(m_queue, occluded, m_stats); |
| 153 |
} |
| 154 |
|
| 133 |
public: |
155 |
public: |
| 134 |
OwnPtr<CCGraphicsContext> m_context; |
156 |
OwnPtr<CCGraphicsContext> m_context; |
| 135 |
OwnPtr<CCResourceProvider> m_resourceProvider; |
157 |
OwnPtr<CCResourceProvider> m_resourceProvider; |
|
Lines 142-151
public:
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec4
|
| 142 |
TestCCOcclusionTracker* m_occlusion; |
164 |
TestCCOcclusionTracker* m_occlusion; |
| 143 |
}; |
165 |
}; |
| 144 |
|
166 |
|
| 145 |
TEST_F(TiledLayerChromiumTest, pushDirtyTiles) |
167 |
class TiledLayerChromiumTestOnImplThread : public TiledLayerChromiumTest { |
|
|
168 |
public: |
| 169 |
TiledLayerChromiumTestOnImplThread() { } |
| 170 |
virtual ~TiledLayerChromiumTestOnImplThread() { } |
| 171 |
|
| 172 |
private: |
| 173 |
DebugScopedSetImplThreadAndMainThreadBlocked m_implThreadAndMainThreadBlocked; |
| 174 |
}; |
| 175 |
|
| 176 |
TEST_F(TiledLayerChromiumTestOnImplThread, pushDirtyTiles) |
| 146 |
{ |
177 |
{ |
| 147 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
178 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 148 |
DebugScopedSetImplThread implThread; |
|
|
| 149 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
179 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 150 |
|
180 |
|
| 151 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
181 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
|
Lines 169-178
TEST_F(TiledLayerChromiumTest, pushDirtyTiles)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec5
|
| 169 |
EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); |
199 |
EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); |
| 170 |
} |
200 |
} |
| 171 |
|
201 |
|
| 172 |
TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) |
202 |
TEST_F(TiledLayerChromiumTestOnImplThread, pushOccludedDirtyTiles) |
| 173 |
{ |
203 |
{ |
| 174 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
204 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 175 |
DebugScopedSetImplThread implThread; |
|
|
| 176 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
205 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 177 |
TestCCOcclusionTracker occluded; |
206 |
TestCCOcclusionTracker occluded; |
| 178 |
m_occlusion = &occluded; |
207 |
m_occlusion = &occluded; |
|
Lines 206-215
TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec6
|
| 206 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); |
235 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); |
| 207 |
} |
236 |
} |
| 208 |
|
237 |
|
| 209 |
TEST_F(TiledLayerChromiumTest, pushDeletedTiles) |
238 |
TEST_F(TiledLayerChromiumTestOnImplThread, pushDeletedTiles) |
| 210 |
{ |
239 |
{ |
| 211 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
240 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 212 |
DebugScopedSetImplThread implThread; |
|
|
| 213 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
241 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 214 |
|
242 |
|
| 215 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
243 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
|
Lines 222-228
TEST_F(TiledLayerChromiumTest, pushDeletedTiles)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec7
|
| 222 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); |
250 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); |
| 223 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); |
251 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); |
| 224 |
|
252 |
|
| 225 |
m_textureManager->clearPriorities(); |
253 |
{ |
|
|
254 |
DebugScopedSetMainThread mainThread; |
| 255 |
m_textureManager->clearPriorities(); |
| 256 |
} |
| 226 |
m_textureManager->clearAllMemory(m_resourceProvider.get()); |
257 |
m_textureManager->clearAllMemory(m_resourceProvider.get()); |
| 227 |
m_textureManager->setMaxMemoryLimitBytes(4*1024*1024); |
258 |
m_textureManager->setMaxMemoryLimitBytes(4*1024*1024); |
| 228 |
|
259 |
|
|
Lines 242-251
TEST_F(TiledLayerChromiumTest, pushDeletedTiles)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec8
|
| 242 |
EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); |
273 |
EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); |
| 243 |
} |
274 |
} |
| 244 |
|
275 |
|
| 245 |
TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) |
276 |
TEST_F(TiledLayerChromiumTestOnImplThread, pushIdlePaintTiles) |
| 246 |
{ |
277 |
{ |
| 247 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
278 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 248 |
DebugScopedSetImplThread implThread; |
|
|
| 249 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
279 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 250 |
|
280 |
|
| 251 |
// The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center. |
281 |
// The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center. |
|
Lines 279-289
TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec9
|
| 279 |
EXPECT_FALSE(needsUpdate); |
309 |
EXPECT_FALSE(needsUpdate); |
| 280 |
} |
310 |
} |
| 281 |
|
311 |
|
| 282 |
TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) |
312 |
TEST_F(TiledLayerChromiumTestOnImplThread, pushTilesAfterIdlePaintFailed) |
| 283 |
{ |
313 |
{ |
| 284 |
// Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later. |
314 |
// Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later. |
| 285 |
m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024); |
315 |
m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024); |
| 286 |
DebugScopedSetImplThread implThread; |
|
|
| 287 |
RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
316 |
RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 288 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl1(adoptPtr(new FakeCCTiledLayerImpl(1))); |
317 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl1(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 289 |
RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
318 |
RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
|
Lines 334-343
TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec10
|
| 334 |
EXPECT_FALSE(layerImpl2->hasTileAt(0, 2)); |
363 |
EXPECT_FALSE(layerImpl2->hasTileAt(0, 2)); |
| 335 |
} |
364 |
} |
| 336 |
|
365 |
|
| 337 |
TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) |
366 |
TEST_F(TiledLayerChromiumTestOnImplThread, pushIdlePaintedOccludedTiles) |
| 338 |
{ |
367 |
{ |
| 339 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
368 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 340 |
DebugScopedSetImplThread implThread; |
|
|
| 341 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
369 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 342 |
TestCCOcclusionTracker occluded; |
370 |
TestCCOcclusionTracker occluded; |
| 343 |
m_occlusion = &occluded; |
371 |
m_occlusion = &occluded; |
|
Lines 354-363
TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec11
|
| 354 |
EXPECT_EQ(1, occluded.overdrawMetrics().tilesCulledForUpload()); |
382 |
EXPECT_EQ(1, occluded.overdrawMetrics().tilesCulledForUpload()); |
| 355 |
} |
383 |
} |
| 356 |
|
384 |
|
| 357 |
TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) |
385 |
TEST_F(TiledLayerChromiumTestOnImplThread, pushTilesMarkedDirtyDuringPaint) |
| 358 |
{ |
386 |
{ |
| 359 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
387 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 360 |
DebugScopedSetImplThread implThread; |
|
|
| 361 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
388 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 362 |
|
389 |
|
| 363 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
390 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
|
Lines 373-383
TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec12
|
| 373 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); |
400 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); |
| 374 |
} |
401 |
} |
| 375 |
|
402 |
|
| 376 |
TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) |
403 |
TEST_F(TiledLayerChromiumTestOnImplThread, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) |
| 377 |
{ |
404 |
{ |
| 378 |
RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
405 |
RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 379 |
RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
406 |
RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 380 |
DebugScopedSetImplThread implThread; |
|
|
| 381 |
OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
407 |
OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 382 |
OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); |
408 |
OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); |
| 383 |
|
409 |
|
|
Lines 397-407
TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec13
|
| 397 |
EXPECT_TRUE(layer2Impl->hasTileAt(0, 1)); |
423 |
EXPECT_TRUE(layer2Impl->hasTileAt(0, 1)); |
| 398 |
} |
424 |
} |
| 399 |
|
425 |
|
| 400 |
TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) |
426 |
TEST_F(TiledLayerChromiumTestOnImplThread, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) |
| 401 |
{ |
427 |
{ |
| 402 |
RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
428 |
RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 403 |
RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
429 |
RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 404 |
DebugScopedSetImplThread implThread; |
|
|
| 405 |
OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
430 |
OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 406 |
OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); |
431 |
OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); |
| 407 |
|
432 |
|
|
Lines 424-495
TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec14
|
| 424 |
{ |
449 |
{ |
| 425 |
// Create a CCLayerTreeHost that has the right viewportsize, |
450 |
// Create a CCLayerTreeHost that has the right viewportsize, |
| 426 |
// so the layer is considered small enough. |
451 |
// so the layer is considered small enough. |
| 427 |
WebKit::WebCompositor::initialize(0); |
|
|
| 428 |
FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; |
452 |
FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; |
| 429 |
OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); |
453 |
OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); |
| 430 |
|
454 |
|
| 431 |
bool runOutOfMemory[2] = {false, true}; |
455 |
{ |
| 432 |
for (int i = 0; i < 2; i++) { |
456 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 433 |
// Create a layer with 4x4 tiles. |
457 |
bool runOutOfMemory[2] = {false, true}; |
| 434 |
int layerWidth = 4 * FakeTiledLayerChromium::tileSize().width(); |
458 |
for (int i = 0; i < 2; i++) { |
| 435 |
int layerHeight = 4 * FakeTiledLayerChromium::tileSize().height(); |
459 |
// Create a layer with 4x4 tiles. |
| 436 |
int memoryForLayer = layerWidth * layerHeight * 4; |
460 |
int layerWidth = 4 * FakeTiledLayerChromium::tileSize().width(); |
| 437 |
IntSize viewportSize = IntSize(layerWidth, layerHeight); |
461 |
int layerHeight = 4 * FakeTiledLayerChromium::tileSize().height(); |
| 438 |
ccLayerTreeHost->setViewportSize(viewportSize, viewportSize); |
462 |
int memoryForLayer = layerWidth * layerHeight * 4; |
|
|
463 |
IntSize viewportSize = IntSize(layerWidth, layerHeight); |
| 464 |
{ |
| 465 |
DebugScopedSetMainThread mainThread; |
| 466 |
ccLayerTreeHost->setViewportSize(viewportSize, viewportSize); |
| 467 |
} |
| 439 |
|
468 |
|
| 440 |
// Use 8x4 tiles to run out of memory. |
469 |
// Use 8x4 tiles to run out of memory. |
| 441 |
if (runOutOfMemory[i]) |
470 |
if (runOutOfMemory[i]) |
| 442 |
layerWidth *= 2; |
471 |
layerWidth *= 2; |
| 443 |
|
472 |
|
| 444 |
m_textureManager->setMaxMemoryLimitBytes(memoryForLayer); |
473 |
m_textureManager->setMaxMemoryLimitBytes(memoryForLayer); |
| 445 |
DebugScopedSetImplThread implThread; |
|
|
| 446 |
|
474 |
|
| 447 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
475 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 448 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
476 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 449 |
|
477 |
|
| 450 |
// Full size layer with half being visible. |
478 |
{ |
| 451 |
IntSize contentBounds(layerWidth, layerHeight); |
479 |
DebugScopedSetMainThread mainThread; |
| 452 |
IntRect contentRect(IntPoint::zero(), contentBounds); |
|
|
| 453 |
IntRect visibleRect(IntPoint::zero(), IntSize(layerWidth / 2, layerHeight)); |
| 454 |
|
480 |
|
| 455 |
// Pretend the layer is animating. |
481 |
// Full size layer with half being visible. |
| 456 |
layer->setDrawTransformIsAnimating(true); |
482 |
IntSize contentBounds(layerWidth, layerHeight); |
| 457 |
layer->setBounds(contentBounds); |
483 |
IntRect contentRect(IntPoint::zero(), contentBounds); |
| 458 |
layer->setVisibleContentRect(visibleRect); |
484 |
IntRect visibleRect(IntPoint::zero(), IntSize(layerWidth / 2, layerHeight)); |
| 459 |
layer->invalidateContentRect(contentRect); |
485 |
|
| 460 |
layer->setLayerTreeHost(ccLayerTreeHost.get()); |
486 |
// Pretend the layer is animating. |
| 461 |
|
487 |
layer->setDrawTransformIsAnimating(true); |
| 462 |
// The layer should paint it's entire contents on the first paint |
488 |
layer->setBounds(contentBounds); |
| 463 |
// if it is close to the viewport size and has the available memory. |
489 |
layer->setVisibleContentRect(visibleRect); |
| 464 |
layer->setTexturePriorities(m_priorityCalculator); |
490 |
layer->invalidateContentRect(contentRect); |
| 465 |
m_textureManager->prioritizeTextures(); |
491 |
layer->setLayerTreeHost(ccLayerTreeHost.get()); |
| 466 |
layer->update(m_queue, 0, m_stats); |
|
|
| 467 |
updateTextures(); |
| 468 |
layer->pushPropertiesTo(layerImpl.get()); |
| 469 |
|
| 470 |
// We should have all the tiles for the small animated layer. |
| 471 |
// We should still have the visible tiles when we didn't |
| 472 |
// have enough memory for all the tiles. |
| 473 |
if (!runOutOfMemory[i]) { |
| 474 |
for (int i = 0; i < 4; ++i) { |
| 475 |
for (int j = 0; j < 4; ++j) |
| 476 |
EXPECT_TRUE(layerImpl->hasTileAt(i, j)); |
| 477 |
} |
492 |
} |
| 478 |
} else { |
493 |
|
| 479 |
for (int i = 0; i < 8; ++i) { |
494 |
// The layer should paint it's entire contents on the first paint |
| 480 |
for (int j = 0; j < 4; ++j) |
495 |
// if it is close to the viewport size and has the available memory. |
| 481 |
EXPECT_EQ(layerImpl->hasTileAt(i, j), i < 4); |
496 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
|
|
497 |
updateLayerOnMainThread(layer.get(), 0); |
| 498 |
updateTextures(); |
| 499 |
layer->pushPropertiesTo(layerImpl.get()); |
| 500 |
|
| 501 |
// We should have all the tiles for the small animated layer. |
| 502 |
// We should still have the visible tiles when we didn't |
| 503 |
// have enough memory for all the tiles. |
| 504 |
if (!runOutOfMemory[i]) { |
| 505 |
for (int i = 0; i < 4; ++i) { |
| 506 |
for (int j = 0; j < 4; ++j) |
| 507 |
EXPECT_TRUE(layerImpl->hasTileAt(i, j)); |
| 508 |
} |
| 509 |
} else { |
| 510 |
for (int i = 0; i < 8; ++i) { |
| 511 |
for (int j = 0; j < 4; ++j) |
| 512 |
EXPECT_EQ(layerImpl->hasTileAt(i, j), i < 4); |
| 513 |
} |
| 482 |
} |
514 |
} |
| 483 |
} |
515 |
} |
| 484 |
} |
516 |
} |
| 485 |
ccLayerTreeHost.clear(); |
517 |
ccLayerTreeHost.clear(); |
| 486 |
WebKit::WebCompositor::shutdown(); |
|
|
| 487 |
} |
518 |
} |
| 488 |
|
519 |
|
| 489 |
TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) |
520 |
TEST_F(TiledLayerChromiumTestOnImplThread, idlePaintOutOfMemory) |
| 490 |
{ |
521 |
{ |
| 491 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
522 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 492 |
DebugScopedSetImplThread implThread; |
|
|
| 493 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
523 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 494 |
|
524 |
|
| 495 |
// We have enough memory for only the visible rect, so we will run out of memory in first idle paint. |
525 |
// We have enough memory for only the visible rect, so we will run out of memory in first idle paint. |
|
Lines 510-519
TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec15
|
| 510 |
EXPECT_TRUE(layerImpl->hasTileAt(1, 1)); |
540 |
EXPECT_TRUE(layerImpl->hasTileAt(1, 1)); |
| 511 |
} |
541 |
} |
| 512 |
|
542 |
|
| 513 |
TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) |
543 |
TEST_F(TiledLayerChromiumTestOnImplThread, idlePaintZeroSizedLayer) |
| 514 |
{ |
544 |
{ |
| 515 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
545 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 516 |
DebugScopedSetImplThread implThread; |
|
|
| 517 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
546 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 518 |
|
547 |
|
| 519 |
bool animating[2] = {false, true}; |
548 |
bool animating[2] = {false, true}; |
|
Lines 538-547
TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec16
|
| 538 |
} |
567 |
} |
| 539 |
} |
568 |
} |
| 540 |
|
569 |
|
| 541 |
TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) |
570 |
TEST_F(TiledLayerChromiumTestOnImplThread, idlePaintNonVisibleLayers) |
| 542 |
{ |
571 |
{ |
| 543 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
572 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 544 |
DebugScopedSetImplThread implThread; |
|
|
| 545 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
573 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 546 |
|
574 |
|
| 547 |
// Alternate between not visible and visible. |
575 |
// Alternate between not visible and visible. |
|
Lines 569-578
TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec17
|
| 569 |
} |
597 |
} |
| 570 |
} |
598 |
} |
| 571 |
|
599 |
|
| 572 |
TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) |
600 |
TEST_F(TiledLayerChromiumTestOnImplThread, invalidateFromPrepare) |
| 573 |
{ |
601 |
{ |
| 574 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
602 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 575 |
DebugScopedSetImplThread implThread; |
|
|
| 576 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
603 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 577 |
|
604 |
|
| 578 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
605 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
|
Lines 603-614
TEST_F(TiledLayerChromiumTest, invalidateFromPrepare)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec18
|
| 603 |
EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); |
630 |
EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); |
| 604 |
} |
631 |
} |
| 605 |
|
632 |
|
| 606 |
TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) |
633 |
TEST_F(TiledLayerChromiumTestOnImplThread, verifyUpdateRectWhenContentBoundsAreScaled) |
| 607 |
{ |
634 |
{ |
| 608 |
// The updateRect (that indicates what was actually painted) should be in |
635 |
// The updateRect (that indicates what was actually painted) should be in |
| 609 |
// layer space, not the content space. |
636 |
// layer space, not the content space. |
| 610 |
RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(m_textureManager.get())); |
637 |
RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(m_textureManager.get())); |
| 611 |
DebugScopedSetImplThread implThread; |
|
|
| 612 |
|
638 |
|
| 613 |
IntRect layerBounds(0, 0, 300, 200); |
639 |
IntRect layerBounds(0, 0, 300, 200); |
| 614 |
IntRect contentBounds(0, 0, 200, 250); |
640 |
IntRect contentBounds(0, 0, 200, 250); |
|
Lines 621-653
TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec19
|
| 621 |
// However, it should still be in layer space, not content space. |
647 |
// However, it should still be in layer space, not content space. |
| 622 |
layer->invalidateContentRect(contentBounds); |
648 |
layer->invalidateContentRect(contentBounds); |
| 623 |
|
649 |
|
| 624 |
layer->setTexturePriorities(m_priorityCalculator); |
650 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 625 |
m_textureManager->prioritizeTextures(); |
651 |
updateLayerOnMainThread(layer.get(), 0); |
| 626 |
layer->update(m_queue, 0, m_stats); |
|
|
| 627 |
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); |
652 |
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); |
| 628 |
updateTextures(); |
653 |
updateTextures(); |
| 629 |
|
654 |
|
| 630 |
// After the tiles are updated once, another invalidate only needs to update the bounds of the layer. |
655 |
// After the tiles are updated once, another invalidate only needs to update the bounds of the layer. |
| 631 |
layer->setTexturePriorities(m_priorityCalculator); |
656 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 632 |
m_textureManager->prioritizeTextures(); |
|
|
| 633 |
layer->invalidateContentRect(contentBounds); |
657 |
layer->invalidateContentRect(contentBounds); |
| 634 |
layer->update(m_queue, 0, m_stats); |
658 |
updateLayerOnMainThread(layer.get(), 0); |
| 635 |
EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); |
659 |
EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); |
| 636 |
updateTextures(); |
660 |
updateTextures(); |
| 637 |
|
661 |
|
| 638 |
// Partial re-paint should also be represented by the updateRect in layer space, not content space. |
662 |
// Partial re-paint should also be represented by the updateRect in layer space, not content space. |
| 639 |
IntRect partialDamage(30, 100, 10, 10); |
663 |
IntRect partialDamage(30, 100, 10, 10); |
| 640 |
layer->invalidateContentRect(partialDamage); |
664 |
layer->invalidateContentRect(partialDamage); |
| 641 |
layer->setTexturePriorities(m_priorityCalculator); |
665 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 642 |
m_textureManager->prioritizeTextures(); |
666 |
updateLayerOnMainThread(layer.get(), 0); |
| 643 |
layer->update(m_queue, 0, m_stats); |
|
|
| 644 |
EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); |
667 |
EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); |
| 645 |
} |
668 |
} |
| 646 |
|
669 |
|
| 647 |
TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) |
670 |
TEST_F(TiledLayerChromiumTestOnImplThread, verifyInvalidationWhenContentsScaleChanges) |
| 648 |
{ |
671 |
{ |
| 649 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
672 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 650 |
DebugScopedSetImplThread implThread; |
|
|
| 651 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
673 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 652 |
|
674 |
|
| 653 |
// Create a layer with one tile. |
675 |
// Create a layer with one tile. |
|
Lines 659-667
TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec20
|
| 659 |
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); |
681 |
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); |
| 660 |
|
682 |
|
| 661 |
// Push the tiles to the impl side and check that there is exactly one. |
683 |
// Push the tiles to the impl side and check that there is exactly one. |
| 662 |
layer->setTexturePriorities(m_priorityCalculator); |
684 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 663 |
m_textureManager->prioritizeTextures(); |
685 |
updateLayerOnMainThread(layer.get(), 0); |
| 664 |
layer->update(m_queue, 0, m_stats); |
|
|
| 665 |
updateTextures(); |
686 |
updateTextures(); |
| 666 |
layer->pushPropertiesTo(layerImpl.get()); |
687 |
layer->pushPropertiesTo(layerImpl.get()); |
| 667 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); |
688 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); |
|
Lines 676-684
TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec21
|
| 676 |
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); |
697 |
EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); |
| 677 |
|
698 |
|
| 678 |
// The impl side should get 2x2 tiles now. |
699 |
// The impl side should get 2x2 tiles now. |
| 679 |
layer->setTexturePriorities(m_priorityCalculator); |
700 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 680 |
m_textureManager->prioritizeTextures(); |
701 |
updateLayerOnMainThread(layer.get(), 0); |
| 681 |
layer->update(m_queue, 0, m_stats); |
|
|
| 682 |
updateTextures(); |
702 |
updateTextures(); |
| 683 |
layer->pushPropertiesTo(layerImpl.get()); |
703 |
layer->pushPropertiesTo(layerImpl.get()); |
| 684 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); |
704 |
EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); |
|
Lines 689-697
TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec22
|
| 689 |
// Invalidate the entire layer again, but do not paint. All tiles should be gone now from the |
709 |
// Invalidate the entire layer again, but do not paint. All tiles should be gone now from the |
| 690 |
// impl side. |
710 |
// impl side. |
| 691 |
layer->setNeedsDisplay(); |
711 |
layer->setNeedsDisplay(); |
| 692 |
layer->setTexturePriorities(m_priorityCalculator); |
712 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 693 |
m_textureManager->prioritizeTextures(); |
|
|
| 694 |
|
| 695 |
layer->pushPropertiesTo(layerImpl.get()); |
713 |
layer->pushPropertiesTo(layerImpl.get()); |
| 696 |
EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); |
714 |
EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); |
| 697 |
EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); |
715 |
EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); |
|
Lines 701-756
TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec23
|
| 701 |
|
719 |
|
| 702 |
TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) |
720 |
TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) |
| 703 |
{ |
721 |
{ |
| 704 |
// Initialize without threading support. |
|
|
| 705 |
WebKit::WebCompositor::initialize(0); |
| 706 |
FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; |
722 |
FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; |
| 707 |
OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); |
723 |
OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); |
| 708 |
ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); |
724 |
ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); |
| 709 |
|
725 |
|
| 710 |
// Create two 300 x 300 tiled layers. |
726 |
{ |
| 711 |
IntSize contentBounds(300, 300); |
727 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 712 |
IntRect contentRect(IntPoint::zero(), contentBounds); |
|
|
| 713 |
|
| 714 |
// We have enough memory for only one of the two layers. |
| 715 |
int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel. |
| 716 |
|
| 717 |
RefPtr<FakeTiledLayerChromium> rootLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
| 718 |
RefPtr<FakeTiledLayerChromium> childLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
| 719 |
rootLayer->addChild(childLayer); |
| 720 |
|
| 721 |
rootLayer->setBounds(contentBounds); |
| 722 |
rootLayer->setVisibleContentRect(contentRect); |
| 723 |
rootLayer->setPosition(FloatPoint(0, 0)); |
| 724 |
childLayer->setBounds(contentBounds); |
| 725 |
childLayer->setVisibleContentRect(contentRect); |
| 726 |
childLayer->setPosition(FloatPoint(0, 0)); |
| 727 |
rootLayer->invalidateContentRect(contentRect); |
| 728 |
childLayer->invalidateContentRect(contentRect); |
| 729 |
|
| 730 |
ccLayerTreeHost->setRootLayer(rootLayer); |
| 731 |
ccLayerTreeHost->setViewportSize(IntSize(300, 300), IntSize(300, 300)); |
| 732 |
|
| 733 |
ccLayerTreeHost->updateLayers(m_queue, memoryLimit); |
| 734 |
|
728 |
|
| 735 |
// We'll skip the root layer. |
729 |
// Create two 300 x 300 tiled layers. |
| 736 |
EXPECT_TRUE(rootLayer->skipsDraw()); |
730 |
IntSize contentBounds(300, 300); |
| 737 |
EXPECT_FALSE(childLayer->skipsDraw()); |
731 |
IntRect contentRect(IntPoint::zero(), contentBounds); |
| 738 |
|
732 |
|
| 739 |
ccLayerTreeHost->commitComplete(); |
733 |
// We have enough memory for only one of the two layers. |
|
|
734 |
int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel. |
| 735 |
|
| 736 |
RefPtr<FakeTiledLayerChromium> rootLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
| 737 |
RefPtr<FakeTiledLayerChromium> childLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
| 738 |
rootLayer->addChild(childLayer); |
| 739 |
|
| 740 |
{ |
| 741 |
DebugScopedSetMainThread mainThread; |
| 742 |
rootLayer->setBounds(contentBounds); |
| 743 |
rootLayer->setVisibleContentRect(contentRect); |
| 744 |
rootLayer->setPosition(FloatPoint(0, 0)); |
| 745 |
childLayer->setBounds(contentBounds); |
| 746 |
childLayer->setVisibleContentRect(contentRect); |
| 747 |
childLayer->setPosition(FloatPoint(0, 0)); |
| 748 |
rootLayer->invalidateContentRect(contentRect); |
| 749 |
childLayer->invalidateContentRect(contentRect); |
| 750 |
|
| 751 |
ccLayerTreeHost->setRootLayer(rootLayer); |
| 752 |
ccLayerTreeHost->setViewportSize(IntSize(300, 300), IntSize(300, 300)); |
| 753 |
ccLayerTreeHost->updateLayers(m_queue, memoryLimit); |
| 754 |
} |
| 740 |
|
755 |
|
| 741 |
// Remove the child layer. |
756 |
// We'll skip the root layer. |
| 742 |
rootLayer->removeAllChildren(); |
757 |
EXPECT_TRUE(rootLayer->skipsDraw()); |
|
|
758 |
EXPECT_FALSE(childLayer->skipsDraw()); |
| 743 |
|
759 |
|
| 744 |
ccLayerTreeHost->updateLayers(m_queue, memoryLimit); |
760 |
ccLayerTreeHost->commitComplete(); |
| 745 |
EXPECT_FALSE(rootLayer->skipsDraw()); |
|
|
| 746 |
|
761 |
|
| 747 |
ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); |
762 |
{ |
|
|
763 |
DebugScopedSetMainThread mainThread; |
| 764 |
// Remove the child layer. |
| 765 |
rootLayer->removeAllChildren(); |
| 766 |
ccLayerTreeHost->updateLayers(m_queue, memoryLimit); |
| 767 |
EXPECT_FALSE(rootLayer->skipsDraw()); |
| 768 |
} |
| 769 |
ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); |
| 770 |
} |
| 748 |
ccLayerTreeHost->setRootLayer(0); |
771 |
ccLayerTreeHost->setRootLayer(0); |
| 749 |
ccLayerTreeHost.clear(); |
772 |
ccLayerTreeHost.clear(); |
| 750 |
WebKit::WebCompositor::shutdown(); |
|
|
| 751 |
} |
773 |
} |
| 752 |
|
774 |
|
| 753 |
TEST_F(TiledLayerChromiumTest, resizeToSmaller) |
775 |
TEST_F(TiledLayerChromiumTestOnImplThread, resizeToSmaller) |
| 754 |
{ |
776 |
{ |
| 755 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
777 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 756 |
|
778 |
|
|
Lines 758-772
TEST_F(TiledLayerChromiumTest, resizeToSmaller)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec24
|
| 758 |
layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); |
780 |
layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); |
| 759 |
layer->invalidateContentRect(IntRect(0, 0, 700, 700)); |
781 |
layer->invalidateContentRect(IntRect(0, 0, 700, 700)); |
| 760 |
|
782 |
|
| 761 |
layer->setTexturePriorities(m_priorityCalculator); |
783 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 762 |
m_textureManager->prioritizeTextures(); |
784 |
updateLayerOnMainThread(layer.get(), 0); |
| 763 |
layer->update(m_queue, 0, m_stats); |
|
|
| 764 |
|
785 |
|
| 765 |
layer->setBounds(IntSize(200, 200)); |
786 |
layer->setBounds(IntSize(200, 200)); |
| 766 |
layer->invalidateContentRect(IntRect(0, 0, 200, 200)); |
787 |
layer->invalidateContentRect(IntRect(0, 0, 200, 200)); |
| 767 |
} |
788 |
} |
| 768 |
|
789 |
|
| 769 |
TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) |
790 |
TEST_F(TiledLayerChromiumTestOnImplThread, hugeLayerUpdateCrash) |
| 770 |
{ |
791 |
{ |
| 771 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
792 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 772 |
|
793 |
|
|
Lines 776-791
TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec25
|
| 776 |
layer->invalidateContentRect(IntRect(0, 0, size, size)); |
797 |
layer->invalidateContentRect(IntRect(0, 0, size, size)); |
| 777 |
|
798 |
|
| 778 |
// Ensure no crash for bounds where size * size would overflow an int. |
799 |
// Ensure no crash for bounds where size * size would overflow an int. |
| 779 |
layer->setTexturePriorities(m_priorityCalculator); |
800 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 780 |
m_textureManager->prioritizeTextures(); |
801 |
updateLayerOnMainThread(layer.get(), 0); |
| 781 |
layer->update(m_queue, 0, m_stats); |
|
|
| 782 |
} |
802 |
} |
| 783 |
|
803 |
|
| 784 |
TEST_F(TiledLayerChromiumTest, partialUpdates) |
804 |
TEST_F(TiledLayerChromiumTest, partialUpdates) |
| 785 |
{ |
805 |
{ |
| 786 |
// Initialize without threading support. |
|
|
| 787 |
WebKit::WebCompositor::initialize(0); |
| 788 |
|
| 789 |
CCLayerTreeSettings settings; |
806 |
CCLayerTreeSettings settings; |
| 790 |
settings.maxPartialTextureUpdates = 4; |
807 |
settings.maxPartialTextureUpdates = 4; |
| 791 |
|
808 |
|
|
Lines 793-916
TEST_F(TiledLayerChromiumTest, partialUpdates)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec26
|
| 793 |
OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings); |
810 |
OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings); |
| 794 |
ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); |
811 |
ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); |
| 795 |
|
812 |
|
| 796 |
// Create one 300 x 200 tiled layer with 3 x 2 tiles. |
813 |
{ |
| 797 |
IntSize contentBounds(300, 200); |
814 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 798 |
IntRect contentRect(IntPoint::zero(), contentBounds); |
|
|
| 799 |
|
815 |
|
| 800 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
816 |
// Create one 300 x 200 tiled layer with 3 x 2 tiles. |
| 801 |
layer->setBounds(contentBounds); |
817 |
IntSize contentBounds(300, 200); |
| 802 |
layer->setPosition(FloatPoint(0, 0)); |
818 |
IntRect contentRect(IntPoint::zero(), contentBounds); |
| 803 |
layer->setVisibleContentRect(contentRect); |
|
|
| 804 |
layer->invalidateContentRect(contentRect); |
| 805 |
|
819 |
|
| 806 |
ccLayerTreeHost->setRootLayer(layer); |
820 |
RefPtr<FakeTiledLayerChromium> layer(adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager()))); |
| 807 |
ccLayerTreeHost->setViewportSize(IntSize(300, 200), IntSize(300, 200)); |
|
|
| 808 |
|
821 |
|
| 809 |
// Full update of all 6 tiles. |
822 |
{ |
| 810 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
823 |
DebugScopedSetMainThread mainThread; |
| 811 |
{ |
824 |
layer->setBounds(contentBounds); |
| 812 |
DebugScopedSetImplThread implThread; |
825 |
layer->setPosition(FloatPoint(0, 0)); |
| 813 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
826 |
layer->setVisibleContentRect(contentRect); |
| 814 |
updateTextures(4); |
827 |
layer->invalidateContentRect(contentRect); |
| 815 |
EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); |
|
|
| 816 |
EXPECT_TRUE(m_queue.hasMoreUpdates()); |
| 817 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 818 |
updateTextures(4); |
| 819 |
EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); |
| 820 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 821 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 822 |
layer->pushPropertiesTo(layerImpl.get()); |
| 823 |
} |
| 824 |
ccLayerTreeHost->commitComplete(); |
| 825 |
|
828 |
|
| 826 |
// Full update of 3 tiles and partial update of 3 tiles. |
829 |
ccLayerTreeHost->setRootLayer(layer); |
| 827 |
layer->invalidateContentRect(IntRect(0, 0, 300, 150)); |
830 |
ccLayerTreeHost->setViewportSize(IntSize(300, 200), IntSize(300, 200)); |
| 828 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
|
|
| 829 |
{ |
| 830 |
DebugScopedSetImplThread implThread; |
| 831 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 832 |
updateTextures(4); |
| 833 |
EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); |
| 834 |
EXPECT_TRUE(m_queue.hasMoreUpdates()); |
| 835 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 836 |
updateTextures(4); |
| 837 |
EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); |
| 838 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 839 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 840 |
layer->pushPropertiesTo(layerImpl.get()); |
| 841 |
} |
| 842 |
ccLayerTreeHost->commitComplete(); |
| 843 |
|
| 844 |
// Partial update of 6 tiles. |
| 845 |
layer->invalidateContentRect(IntRect(50, 50, 200, 100)); |
| 846 |
{ |
| 847 |
DebugScopedSetImplThread implThread; |
| 848 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 849 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
| 850 |
updateTextures(4); |
| 851 |
EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); |
| 852 |
EXPECT_TRUE(m_queue.hasMoreUpdates()); |
| 853 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 854 |
updateTextures(4); |
| 855 |
EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); |
| 856 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 857 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 858 |
layer->pushPropertiesTo(layerImpl.get()); |
| 859 |
} |
| 860 |
ccLayerTreeHost->commitComplete(); |
| 861 |
|
831 |
|
| 862 |
// Checkerboard all tiles. |
832 |
// Full update of all 6 tiles. |
| 863 |
layer->invalidateContentRect(IntRect(0, 0, 300, 200)); |
833 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
| 864 |
{ |
834 |
} |
| 865 |
DebugScopedSetImplThread implThread; |
|
|
| 866 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 867 |
layer->pushPropertiesTo(layerImpl.get()); |
| 868 |
} |
| 869 |
ccLayerTreeHost->commitComplete(); |
| 870 |
|
835 |
|
| 871 |
// Partial update of 6 checkerboard tiles. |
836 |
{ |
| 872 |
layer->invalidateContentRect(IntRect(50, 50, 200, 100)); |
837 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 873 |
{ |
838 |
updateTextures(4); |
| 874 |
DebugScopedSetImplThread implThread; |
839 |
EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); |
| 875 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
840 |
EXPECT_TRUE(m_queue.hasMoreUpdates()); |
| 876 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
841 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 877 |
updateTextures(4); |
842 |
updateTextures(4); |
| 878 |
EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); |
843 |
EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); |
| 879 |
EXPECT_TRUE(m_queue.hasMoreUpdates()); |
844 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 880 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
845 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 881 |
updateTextures(4); |
846 |
layer->pushPropertiesTo(layerImpl.get()); |
| 882 |
EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); |
847 |
} |
| 883 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
848 |
ccLayerTreeHost->commitComplete(); |
| 884 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
|
|
| 885 |
layer->pushPropertiesTo(layerImpl.get()); |
| 886 |
} |
| 887 |
ccLayerTreeHost->commitComplete(); |
| 888 |
|
849 |
|
| 889 |
// Partial update of 4 tiles. |
850 |
// Full update of 3 tiles and partial update of 3 tiles. |
| 890 |
layer->invalidateContentRect(IntRect(50, 50, 100, 100)); |
851 |
layer->invalidateContentRect(IntRect(0, 0, 300, 150)); |
| 891 |
{ |
852 |
{ |
| 892 |
DebugScopedSetImplThread implThread; |
853 |
DebugScopedSetMainThread mainThread; |
| 893 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
854 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
| 894 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
855 |
} |
| 895 |
updateTextures(4); |
856 |
{ |
| 896 |
EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); |
857 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 897 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
858 |
updateTextures(4); |
| 898 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
859 |
EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); |
| 899 |
layer->pushPropertiesTo(layerImpl.get()); |
860 |
EXPECT_TRUE(m_queue.hasMoreUpdates()); |
| 900 |
} |
861 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 901 |
ccLayerTreeHost->commitComplete(); |
862 |
updateTextures(4); |
|
|
863 |
EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); |
| 864 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 865 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 866 |
layer->pushPropertiesTo(layerImpl.get()); |
| 867 |
} |
| 868 |
ccLayerTreeHost->commitComplete(); |
| 869 |
|
| 870 |
// Partial update of 6 tiles. |
| 871 |
layer->invalidateContentRect(IntRect(50, 50, 200, 100)); |
| 872 |
{ |
| 873 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 874 |
{ |
| 875 |
DebugScopedSetMainThread mainThread; |
| 876 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
| 877 |
} |
| 878 |
updateTextures(4); |
| 879 |
EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); |
| 880 |
EXPECT_TRUE(m_queue.hasMoreUpdates()); |
| 881 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 882 |
updateTextures(4); |
| 883 |
EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); |
| 884 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 885 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 886 |
layer->pushPropertiesTo(layerImpl.get()); |
| 887 |
} |
| 888 |
ccLayerTreeHost->commitComplete(); |
| 902 |
|
889 |
|
| 903 |
{ |
890 |
// Checkerboard all tiles. |
| 904 |
DebugScopedSetImplThread implThread; |
891 |
layer->invalidateContentRect(IntRect(0, 0, 300, 200)); |
|
|
892 |
{ |
| 893 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 894 |
layer->pushPropertiesTo(layerImpl.get()); |
| 895 |
} |
| 896 |
ccLayerTreeHost->commitComplete(); |
| 897 |
|
| 898 |
// Partial update of 6 checkerboard tiles. |
| 899 |
layer->invalidateContentRect(IntRect(50, 50, 200, 100)); |
| 900 |
{ |
| 901 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 902 |
{ |
| 903 |
DebugScopedSetMainThread mainThread; |
| 904 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
| 905 |
} |
| 906 |
updateTextures(4); |
| 907 |
EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); |
| 908 |
EXPECT_TRUE(m_queue.hasMoreUpdates()); |
| 909 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 910 |
updateTextures(4); |
| 911 |
EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); |
| 912 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 913 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 914 |
layer->pushPropertiesTo(layerImpl.get()); |
| 915 |
} |
| 916 |
ccLayerTreeHost->commitComplete(); |
| 917 |
|
| 918 |
// Partial update of 4 tiles. |
| 919 |
layer->invalidateContentRect(IntRect(50, 50, 100, 100)); |
| 920 |
{ |
| 921 |
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); |
| 922 |
{ |
| 923 |
DebugScopedSetMainThread mainThread; |
| 924 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
| 925 |
} |
| 926 |
updateTextures(4); |
| 927 |
EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); |
| 928 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 929 |
layer->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 930 |
layer->pushPropertiesTo(layerImpl.get()); |
| 931 |
} |
| 932 |
ccLayerTreeHost->commitComplete(); |
| 905 |
ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); |
933 |
ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); |
| 906 |
} |
934 |
} |
| 907 |
ccLayerTreeHost->setRootLayer(0); |
935 |
ccLayerTreeHost->setRootLayer(0); |
| 908 |
ccLayerTreeHost.clear(); |
936 |
ccLayerTreeHost.clear(); |
| 909 |
WebKit::WebCompositor::shutdown(); |
|
|
| 910 |
} |
937 |
} |
| 911 |
|
938 |
|
| 912 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) |
939 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) |
| 913 |
{ |
940 |
{ |
|
|
941 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 914 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
942 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 915 |
|
943 |
|
| 916 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
944 |
// The tile size is 100x100, so this invalidates and then paints two tiles. |
|
Lines 919-932
TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec27
|
| 919 |
layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); |
947 |
layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); |
| 920 |
layer->invalidateContentRect(IntRect(0, 0, 100, 200)); |
948 |
layer->invalidateContentRect(IntRect(0, 0, 100, 200)); |
| 921 |
|
949 |
|
| 922 |
layer->setTexturePriorities(m_priorityCalculator); |
950 |
|
| 923 |
m_textureManager->prioritizeTextures(); |
951 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 924 |
layer->update(m_queue, 0, m_stats); |
952 |
updateLayerOnMainThread(layer.get(), 0); |
| 925 |
EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
953 |
EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 926 |
} |
954 |
} |
| 927 |
|
955 |
|
| 928 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) |
956 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) |
| 929 |
{ |
957 |
{ |
|
|
958 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 930 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
959 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 931 |
TestCCOcclusionTracker occluded; |
960 |
TestCCOcclusionTracker occluded; |
| 932 |
|
961 |
|
|
Lines 939-947
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec28
|
| 939 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
968 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
| 940 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
969 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 941 |
|
970 |
|
| 942 |
layer->setTexturePriorities(m_priorityCalculator); |
971 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 943 |
m_textureManager->prioritizeTextures(); |
972 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 944 |
layer->update(m_queue, &occluded, m_stats); |
|
|
| 945 |
EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
973 |
EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 946 |
|
974 |
|
| 947 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
975 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 949-960
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec29
|
| 949 |
EXPECT_EQ(3, occluded.overdrawMetrics().tilesCulledForUpload()); |
977 |
EXPECT_EQ(3, occluded.overdrawMetrics().tilesCulledForUpload()); |
| 950 |
|
978 |
|
| 951 |
layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); |
979 |
layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); |
| 952 |
layer->setTexturePriorities(m_priorityCalculator); |
980 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 953 |
m_textureManager->prioritizeTextures(); |
|
|
| 954 |
|
981 |
|
| 955 |
occluded.setOcclusion(IntRect(250, 200, 300, 100)); |
982 |
occluded.setOcclusion(IntRect(250, 200, 300, 100)); |
| 956 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
983 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 957 |
layer->update(m_queue, &occluded, m_stats); |
984 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 958 |
EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
985 |
EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 959 |
|
986 |
|
| 960 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
987 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 962-973
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec30
|
| 962 |
EXPECT_EQ(3 + 2, occluded.overdrawMetrics().tilesCulledForUpload()); |
989 |
EXPECT_EQ(3 + 2, occluded.overdrawMetrics().tilesCulledForUpload()); |
| 963 |
|
990 |
|
| 964 |
layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); |
991 |
layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); |
| 965 |
layer->setTexturePriorities(m_priorityCalculator); |
992 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 966 |
m_textureManager->prioritizeTextures(); |
|
|
| 967 |
|
993 |
|
| 968 |
occluded.setOcclusion(IntRect(250, 250, 300, 100)); |
994 |
occluded.setOcclusion(IntRect(250, 250, 300, 100)); |
| 969 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
995 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 970 |
layer->update(m_queue, &occluded, m_stats); |
996 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 971 |
EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
997 |
EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 972 |
|
998 |
|
| 973 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
999 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 977-982
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec31
|
| 977 |
|
1003 |
|
| 978 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) |
1004 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) |
| 979 |
{ |
1005 |
{ |
|
|
1006 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 980 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
1007 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 981 |
TestCCOcclusionTracker occluded; |
1008 |
TestCCOcclusionTracker occluded; |
| 982 |
|
1009 |
|
|
Lines 990-998
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec32
|
| 990 |
layer->setVisibleContentRect(IntRect(0, 0, 600, 360)); |
1017 |
layer->setVisibleContentRect(IntRect(0, 0, 600, 360)); |
| 991 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
1018 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 992 |
|
1019 |
|
| 993 |
layer->setTexturePriorities(m_priorityCalculator); |
1020 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 994 |
m_textureManager->prioritizeTextures(); |
1021 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 995 |
layer->update(m_queue, &occluded, m_stats); |
|
|
| 996 |
EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
1022 |
EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 997 |
|
1023 |
|
| 998 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
1024 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 1006-1014
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec33
|
| 1006 |
layer->setDrawableContentRect(IntRect(0, 0, 600, 350)); |
1032 |
layer->setDrawableContentRect(IntRect(0, 0, 600, 350)); |
| 1007 |
layer->setVisibleContentRect(IntRect(0, 0, 600, 350)); |
1033 |
layer->setVisibleContentRect(IntRect(0, 0, 600, 350)); |
| 1008 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
1034 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 1009 |
layer->setTexturePriorities(m_priorityCalculator); |
1035 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1010 |
m_textureManager->prioritizeTextures(); |
1036 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1011 |
layer->update(m_queue, &occluded, m_stats); |
|
|
| 1012 |
EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
1037 |
EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 1013 |
|
1038 |
|
| 1014 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
1039 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 1022-1030
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec34
|
| 1022 |
layer->setDrawableContentRect(IntRect(0, 0, 600, 340)); |
1047 |
layer->setDrawableContentRect(IntRect(0, 0, 600, 340)); |
| 1023 |
layer->setVisibleContentRect(IntRect(0, 0, 600, 340)); |
1048 |
layer->setVisibleContentRect(IntRect(0, 0, 600, 340)); |
| 1024 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
1049 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 1025 |
layer->setTexturePriorities(m_priorityCalculator); |
1050 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1026 |
m_textureManager->prioritizeTextures(); |
1051 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1027 |
layer->update(m_queue, &occluded, m_stats); |
|
|
| 1028 |
EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
1052 |
EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 1029 |
|
1053 |
|
| 1030 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
1054 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 1035-1040
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec35
|
| 1035 |
|
1059 |
|
| 1036 |
TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) |
1060 |
TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) |
| 1037 |
{ |
1061 |
{ |
|
|
1062 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 1038 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
1063 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 1039 |
TestCCOcclusionTracker occluded; |
1064 |
TestCCOcclusionTracker occluded; |
| 1040 |
|
1065 |
|
|
Lines 1046-1070
TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec36
|
| 1046 |
layer->setDrawableContentRect(IntRect(0, 0, 600, 600)); |
1071 |
layer->setDrawableContentRect(IntRect(0, 0, 600, 600)); |
| 1047 |
layer->setVisibleContentRect(IntRect(0, 0, 600, 600)); |
1072 |
layer->setVisibleContentRect(IntRect(0, 0, 600, 600)); |
| 1048 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
1073 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 1049 |
layer->setTexturePriorities(m_priorityCalculator); |
1074 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1050 |
m_textureManager->prioritizeTextures(); |
1075 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1051 |
layer->update(m_queue, &occluded, m_stats); |
|
|
| 1052 |
EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
1076 |
EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 1053 |
{ |
1077 |
updateTextures(); |
| 1054 |
DebugScopedSetImplThread implThread; |
|
|
| 1055 |
updateTextures(); |
| 1056 |
} |
| 1057 |
|
1078 |
|
| 1058 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
1079 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
| 1059 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000, 1); |
1080 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000, 1); |
| 1060 |
EXPECT_EQ(3, occluded.overdrawMetrics().tilesCulledForUpload()); |
1081 |
EXPECT_EQ(3, occluded.overdrawMetrics().tilesCulledForUpload()); |
| 1061 |
|
1082 |
|
| 1062 |
layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); |
1083 |
layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); |
| 1063 |
layer->setTexturePriorities(m_priorityCalculator); |
1084 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1064 |
m_textureManager->prioritizeTextures(); |
|
|
| 1065 |
|
1085 |
|
| 1066 |
// Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. |
1086 |
// Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. |
| 1067 |
layer->update(m_queue, &occluded, m_stats); |
1087 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1068 |
EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
1088 |
EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 1069 |
|
1089 |
|
| 1070 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
1090 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 1074-1079
TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec37
|
| 1074 |
|
1094 |
|
| 1075 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) |
1095 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) |
| 1076 |
{ |
1096 |
{ |
|
|
1097 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 1077 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
1098 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 1078 |
TestCCOcclusionTracker occluded; |
1099 |
TestCCOcclusionTracker occluded; |
| 1079 |
|
1100 |
|
|
Lines 1091-1099
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec38
|
| 1091 |
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds())); |
1112 |
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds())); |
| 1092 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
1113 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
| 1093 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
1114 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 1094 |
layer->setTexturePriorities(m_priorityCalculator); |
1115 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1095 |
m_textureManager->prioritizeTextures(); |
1116 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1096 |
layer->update(m_queue, &occluded, m_stats); |
|
|
| 1097 |
EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
1117 |
EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 1098 |
|
1118 |
|
| 1099 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
1119 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 1103-1108
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec39
|
| 1103 |
|
1123 |
|
| 1104 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) |
1124 |
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) |
| 1105 |
{ |
1125 |
{ |
|
|
1126 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 1106 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
1127 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 1107 |
TestCCOcclusionTracker occluded; |
1128 |
TestCCOcclusionTracker occluded; |
| 1108 |
|
1129 |
|
|
Lines 1122-1130
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec40
|
| 1122 |
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds())); |
1143 |
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds())); |
| 1123 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
1144 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
| 1124 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
1145 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 1125 |
layer->setTexturePriorities(m_priorityCalculator); |
1146 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1126 |
m_textureManager->prioritizeTextures(); |
1147 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1127 |
layer->update(m_queue, &occluded, m_stats); |
|
|
| 1128 |
// The content is half the size of the layer (so the number of tiles is fewer). |
1148 |
// The content is half the size of the layer (so the number of tiles is fewer). |
| 1129 |
// In this case, the content is 300x300, and since the tile size is 100, the |
1149 |
// In this case, the content is 300x300, and since the tile size is 100, the |
| 1130 |
// number of tiles 3x3. |
1150 |
// number of tiles 3x3. |
|
Lines 1143-1151
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec41
|
| 1143 |
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds())); |
1163 |
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds())); |
| 1144 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
1164 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
| 1145 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
1165 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 1146 |
layer->setTexturePriorities(m_priorityCalculator); |
1166 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1147 |
m_textureManager->prioritizeTextures(); |
1167 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1148 |
layer->update(m_queue, &occluded, m_stats); |
|
|
| 1149 |
EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
1168 |
EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 1150 |
|
1169 |
|
| 1151 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
1170 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 1164-1172
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec42
|
| 1164 |
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds())); |
1183 |
layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds())); |
| 1165 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
1184 |
layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds())); |
| 1166 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
1185 |
layer->invalidateContentRect(IntRect(0, 0, 600, 600)); |
| 1167 |
layer->setTexturePriorities(m_priorityCalculator); |
1186 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1168 |
m_textureManager->prioritizeTextures(); |
1187 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1169 |
layer->update(m_queue, &occluded, m_stats); |
|
|
| 1170 |
EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
1188 |
EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); |
| 1171 |
|
1189 |
|
| 1172 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
1190 |
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); |
|
Lines 1176-1184
TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec43
|
| 1176 |
|
1194 |
|
| 1177 |
TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) |
1195 |
TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) |
| 1178 |
{ |
1196 |
{ |
|
|
1197 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 1179 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
1198 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 1180 |
TestCCOcclusionTracker occluded; |
1199 |
TestCCOcclusionTracker occluded; |
| 1181 |
DebugScopedSetImplThread implThread; |
|
|
| 1182 |
|
1200 |
|
| 1183 |
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways. |
1201 |
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways. |
| 1184 |
|
1202 |
|
|
Lines 1193-1205
TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec44
|
| 1193 |
layer->setVisibleContentRect(visibleBounds); |
1211 |
layer->setVisibleContentRect(visibleBounds); |
| 1194 |
layer->setDrawOpacity(1); |
1212 |
layer->setDrawOpacity(1); |
| 1195 |
|
1213 |
|
| 1196 |
layer->setTexturePriorities(m_priorityCalculator); |
1214 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1197 |
m_textureManager->prioritizeTextures(); |
|
|
| 1198 |
|
1215 |
|
| 1199 |
// If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. |
1216 |
// If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. |
| 1200 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
1217 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
| 1201 |
layer->invalidateContentRect(contentBounds); |
1218 |
layer->invalidateContentRect(contentBounds); |
| 1202 |
layer->update(m_queue, &occluded, m_stats); |
1219 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1203 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
1220 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
| 1204 |
EXPECT_TRUE(opaqueContents.isEmpty()); |
1221 |
EXPECT_TRUE(opaqueContents.isEmpty()); |
| 1205 |
|
1222 |
|
|
Lines 1212-1218
TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec45
|
| 1212 |
opaquePaintRect = IntRect(10, 10, 90, 190); |
1229 |
opaquePaintRect = IntRect(10, 10, 90, 190); |
| 1213 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); |
1230 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); |
| 1214 |
layer->invalidateContentRect(contentBounds); |
1231 |
layer->invalidateContentRect(contentBounds); |
| 1215 |
layer->update(m_queue, &occluded, m_stats); |
1232 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1216 |
updateTextures(); |
1233 |
updateTextures(); |
| 1217 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
1234 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
| 1218 |
EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); |
1235 |
EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); |
|
Lines 1225-1231
TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec46
|
| 1225 |
|
1242 |
|
| 1226 |
// If we paint again without invalidating, the same stuff should be opaque. |
1243 |
// If we paint again without invalidating, the same stuff should be opaque. |
| 1227 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
1244 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
| 1228 |
layer->update(m_queue, &occluded, m_stats); |
1245 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1229 |
updateTextures(); |
1246 |
updateTextures(); |
| 1230 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
1247 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
| 1231 |
EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); |
1248 |
EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); |
|
Lines 1240-1246
TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec47
|
| 1240 |
// not be affected. |
1257 |
// not be affected. |
| 1241 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
1258 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
| 1242 |
layer->invalidateContentRect(IntRect(0, 0, 1, 1)); |
1259 |
layer->invalidateContentRect(IntRect(0, 0, 1, 1)); |
| 1243 |
layer->update(m_queue, &occluded, m_stats); |
1260 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1244 |
updateTextures(); |
1261 |
updateTextures(); |
| 1245 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
1262 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
| 1246 |
EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); |
1263 |
EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); |
|
Lines 1255-1261
TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec48
|
| 1255 |
// not be affected. |
1272 |
// not be affected. |
| 1256 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
1273 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
| 1257 |
layer->invalidateContentRect(IntRect(10, 10, 1, 1)); |
1274 |
layer->invalidateContentRect(IntRect(10, 10, 1, 1)); |
| 1258 |
layer->update(m_queue, &occluded, m_stats); |
1275 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1259 |
updateTextures(); |
1276 |
updateTextures(); |
| 1260 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
1277 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
| 1261 |
EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); |
1278 |
EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); |
|
Lines 1269-1277
TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec49
|
| 1269 |
|
1286 |
|
| 1270 |
TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) |
1287 |
TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) |
| 1271 |
{ |
1288 |
{ |
|
|
1289 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 1272 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
1290 |
RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); |
| 1273 |
TestCCOcclusionTracker occluded; |
1291 |
TestCCOcclusionTracker occluded; |
| 1274 |
DebugScopedSetImplThread implThread; |
|
|
| 1275 |
|
1292 |
|
| 1276 |
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways. |
1293 |
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways. |
| 1277 |
|
1294 |
|
|
Lines 1286-1298
TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec50
|
| 1286 |
layer->setVisibleContentRect(visibleBounds); |
1303 |
layer->setVisibleContentRect(visibleBounds); |
| 1287 |
layer->setDrawOpacity(1); |
1304 |
layer->setDrawOpacity(1); |
| 1288 |
|
1305 |
|
| 1289 |
layer->setTexturePriorities(m_priorityCalculator); |
1306 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1290 |
m_textureManager->prioritizeTextures(); |
|
|
| 1291 |
|
1307 |
|
| 1292 |
// Invalidates and paints the whole layer. |
1308 |
// Invalidates and paints the whole layer. |
| 1293 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
1309 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
| 1294 |
layer->invalidateContentRect(contentBounds); |
1310 |
layer->invalidateContentRect(contentBounds); |
| 1295 |
layer->update(m_queue, &occluded, m_stats); |
1311 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1296 |
updateTextures(); |
1312 |
updateTextures(); |
| 1297 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
1313 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
| 1298 |
EXPECT_TRUE(opaqueContents.isEmpty()); |
1314 |
EXPECT_TRUE(opaqueContents.isEmpty()); |
|
Lines 1307-1313
TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec51
|
| 1307 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
1323 |
layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); |
| 1308 |
layer->invalidateContentRect(IntRect(0, 0, 1, 1)); |
1324 |
layer->invalidateContentRect(IntRect(0, 0, 1, 1)); |
| 1309 |
layer->invalidateContentRect(IntRect(50, 200, 10, 10)); |
1325 |
layer->invalidateContentRect(IntRect(50, 200, 10, 10)); |
| 1310 |
layer->update(m_queue, &occluded, m_stats); |
1326 |
updateLayerOnMainThread(layer.get(), &occluded); |
| 1311 |
updateTextures(); |
1327 |
updateTextures(); |
| 1312 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
1328 |
opaqueContents = layer->visibleContentOpaqueRegion(); |
| 1313 |
EXPECT_TRUE(opaqueContents.isEmpty()); |
1329 |
EXPECT_TRUE(opaqueContents.isEmpty()); |
|
Lines 1322-1330
TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec52
|
| 1322 |
|
1338 |
|
| 1323 |
TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) |
1339 |
TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) |
| 1324 |
{ |
1340 |
{ |
| 1325 |
// Initialize without threading support. |
|
|
| 1326 |
WebKit::WebCompositor::initialize(0); |
| 1327 |
|
| 1328 |
// Tile size is 100x100. |
1341 |
// Tile size is 100x100. |
| 1329 |
IntRect rootRect(0, 0, 300, 200); |
1342 |
IntRect rootRect(0, 0, 300, 200); |
| 1330 |
IntRect childRect(0, 0, 300, 100); |
1343 |
IntRect childRect(0, 0, 300, 100); |
|
Lines 1335-1379
TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec53
|
| 1335 |
OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings); |
1348 |
OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings); |
| 1336 |
ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); |
1349 |
ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); |
| 1337 |
|
1350 |
|
| 1338 |
RefPtr<FakeTiledLayerChromium> root = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
|
|
| 1339 |
RefPtr<LayerChromium> surface = LayerChromium::create(); |
| 1340 |
RefPtr<FakeTiledLayerChromium> child = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
| 1341 |
RefPtr<FakeTiledLayerChromium> child2 = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
| 1342 |
|
| 1343 |
root->setBounds(rootRect.size()); |
| 1344 |
root->setAnchorPoint(FloatPoint()); |
| 1345 |
root->setDrawableContentRect(rootRect); |
| 1346 |
root->setVisibleContentRect(rootRect); |
| 1347 |
root->addChild(surface); |
| 1348 |
|
| 1349 |
surface->setForceRenderSurface(true); |
| 1350 |
surface->setAnchorPoint(FloatPoint()); |
| 1351 |
surface->setOpacity(0.5); |
| 1352 |
surface->addChild(child); |
| 1353 |
surface->addChild(child2); |
| 1354 |
|
| 1355 |
child->setBounds(childRect.size()); |
| 1356 |
child->setAnchorPoint(FloatPoint()); |
| 1357 |
child->setPosition(childRect.location()); |
| 1358 |
child->setVisibleContentRect(childRect); |
| 1359 |
child->setDrawableContentRect(rootRect); |
| 1360 |
|
| 1361 |
child2->setBounds(child2Rect.size()); |
| 1362 |
child2->setAnchorPoint(FloatPoint()); |
| 1363 |
child2->setPosition(child2Rect.location()); |
| 1364 |
child2->setVisibleContentRect(child2Rect); |
| 1365 |
child2->setDrawableContentRect(rootRect); |
| 1366 |
|
| 1367 |
ccLayerTreeHost->setRootLayer(root); |
| 1368 |
ccLayerTreeHost->setViewportSize(rootRect.size(), rootRect.size()); |
| 1369 |
|
| 1370 |
// With a huge memory limit, all layers should update and push their textures. |
| 1371 |
root->invalidateContentRect(rootRect); |
| 1372 |
child->invalidateContentRect(childRect); |
| 1373 |
child2->invalidateContentRect(child2Rect); |
| 1374 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
| 1375 |
{ |
1351 |
{ |
| 1376 |
DebugScopedSetImplThread implThread; |
1352 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
|
|
1353 |
RefPtr<FakeTiledLayerChromium> root = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
| 1354 |
RefPtr<LayerChromium> surface = LayerChromium::create(); |
| 1355 |
RefPtr<FakeTiledLayerChromium> child = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
| 1356 |
RefPtr<FakeTiledLayerChromium> child2 = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); |
| 1357 |
|
| 1358 |
{ |
| 1359 |
DebugScopedSetMainThread mainThread; |
| 1360 |
|
| 1361 |
root->setBounds(rootRect.size()); |
| 1362 |
root->setAnchorPoint(FloatPoint()); |
| 1363 |
root->setDrawableContentRect(rootRect); |
| 1364 |
root->setVisibleContentRect(rootRect); |
| 1365 |
root->addChild(surface); |
| 1366 |
|
| 1367 |
surface->setForceRenderSurface(true); |
| 1368 |
surface->setAnchorPoint(FloatPoint()); |
| 1369 |
surface->setOpacity(0.5); |
| 1370 |
surface->addChild(child); |
| 1371 |
surface->addChild(child2); |
| 1372 |
|
| 1373 |
child->setBounds(childRect.size()); |
| 1374 |
child->setAnchorPoint(FloatPoint()); |
| 1375 |
child->setPosition(childRect.location()); |
| 1376 |
child->setVisibleContentRect(childRect); |
| 1377 |
child->setDrawableContentRect(rootRect); |
| 1378 |
|
| 1379 |
child2->setBounds(child2Rect.size()); |
| 1380 |
child2->setAnchorPoint(FloatPoint()); |
| 1381 |
child2->setPosition(child2Rect.location()); |
| 1382 |
child2->setVisibleContentRect(child2Rect); |
| 1383 |
child2->setDrawableContentRect(rootRect); |
| 1384 |
|
| 1385 |
ccLayerTreeHost->setRootLayer(root); |
| 1386 |
ccLayerTreeHost->setViewportSize(rootRect.size(), rootRect.size()); |
| 1387 |
|
| 1388 |
// With a huge memory limit, all layers should update and push their textures. |
| 1389 |
root->invalidateContentRect(rootRect); |
| 1390 |
child->invalidateContentRect(childRect); |
| 1391 |
child2->invalidateContentRect(child2Rect); |
| 1392 |
ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); |
| 1393 |
} |
| 1394 |
|
| 1377 |
updateTextures(1000); |
1395 |
updateTextures(1000); |
| 1378 |
EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); |
1396 |
EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); |
| 1379 |
EXPECT_EQ(3, child->fakeLayerTextureUpdater()->updateCount()); |
1397 |
EXPECT_EQ(3, child->fakeLayerTextureUpdater()->updateCount()); |
|
Lines 1384-1414
TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec54
|
| 1384 |
child->fakeLayerTextureUpdater()->clearUpdateCount(); |
1402 |
child->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1385 |
child2->fakeLayerTextureUpdater()->clearUpdateCount(); |
1403 |
child2->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1386 |
|
1404 |
|
| 1387 |
OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); |
1405 |
{ |
| 1388 |
OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); |
1406 |
OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); |
| 1389 |
OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); |
1407 |
OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); |
| 1390 |
root->pushPropertiesTo(rootImpl.get()); |
1408 |
OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); |
| 1391 |
child->pushPropertiesTo(childImpl.get()); |
1409 |
root->pushPropertiesTo(rootImpl.get()); |
| 1392 |
child2->pushPropertiesTo(child2Impl.get()); |
1410 |
child->pushPropertiesTo(childImpl.get()); |
| 1393 |
|
1411 |
child2->pushPropertiesTo(child2Impl.get()); |
| 1394 |
for (unsigned i = 0; i < 3; ++i) { |
1412 |
|
| 1395 |
for (unsigned j = 0; j < 2; ++j) |
1413 |
for (unsigned i = 0; i < 3; ++i) { |
| 1396 |
EXPECT_TRUE(rootImpl->hasTextureIdForTileAt(i, j)); |
1414 |
for (unsigned j = 0; j < 2; ++j) |
| 1397 |
EXPECT_TRUE(childImpl->hasTextureIdForTileAt(i, 0)); |
1415 |
EXPECT_TRUE(rootImpl->hasTextureIdForTileAt(i, j)); |
| 1398 |
EXPECT_TRUE(child2Impl->hasTextureIdForTileAt(i, 0)); |
1416 |
EXPECT_TRUE(childImpl->hasTextureIdForTileAt(i, 0)); |
|
|
1417 |
EXPECT_TRUE(child2Impl->hasTextureIdForTileAt(i, 0)); |
| 1418 |
} |
| 1399 |
} |
1419 |
} |
| 1400 |
} |
1420 |
ccLayerTreeHost->commitComplete(); |
| 1401 |
ccLayerTreeHost->commitComplete(); |
1421 |
|
| 1402 |
|
1422 |
// With a memory limit that includes only the root layer (3x2 tiles) and half the surface that |
| 1403 |
// With a memory limit that includes only the root layer (3x2 tiles) and half the surface that |
1423 |
// the child layers draw into, the child layers will not be allocated. If the surface isn't |
| 1404 |
// the child layers draw into, the child layers will not be allocated. If the surface isn't |
1424 |
// accounted for, then one of the children would fit within the memory limit. |
| 1405 |
// accounted for, then one of the children would fit within the memory limit. |
1425 |
{ |
| 1406 |
root->invalidateContentRect(rootRect); |
1426 |
DebugScopedSetMainThread mainThread; |
| 1407 |
child->invalidateContentRect(childRect); |
1427 |
root->invalidateContentRect(rootRect); |
| 1408 |
child2->invalidateContentRect(child2Rect); |
1428 |
child->invalidateContentRect(childRect); |
| 1409 |
ccLayerTreeHost->updateLayers(m_queue, (3 * 2 + 3 * 1) * (100 * 100) * 4); |
1429 |
child2->invalidateContentRect(child2Rect); |
| 1410 |
{ |
1430 |
ccLayerTreeHost->updateLayers(m_queue, (3 * 2 + 3 * 1) * (100 * 100) * 4); |
| 1411 |
DebugScopedSetImplThread implThread; |
1431 |
} |
|
|
1432 |
|
| 1412 |
updateTextures(1000); |
1433 |
updateTextures(1000); |
| 1413 |
EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); |
1434 |
EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); |
| 1414 |
EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); |
1435 |
EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); |
|
Lines 1419-1483
TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec55
|
| 1419 |
child->fakeLayerTextureUpdater()->clearUpdateCount(); |
1440 |
child->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1420 |
child2->fakeLayerTextureUpdater()->clearUpdateCount(); |
1441 |
child2->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1421 |
|
1442 |
|
| 1422 |
OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); |
1443 |
{ |
| 1423 |
OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); |
1444 |
OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); |
| 1424 |
OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); |
1445 |
OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); |
| 1425 |
root->pushPropertiesTo(rootImpl.get()); |
1446 |
OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); |
| 1426 |
child->pushPropertiesTo(childImpl.get()); |
1447 |
root->pushPropertiesTo(rootImpl.get()); |
| 1427 |
child2->pushPropertiesTo(child2Impl.get()); |
1448 |
child->pushPropertiesTo(childImpl.get()); |
| 1428 |
|
1449 |
child2->pushPropertiesTo(child2Impl.get()); |
| 1429 |
for (unsigned i = 0; i < 3; ++i) { |
1450 |
|
| 1430 |
for (unsigned j = 0; j < 2; ++j) |
1451 |
for (unsigned i = 0; i < 3; ++i) { |
| 1431 |
EXPECT_TRUE(rootImpl->hasTextureIdForTileAt(i, j)); |
1452 |
for (unsigned j = 0; j < 2; ++j) |
| 1432 |
EXPECT_FALSE(childImpl->hasTextureIdForTileAt(i, 0)); |
1453 |
EXPECT_TRUE(rootImpl->hasTextureIdForTileAt(i, j)); |
| 1433 |
EXPECT_FALSE(child2Impl->hasTextureIdForTileAt(i, 0)); |
1454 |
EXPECT_FALSE(childImpl->hasTextureIdForTileAt(i, 0)); |
|
|
1455 |
EXPECT_FALSE(child2Impl->hasTextureIdForTileAt(i, 0)); |
| 1456 |
} |
| 1434 |
} |
1457 |
} |
| 1435 |
} |
1458 |
ccLayerTreeHost->commitComplete(); |
| 1436 |
ccLayerTreeHost->commitComplete(); |
1459 |
|
| 1437 |
|
1460 |
// With a memory limit that includes only half the root layer, no contents will be |
| 1438 |
// With a memory limit that includes only half the root layer, no contents will be |
1461 |
// allocated. If render surface memory wasn't accounted for, there is enough space |
| 1439 |
// allocated. If render surface memory wasn't accounted for, there is enough space |
1462 |
// for one of the children layers, but they draw into a surface that can't be |
| 1440 |
// for one of the children layers, but they draw into a surface that can't be |
1463 |
// allocated. |
| 1441 |
// allocated. |
1464 |
{ |
| 1442 |
root->invalidateContentRect(rootRect); |
1465 |
DebugScopedSetMainThread mainThread; |
| 1443 |
child->invalidateContentRect(childRect); |
1466 |
root->invalidateContentRect(rootRect); |
| 1444 |
child2->invalidateContentRect(child2Rect); |
1467 |
child->invalidateContentRect(childRect); |
| 1445 |
ccLayerTreeHost->updateLayers(m_queue, (3 * 1) * (100 * 100) * 4); |
1468 |
child2->invalidateContentRect(child2Rect); |
| 1446 |
{ |
1469 |
ccLayerTreeHost->updateLayers(m_queue, (3 * 1) * (100 * 100) * 4); |
| 1447 |
DebugScopedSetImplThread implThread; |
|
|
| 1448 |
updateTextures(1000); |
| 1449 |
EXPECT_EQ(0, root->fakeLayerTextureUpdater()->updateCount()); |
| 1450 |
EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); |
| 1451 |
EXPECT_EQ(0, child2->fakeLayerTextureUpdater()->updateCount()); |
| 1452 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 1453 |
|
| 1454 |
root->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1455 |
child->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1456 |
child2->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1457 |
|
| 1458 |
OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); |
| 1459 |
OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); |
| 1460 |
OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); |
| 1461 |
root->pushPropertiesTo(rootImpl.get()); |
| 1462 |
child->pushPropertiesTo(childImpl.get()); |
| 1463 |
child2->pushPropertiesTo(child2Impl.get()); |
| 1464 |
|
| 1465 |
for (unsigned i = 0; i < 3; ++i) { |
| 1466 |
for (unsigned j = 0; j < 2; ++j) |
| 1467 |
EXPECT_FALSE(rootImpl->hasTextureIdForTileAt(i, j)); |
| 1468 |
EXPECT_FALSE(childImpl->hasTextureIdForTileAt(i, 0)); |
| 1469 |
EXPECT_FALSE(child2Impl->hasTextureIdForTileAt(i, 0)); |
| 1470 |
} |
1470 |
} |
| 1471 |
} |
1471 |
{ |
| 1472 |
ccLayerTreeHost->commitComplete(); |
1472 |
updateTextures(1000); |
| 1473 |
|
1473 |
EXPECT_EQ(0, root->fakeLayerTextureUpdater()->updateCount()); |
| 1474 |
{ |
1474 |
EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); |
| 1475 |
DebugScopedSetImplThread implThread; |
1475 |
EXPECT_EQ(0, child2->fakeLayerTextureUpdater()->updateCount()); |
|
|
1476 |
EXPECT_FALSE(m_queue.hasMoreUpdates()); |
| 1477 |
|
| 1478 |
root->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1479 |
child->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1480 |
child2->fakeLayerTextureUpdater()->clearUpdateCount(); |
| 1481 |
|
| 1482 |
OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); |
| 1483 |
OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); |
| 1484 |
OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); |
| 1485 |
root->pushPropertiesTo(rootImpl.get()); |
| 1486 |
child->pushPropertiesTo(childImpl.get()); |
| 1487 |
child2->pushPropertiesTo(child2Impl.get()); |
| 1488 |
|
| 1489 |
for (unsigned i = 0; i < 3; ++i) { |
| 1490 |
for (unsigned j = 0; j < 2; ++j) |
| 1491 |
EXPECT_FALSE(rootImpl->hasTextureIdForTileAt(i, j)); |
| 1492 |
EXPECT_FALSE(childImpl->hasTextureIdForTileAt(i, 0)); |
| 1493 |
EXPECT_FALSE(child2Impl->hasTextureIdForTileAt(i, 0)); |
| 1494 |
} |
| 1495 |
} |
| 1496 |
ccLayerTreeHost->commitComplete(); |
| 1476 |
ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); |
1497 |
ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); |
| 1477 |
} |
1498 |
} |
| 1478 |
ccLayerTreeHost->setRootLayer(0); |
1499 |
ccLayerTreeHost->setRootLayer(0); |
| 1479 |
ccLayerTreeHost.clear(); |
1500 |
ccLayerTreeHost.clear(); |
| 1480 |
WebKit::WebCompositor::shutdown(); |
|
|
| 1481 |
} |
1501 |
} |
| 1482 |
|
1502 |
|
| 1483 |
class TrackingLayerPainter : public LayerPainterChromium { |
1503 |
class TrackingLayerPainter : public LayerPainterChromium { |
|
Lines 1521-1526
private:
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec56
|
| 1521 |
|
1541 |
|
| 1522 |
TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) |
1542 |
TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) |
| 1523 |
{ |
1543 |
{ |
|
|
1544 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 1524 |
RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get())); |
1545 |
RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get())); |
| 1525 |
|
1546 |
|
| 1526 |
IntRect layerRect(0, 0, 30, 31); |
1547 |
IntRect layerRect(0, 0, 30, 31); |
|
Lines 1533-1561
TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec57
|
| 1533 |
layer->setVisibleContentRect(contentRect); |
1554 |
layer->setVisibleContentRect(contentRect); |
| 1534 |
layer->setDrawableContentRect(contentRect); |
1555 |
layer->setDrawableContentRect(contentRect); |
| 1535 |
|
1556 |
|
| 1536 |
layer->setTexturePriorities(m_priorityCalculator); |
1557 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1537 |
m_textureManager->prioritizeTextures(); |
|
|
| 1538 |
|
1558 |
|
| 1539 |
// Update the whole tile. |
1559 |
// Update the whole tile. |
| 1540 |
layer->update(m_queue, 0, m_stats); |
1560 |
updateLayerOnMainThread(layer.get(), 0); |
| 1541 |
layer->trackingLayerPainter()->resetPaintedRect(); |
1561 |
layer->trackingLayerPainter()->resetPaintedRect(); |
| 1542 |
|
1562 |
|
| 1543 |
EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); |
1563 |
EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); |
| 1544 |
|
1564 |
|
| 1545 |
{ |
1565 |
updateTextures(); |
| 1546 |
DebugScopedSetImplThread implThread; |
|
|
| 1547 |
updateTextures(); |
| 1548 |
} |
| 1549 |
|
1566 |
|
| 1550 |
// Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. |
1567 |
// Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. |
| 1551 |
layer->invalidateContentRect(contentRect); |
1568 |
layer->invalidateContentRect(contentRect); |
| 1552 |
layer->update(m_queue, 0, m_stats); |
1569 |
updateLayerOnMainThread(layer.get(), 0); |
| 1553 |
|
1570 |
|
| 1554 |
EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
1571 |
EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
| 1555 |
} |
1572 |
} |
| 1556 |
|
1573 |
|
| 1557 |
TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation) |
1574 |
TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation) |
| 1558 |
{ |
1575 |
{ |
|
|
1576 |
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; |
| 1559 |
RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get())); |
1577 |
RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get())); |
| 1560 |
|
1578 |
|
| 1561 |
IntRect layerRect(0, 0, 30, 31); |
1579 |
IntRect layerRect(0, 0, 30, 31); |
|
Lines 1567-1589
TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali
a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp_sec58
|
| 1567 |
layer->setVisibleContentRect(contentRect); |
1585 |
layer->setVisibleContentRect(contentRect); |
| 1568 |
layer->setDrawableContentRect(contentRect); |
1586 |
layer->setDrawableContentRect(contentRect); |
| 1569 |
|
1587 |
|
| 1570 |
layer->setTexturePriorities(m_priorityCalculator); |
1588 |
setTexturePrioritiesAndPrioritizeTexturesOnMainThread(layer.get()); |
| 1571 |
m_textureManager->prioritizeTextures(); |
|
|
| 1572 |
|
1589 |
|
| 1573 |
// Update the whole tile. |
1590 |
// Update the whole tile. |
| 1574 |
layer->update(m_queue, 0, m_stats); |
1591 |
updateLayerOnMainThread(layer.get(), 0); |
| 1575 |
layer->trackingLayerPainter()->resetPaintedRect(); |
1592 |
layer->trackingLayerPainter()->resetPaintedRect(); |
| 1576 |
|
1593 |
|
| 1577 |
EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); |
1594 |
EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); |
| 1578 |
|
1595 |
|
| 1579 |
{ |
1596 |
updateTextures(); |
| 1580 |
DebugScopedSetImplThread implThread; |
|
|
| 1581 |
updateTextures(); |
| 1582 |
} |
| 1583 |
|
1597 |
|
| 1584 |
// Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. |
1598 |
// Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. |
| 1585 |
layer->setNeedsDisplayRect(layerRect); |
1599 |
layer->setNeedsDisplayRect(layerRect); |
| 1586 |
layer->update(m_queue, 0, m_stats); |
1600 |
updateLayerOnMainThread(layer.get(), 0); |
| 1587 |
|
1601 |
|
| 1588 |
EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
1602 |
EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
| 1589 |
} |
1603 |
} |