| Index: cc/CCLayerTreeHostTest.cpp
|
| diff --git a/cc/CCLayerTreeHostTest.cpp b/cc/CCLayerTreeHostTest.cpp
|
| index 792d0a514786733df4336ba50e92bd752c4303e8..fbde9db1d56efe3e353fdd855cc235af6f129264 100644
|
| --- a/cc/CCLayerTreeHostTest.cpp
|
| +++ b/cc/CCLayerTreeHostTest.cpp
|
| @@ -2394,28 +2394,6 @@ private:
|
| SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit)
|
|
|
|
|
| -class EvictionTrackingTexture : public LayerTextureUpdater::Texture {
|
| -public:
|
| - static PassOwnPtr<EvictionTrackingTexture> create(PassOwnPtr<CCPrioritizedTexture> texture) { return adoptPtr(new EvictionTrackingTexture(texture)); }
|
| - virtual ~EvictionTrackingTexture() { }
|
| -
|
| - virtual void updateRect(CCResourceProvider* resourceProvider, const IntRect&, const IntSize&) OVERRIDE
|
| - {
|
| - ASSERT_TRUE(!texture()->haveBackingTexture() || resourceProvider->numResources() > 0);
|
| - texture()->acquireBackingTexture(resourceProvider);
|
| - m_updated = true;
|
| - }
|
| - void resetUpdated() { m_updated = false; }
|
| - bool updated() const { return m_updated; }
|
| -
|
| -private:
|
| - explicit EvictionTrackingTexture(PassOwnPtr<CCPrioritizedTexture> texture)
|
| - : LayerTextureUpdater::Texture(texture)
|
| - , m_updated(false)
|
| - { }
|
| - bool m_updated;
|
| -};
|
| -
|
| class EvictionTestLayer : public LayerChromium {
|
| public:
|
| static PassRefPtr<EvictionTestLayer> create() { return adoptRef(new EvictionTestLayer()); }
|
| @@ -2427,12 +2405,7 @@ public:
|
| virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE;
|
| virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
|
|
|
| - void resetUpdated()
|
| - {
|
| - if (m_texture.get())
|
| - m_texture->resetUpdated();
|
| - }
|
| - bool updated() const { return m_texture.get() ? m_texture->updated() : false; }
|
| + bool haveBackingTexture() const { return m_texture.get() ? m_texture->haveBackingTexture() : false; }
|
|
|
| private:
|
| EvictionTestLayer() : LayerChromium() { }
|
| @@ -2441,11 +2414,13 @@ private:
|
| {
|
| if (m_texture.get())
|
| return;
|
| - m_texture = EvictionTrackingTexture::create(CCPrioritizedTexture::create(layerTreeHost()->contentsTextureManager()));
|
| - m_texture->texture()->setDimensions(IntSize(10, 10), cc::GraphicsContext3D::RGBA);
|
| + m_texture = CCPrioritizedTexture::create(layerTreeHost()->contentsTextureManager());
|
| + m_texture->setDimensions(IntSize(10, 10), cc::GraphicsContext3D::RGBA);
|
| + m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
|
| }
|
|
|
| - OwnPtr<EvictionTrackingTexture> m_texture;
|
| + OwnPtr<CCPrioritizedTexture> m_texture;
|
| + SkBitmap m_bitmap;
|
| };
|
|
|
| class EvictionTestLayerImpl : public CCLayerImpl {
|
| @@ -2477,7 +2452,7 @@ void EvictionTestLayer::setTexturePriorities(const CCPriorityCalculator&)
|
| createTextureIfNeeded();
|
| if (!m_texture.get())
|
| return;
|
| - m_texture->texture()->setRequestPriority(CCPriorityCalculator::uiPriority(true));
|
| + m_texture->setRequestPriority(CCPriorityCalculator::uiPriority(true));
|
| }
|
|
|
| void EvictionTestLayer::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker*, CCRenderingStats&)
|
| @@ -2486,8 +2461,8 @@ void EvictionTestLayer::update(CCTextureUpdateQueue& queue, const CCOcclusionTra
|
| if (!m_texture.get())
|
| return;
|
| IntRect fullRect(0, 0, 10, 10);
|
| - TextureUploader::Parameters parameters = { m_texture.get(), fullRect, IntSize() };
|
| - queue.appendFullUpload(parameters);
|
| + TextureUploader::Parameters upload = { m_texture.get(), &m_bitmap, NULL, { fullRect, fullRect, IntSize() } };
|
| + queue.appendFullUpload(upload);
|
| }
|
|
|
| PassOwnPtr<CCLayerImpl> EvictionTestLayer::createCCLayerImpl()
|
| @@ -2500,7 +2475,7 @@ void EvictionTestLayer::pushPropertiesTo(CCLayerImpl* layerImpl)
|
| LayerChromium::pushPropertiesTo(layerImpl);
|
|
|
| EvictionTestLayerImpl* testLayerImpl = static_cast<EvictionTestLayerImpl*>(layerImpl);
|
| - testLayerImpl->setHasTexture(m_texture->texture()->haveBackingTexture());
|
| + testLayerImpl->setHasTexture(m_texture->haveBackingTexture());
|
| }
|
|
|
| class CCLayerTreeHostTestEvictTextures : public CCLayerTreeHostTest {
|
| @@ -2567,23 +2542,23 @@ public:
|
| {
|
| switch (m_numCommits) {
|
| case 1:
|
| - EXPECT_TRUE(m_layer->updated());
|
| + EXPECT_TRUE(m_layer->haveBackingTexture());
|
| postEvictTextures();
|
| break;
|
| case 2:
|
| - EXPECT_TRUE(m_layer->updated());
|
| + EXPECT_TRUE(m_layer->haveBackingTexture());
|
| m_layerTreeHost->setNeedsCommit();
|
| break;
|
| case 3:
|
| break;
|
| case 4:
|
| - EXPECT_TRUE(m_layer->updated());
|
| + EXPECT_TRUE(m_layer->haveBackingTexture());
|
| m_layerTreeHost->setNeedsCommit();
|
| break;
|
| case 5:
|
| break;
|
| case 6:
|
| - EXPECT_TRUE(m_layer->updated());
|
| + EXPECT_TRUE(m_layer->haveBackingTexture());
|
| endTest();
|
| break;
|
| default:
|
| @@ -2609,21 +2584,20 @@ public:
|
| break;
|
| case 4:
|
| // We couldn't check in didCommitAndDrawFrame on commit 3, so check here.
|
| - EXPECT_FALSE(m_layer->updated());
|
| + EXPECT_FALSE(m_layer->haveBackingTexture());
|
| break;
|
| case 5:
|
| postEvictTextures();
|
| break;
|
| case 6:
|
| // We couldn't check in didCommitAndDrawFrame on commit 5, so check here.
|
| - EXPECT_FALSE(m_layer->updated());
|
| + EXPECT_FALSE(m_layer->haveBackingTexture());
|
| postEvictTextures();
|
| break;
|
| default:
|
| ASSERT_NOT_REACHED();
|
| break;
|
| }
|
| - m_layer->resetUpdated();
|
| }
|
|
|
| virtual void afterTest() OVERRIDE
|
| @@ -2700,7 +2674,7 @@ public:
|
| ++m_numCommits;
|
| switch (m_numCommits) {
|
| case 1:
|
| - EXPECT_TRUE(m_layer->updated());
|
| + EXPECT_TRUE(m_layer->haveBackingTexture());
|
| m_layerTreeHost->setVisible(false);
|
| postEvictTextures();
|
| m_layerTreeHost->loseContext(1);
|
|
|