| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
| 8 | 8 |
| 9 #include "CCGeometryTestUtils.h" | 9 #include "CCGeometryTestUtils.h" |
| 10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
| (...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2421 bool m_updated; | 2421 bool m_updated; |
| 2422 }; | 2422 }; |
| 2423 | 2423 |
| 2424 class EvictionTestLayer : public LayerChromium { | 2424 class EvictionTestLayer : public LayerChromium { |
| 2425 public: | 2425 public: |
| 2426 static scoped_refptr<EvictionTestLayer> create() { return make_scoped_refptr
(new EvictionTestLayer()); } | 2426 static scoped_refptr<EvictionTestLayer> create() { return make_scoped_refptr
(new EvictionTestLayer()); } |
| 2427 | 2427 |
| 2428 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRend
eringStats&) OVERRIDE; | 2428 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRend
eringStats&) OVERRIDE; |
| 2429 virtual bool drawsContent() const OVERRIDE { return true; } | 2429 virtual bool drawsContent() const OVERRIDE { return true; } |
| 2430 | 2430 |
| 2431 virtual PassOwnPtr<CCLayerImpl> createCCLayerImpl() OVERRIDE; | 2431 virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; |
| 2432 virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; | 2432 virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; |
| 2433 virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; | 2433 virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; |
| 2434 | 2434 |
| 2435 void resetUpdated() | 2435 void resetUpdated() |
| 2436 { | 2436 { |
| 2437 if (m_texture.get()) | 2437 if (m_texture.get()) |
| 2438 m_texture->resetUpdated(); | 2438 m_texture->resetUpdated(); |
| 2439 } | 2439 } |
| 2440 bool updated() const { return m_texture.get() ? m_texture->updated() : false
; } | 2440 bool updated() const { return m_texture.get() ? m_texture->updated() : false
; } |
| 2441 | 2441 |
| 2442 private: | 2442 private: |
| 2443 EvictionTestLayer() : LayerChromium() { } | 2443 EvictionTestLayer() : LayerChromium() { } |
| 2444 virtual ~EvictionTestLayer() { } | 2444 virtual ~EvictionTestLayer() { } |
| 2445 | 2445 |
| 2446 void createTextureIfNeeded() | 2446 void createTextureIfNeeded() |
| 2447 { | 2447 { |
| 2448 if (m_texture.get()) | 2448 if (m_texture.get()) |
| 2449 return; | 2449 return; |
| 2450 m_texture = EvictionTrackingTexture::create(CCPrioritizedTexture::create
(layerTreeHost()->contentsTextureManager())); | 2450 m_texture = EvictionTrackingTexture::create(CCPrioritizedTexture::create
(layerTreeHost()->contentsTextureManager())); |
| 2451 m_texture->texture()->setDimensions(IntSize(10, 10), cc::GraphicsContext
3D::RGBA); | 2451 m_texture->texture()->setDimensions(IntSize(10, 10), cc::GraphicsContext
3D::RGBA); |
| 2452 } | 2452 } |
| 2453 | 2453 |
| 2454 OwnPtr<EvictionTrackingTexture> m_texture; | 2454 OwnPtr<EvictionTrackingTexture> m_texture; |
| 2455 }; | 2455 }; |
| 2456 | 2456 |
| 2457 class EvictionTestLayerImpl : public CCLayerImpl { | 2457 class EvictionTestLayerImpl : public CCLayerImpl { |
| 2458 public: | 2458 public: |
| 2459 static PassOwnPtr<EvictionTestLayerImpl> create(int id) | 2459 static scoped_ptr<EvictionTestLayerImpl> create(int id) |
| 2460 { | 2460 { |
| 2461 return adoptPtr(new EvictionTestLayerImpl(id)); | 2461 return make_scoped_ptr(new EvictionTestLayerImpl(id)); |
| 2462 } | 2462 } |
| 2463 virtual ~EvictionTestLayerImpl() { } | 2463 virtual ~EvictionTestLayerImpl() { } |
| 2464 | 2464 |
| 2465 virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData&) OVERRIDE | 2465 virtual void appendQuads(CCQuadSink& quadSink, CCAppendQuadsData&) OVERRIDE |
| 2466 { | 2466 { |
| 2467 ASSERT_TRUE(m_hasTexture); | 2467 ASSERT_TRUE(m_hasTexture); |
| 2468 ASSERT_NE(0u, layerTreeHostImpl()->resourceProvider()->numResources()); | 2468 ASSERT_NE(0u, layerTreeHostImpl()->resourceProvider()->numResources()); |
| 2469 } | 2469 } |
| 2470 | 2470 |
| 2471 void setHasTexture(bool hasTexture) { m_hasTexture = hasTexture; } | 2471 void setHasTexture(bool hasTexture) { m_hasTexture = hasTexture; } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2489 void EvictionTestLayer::update(CCTextureUpdateQueue& queue, const CCOcclusionTra
cker*, CCRenderingStats&) | 2489 void EvictionTestLayer::update(CCTextureUpdateQueue& queue, const CCOcclusionTra
cker*, CCRenderingStats&) |
| 2490 { | 2490 { |
| 2491 createTextureIfNeeded(); | 2491 createTextureIfNeeded(); |
| 2492 if (!m_texture.get()) | 2492 if (!m_texture.get()) |
| 2493 return; | 2493 return; |
| 2494 IntRect fullRect(0, 0, 10, 10); | 2494 IntRect fullRect(0, 0, 10, 10); |
| 2495 TextureUploader::Parameters parameters = { m_texture.get(), fullRect, IntSiz
e() }; | 2495 TextureUploader::Parameters parameters = { m_texture.get(), fullRect, IntSiz
e() }; |
| 2496 queue.appendFullUpload(parameters); | 2496 queue.appendFullUpload(parameters); |
| 2497 } | 2497 } |
| 2498 | 2498 |
| 2499 PassOwnPtr<CCLayerImpl> EvictionTestLayer::createCCLayerImpl() | 2499 scoped_ptr<CCLayerImpl> EvictionTestLayer::createCCLayerImpl() |
| 2500 { | 2500 { |
| 2501 return EvictionTestLayerImpl::create(m_layerId); | 2501 return EvictionTestLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); |
| 2502 } | 2502 } |
| 2503 | 2503 |
| 2504 void EvictionTestLayer::pushPropertiesTo(CCLayerImpl* layerImpl) | 2504 void EvictionTestLayer::pushPropertiesTo(CCLayerImpl* layerImpl) |
| 2505 { | 2505 { |
| 2506 LayerChromium::pushPropertiesTo(layerImpl); | 2506 LayerChromium::pushPropertiesTo(layerImpl); |
| 2507 | 2507 |
| 2508 EvictionTestLayerImpl* testLayerImpl = static_cast<EvictionTestLayerImpl*>(l
ayerImpl); | 2508 EvictionTestLayerImpl* testLayerImpl = static_cast<EvictionTestLayerImpl*>(l
ayerImpl); |
| 2509 testLayerImpl->setHasTexture(m_texture->texture()->haveBackingTexture()); | 2509 testLayerImpl->setHasTexture(m_texture->texture()->haveBackingTexture()); |
| 2510 } | 2510 } |
| 2511 | 2511 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 int m_numCommitComplete; | 2994 int m_numCommitComplete; |
| 2995 int m_numDrawLayers; | 2995 int m_numDrawLayers; |
| 2996 }; | 2996 }; |
| 2997 | 2997 |
| 2998 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) | 2998 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) |
| 2999 { | 2999 { |
| 3000 runTest(true); | 3000 runTest(true); |
| 3001 } | 3001 } |
| 3002 | 3002 |
| 3003 } // namespace | 3003 } // namespace |
| OLD | NEW |