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 "CCLayerTreeHostImpl.h" | 7 #include "CCLayerTreeHostImpl.h" |
8 | 8 |
9 #include "CCAnimationTestCommon.h" | 9 #include "CCAnimationTestCommon.h" |
10 #include "CCGeometryTestUtils.h" | 10 #include "CCGeometryTestUtils.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 public: | 51 public: |
52 CCLayerTreeHostImplTest() | 52 CCLayerTreeHostImplTest() |
53 : m_onCanDrawStateChangedCalled(false) | 53 : m_onCanDrawStateChangedCalled(false) |
54 , m_didRequestCommit(false) | 54 , m_didRequestCommit(false) |
55 , m_didRequestRedraw(false) | 55 , m_didRequestRedraw(false) |
56 { | 56 { |
57 CCLayerTreeSettings settings; | 57 CCLayerTreeSettings settings; |
58 settings.minimumOcclusionTrackingSize = IntSize(); | 58 settings.minimumOcclusionTrackingSize = IntSize(); |
59 | 59 |
60 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 60 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
61 m_hostImpl->initializeRenderer(createContext()); | 61 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); |
62 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 62 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
63 } | 63 } |
64 | 64 |
65 virtual void didLoseContextOnImplThread() OVERRIDE { } | 65 virtual void didLoseContextOnImplThread() OVERRIDE { } |
66 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } | 66 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { } |
67 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } | 67 virtual void onVSyncParametersChanged(double, double) OVERRIDE { } |
68 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } | 68 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawState
ChangedCalled = true; } |
69 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } | 69 virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = tr
ue; } |
70 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } | 70 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = tr
ue; } |
71 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE { } | 71 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimat
ionEventsVector>, double wallClockTime) OVERRIDE { } |
72 | 72 |
73 PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassOw
nPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr) | 73 PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassOw
nPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr) |
74 { | 74 { |
75 CCSettings::setPartialSwapEnabled(partialSwap); | 75 CCSettings::setPartialSwapEnabled(partialSwap); |
76 | 76 |
77 CCLayerTreeSettings settings; | 77 CCLayerTreeSettings settings; |
78 settings.minimumOcclusionTrackingSize = IntSize(); | 78 settings.minimumOcclusionTrackingSize = IntSize(); |
79 | 79 |
80 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); | 80 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(set
tings, this); |
81 | 81 |
82 myHostImpl->initializeRenderer(graphicsContext); | 82 myHostImpl->initializeRenderer(graphicsContext, UnthrottledUploader); |
83 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 83 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
84 | 84 |
85 OwnPtr<CCLayerImpl> root = rootPtr; | 85 OwnPtr<CCLayerImpl> root = rootPtr; |
86 | 86 |
87 root->setAnchorPoint(FloatPoint(0, 0)); | 87 root->setAnchorPoint(FloatPoint(0, 0)); |
88 root->setPosition(FloatPoint(0, 0)); | 88 root->setPosition(FloatPoint(0, 0)); |
89 root->setBounds(IntSize(10, 10)); | 89 root->setBounds(IntSize(10, 10)); |
90 root->setContentBounds(IntSize(10, 10)); | 90 root->setContentBounds(IntSize(10, 10)); |
91 root->setVisibleContentRect(IntRect(0, 0, 10, 10)); | 91 root->setVisibleContentRect(IntRect(0, 0, 10, 10)); |
92 root->setDrawsContent(true); | 92 root->setDrawsContent(true); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 layer->setScrollable(true); | 143 layer->setScrollable(true); |
144 layer->setDrawsContent(true); | 144 layer->setDrawsContent(true); |
145 layer->setBounds(size); | 145 layer->setBounds(size); |
146 layer->setContentBounds(size); | 146 layer->setContentBounds(size); |
147 layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2)
); | 147 layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2)
); |
148 return layer.release(); | 148 return layer.release(); |
149 } | 149 } |
150 | 150 |
151 void initializeRendererAndDrawFrame() | 151 void initializeRendererAndDrawFrame() |
152 { | 152 { |
153 m_hostImpl->initializeRenderer(createContext()); | 153 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); |
154 CCLayerTreeHostImpl::FrameData frame; | 154 CCLayerTreeHostImpl::FrameData frame; |
155 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 155 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
156 m_hostImpl->drawLayers(frame); | 156 m_hostImpl->drawLayers(frame); |
157 m_hostImpl->didDrawAllLayers(frame); | 157 m_hostImpl->didDrawAllLayers(frame); |
158 } | 158 } |
159 | 159 |
160 protected: | 160 protected: |
161 PassOwnPtr<CCGraphicsContext> createContext() | 161 PassOwnPtr<CCGraphicsContext> createContext() |
162 { | 162 { |
163 return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphi
csContext3D)); | 163 return FakeWebCompositorOutputSurface::create(adoptPtr(new FakeWebGraphi
csContext3D)); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // We should not crash when trying to scroll an empty layer tree. | 310 // We should not crash when trying to scroll an empty layer tree. |
311 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); | 311 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); |
312 } | 312 } |
313 | 313 |
314 TEST_F(CCLayerTreeHostImplTest, scrollWithoutRenderer) | 314 TEST_F(CCLayerTreeHostImplTest, scrollWithoutRenderer) |
315 { | 315 { |
316 CCLayerTreeSettings settings; | 316 CCLayerTreeSettings settings; |
317 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 317 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
318 | 318 |
319 // Initialization will fail here. | 319 // Initialization will fail here. |
320 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails))); | 320 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); |
321 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); | 321 m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); |
322 | 322 |
323 setupScrollAndContentsLayers(IntSize(100, 100)); | 323 setupScrollAndContentsLayers(IntSize(100, 100)); |
324 | 324 |
325 // We should not crash when trying to scroll after the renderer initializati
on fails. | 325 // We should not crash when trying to scroll after the renderer initializati
on fails. |
326 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); | 326 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), CCInputHandlerClient::Whee
l), CCInputHandlerClient::ScrollIgnored); |
327 } | 327 } |
328 | 328 |
329 TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) | 329 TEST_F(CCLayerTreeHostImplTest, replaceTreeWhileScrolling) |
330 { | 330 { |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 layer1->setExpectation(false, false); | 1666 layer1->setExpectation(false, false); |
1667 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1667 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
1668 m_hostImpl->drawLayers(frame); | 1668 m_hostImpl->drawLayers(frame); |
1669 EXPECT_TRUE(layer1->quadsAppended()); | 1669 EXPECT_TRUE(layer1->quadsAppended()); |
1670 m_hostImpl->didDrawAllLayers(frame); | 1670 m_hostImpl->didDrawAllLayers(frame); |
1671 | 1671 |
1672 } | 1672 } |
1673 | 1673 |
1674 TEST_F(CCLayerTreeHostImplTest, viewportCovered) | 1674 TEST_F(CCLayerTreeHostImplTest, viewportCovered) |
1675 { | 1675 { |
1676 m_hostImpl->initializeRenderer(createContext()); | 1676 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); |
1677 m_hostImpl->setBackgroundColor(SK_ColorGRAY); | 1677 m_hostImpl->setBackgroundColor(SK_ColorGRAY); |
1678 | 1678 |
1679 IntSize viewportSize(1000, 1000); | 1679 IntSize viewportSize(1000, 1000); |
1680 m_hostImpl->setViewportSize(viewportSize, viewportSize); | 1680 m_hostImpl->setViewportSize(viewportSize, viewportSize); |
1681 | 1681 |
1682 m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourc
eProvider())); | 1682 m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourc
eProvider())); |
1683 BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->
rootLayer()); | 1683 BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl->
rootLayer()); |
1684 root->setExpectation(false, true); | 1684 root->setExpectation(false, true); |
1685 root->setOpaque(true); | 1685 root->setOpaque(true); |
1686 | 1686 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 explicit FakeDrawableCCLayerImpl(int id) : CCLayerImpl(id) { } | 1777 explicit FakeDrawableCCLayerImpl(int id) : CCLayerImpl(id) { } |
1778 }; | 1778 }; |
1779 | 1779 |
1780 // Only reshape when we know we are going to draw. Otherwise, the reshape | 1780 // Only reshape when we know we are going to draw. Otherwise, the reshape |
1781 // can leave the window at the wrong size if we never draw and the proper | 1781 // can leave the window at the wrong size if we never draw and the proper |
1782 // viewport size is never set. | 1782 // viewport size is never set. |
1783 TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) | 1783 TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw) |
1784 { | 1784 { |
1785 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new ReshapeTrackerContext)); | 1785 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new ReshapeTrackerContext)); |
1786 ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(
ccContext->context3D()); | 1786 ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(
ccContext->context3D()); |
1787 m_hostImpl->initializeRenderer(ccContext.release()); | 1787 m_hostImpl->initializeRenderer(ccContext.release(), UnthrottledUploader); |
1788 | 1788 |
1789 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); | 1789 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); |
1790 root->setAnchorPoint(FloatPoint(0, 0)); | 1790 root->setAnchorPoint(FloatPoint(0, 0)); |
1791 root->setBounds(IntSize(10, 10)); | 1791 root->setBounds(IntSize(10, 10)); |
1792 root->setDrawsContent(true); | 1792 root->setDrawsContent(true); |
1793 m_hostImpl->setRootLayer(adoptPtr(root)); | 1793 m_hostImpl->setRootLayer(adoptPtr(root)); |
1794 EXPECT_FALSE(reshapeTracker->reshapeCalled()); | 1794 EXPECT_FALSE(reshapeTracker->reshapeCalled()); |
1795 | 1795 |
1796 CCLayerTreeHostImpl::FrameData frame; | 1796 CCLayerTreeHostImpl::FrameData frame; |
1797 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 1797 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
(...skipping 28 matching lines...) Expand all Loading... |
1826 TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) | 1826 TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) |
1827 { | 1827 { |
1828 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new PartialSwapTrackerContext)); | 1828 OwnPtr<CCGraphicsContext> ccContext = FakeWebCompositorOutputSurface::create
(adoptPtr(new PartialSwapTrackerContext)); |
1829 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(ccContext->context3D()); | 1829 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack
erContext*>(ccContext->context3D()); |
1830 | 1830 |
1831 // This test creates its own CCLayerTreeHostImpl, so | 1831 // This test creates its own CCLayerTreeHostImpl, so |
1832 // that we can force partial swap enabled. | 1832 // that we can force partial swap enabled. |
1833 CCLayerTreeSettings settings; | 1833 CCLayerTreeSettings settings; |
1834 CCSettings::setPartialSwapEnabled(true); | 1834 CCSettings::setPartialSwapEnabled(true); |
1835 OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(
settings, this); | 1835 OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(
settings, this); |
1836 layerTreeHostImpl->initializeRenderer(ccContext.release()); | 1836 layerTreeHostImpl->initializeRenderer(ccContext.release(), UnthrottledUpload
er); |
1837 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); | 1837 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); |
1838 | 1838 |
1839 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); | 1839 CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); |
1840 CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); | 1840 CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); |
1841 child->setPosition(FloatPoint(12, 13)); | 1841 child->setPosition(FloatPoint(12, 13)); |
1842 child->setAnchorPoint(FloatPoint(0, 0)); | 1842 child->setAnchorPoint(FloatPoint(0, 0)); |
1843 child->setBounds(IntSize(14, 15)); | 1843 child->setBounds(IntSize(14, 15)); |
1844 child->setContentBounds(IntSize(14, 15)); | 1844 child->setContentBounds(IntSize(14, 15)); |
1845 child->setDrawsContent(true); | 1845 child->setDrawsContent(true); |
1846 root->setAnchorPoint(FloatPoint(0, 0)); | 1846 root->setAnchorPoint(FloatPoint(0, 0)); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 }; | 2113 }; |
2114 | 2114 |
2115 static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) | 2115 static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C
CLayerTreeHostImplClient* client) |
2116 { | 2116 { |
2117 CCSettings::setPartialSwapEnabled(partialSwap); | 2117 CCSettings::setPartialSwapEnabled(partialSwap); |
2118 | 2118 |
2119 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2119 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
2120 | 2120 |
2121 CCLayerTreeSettings settings; | 2121 CCLayerTreeSettings settings; |
2122 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, client); | 2122 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, client); |
2123 myHostImpl->initializeRenderer(context.release()); | 2123 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); |
2124 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); | 2124 myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100)); |
2125 | 2125 |
2126 /* | 2126 /* |
2127 Layers are created as follows: | 2127 Layers are created as follows: |
2128 | 2128 |
2129 +--------------------+ | 2129 +--------------------+ |
2130 | 1 | | 2130 | 1 | |
2131 | +-----------+ | | 2131 | +-----------+ | |
2132 | | 2 | | | 2132 | | 2 | | |
2133 | | +-------------------+ | 2133 | | +-------------------+ |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 root->addChild(ContextLostNotificationCheckLayer::create(1)); | 2252 root->addChild(ContextLostNotificationCheckLayer::create(1)); |
2253 ContextLostNotificationCheckLayer* layer1 = static_cast<ContextLostNotificat
ionCheckLayer*>(root->children()[0].get()); | 2253 ContextLostNotificationCheckLayer* layer1 = static_cast<ContextLostNotificat
ionCheckLayer*>(root->children()[0].get()); |
2254 | 2254 |
2255 layer1->addChild(ContextLostNotificationCheckLayer::create(2)); | 2255 layer1->addChild(ContextLostNotificationCheckLayer::create(2)); |
2256 ContextLostNotificationCheckLayer* layer2 = static_cast<ContextLostNotificat
ionCheckLayer*>(layer1->children()[0].get()); | 2256 ContextLostNotificationCheckLayer* layer2 = static_cast<ContextLostNotificat
ionCheckLayer*>(layer1->children()[0].get()); |
2257 | 2257 |
2258 EXPECT_FALSE(root->didLoseContextCalled()); | 2258 EXPECT_FALSE(root->didLoseContextCalled()); |
2259 EXPECT_FALSE(layer1->didLoseContextCalled()); | 2259 EXPECT_FALSE(layer1->didLoseContextCalled()); |
2260 EXPECT_FALSE(layer2->didLoseContextCalled()); | 2260 EXPECT_FALSE(layer2->didLoseContextCalled()); |
2261 | 2261 |
2262 m_hostImpl->initializeRenderer(createContext()); | 2262 m_hostImpl->initializeRenderer(createContext(), UnthrottledUploader); |
2263 | 2263 |
2264 EXPECT_TRUE(root->didLoseContextCalled()); | 2264 EXPECT_TRUE(root->didLoseContextCalled()); |
2265 EXPECT_TRUE(layer1->didLoseContextCalled()); | 2265 EXPECT_TRUE(layer1->didLoseContextCalled()); |
2266 EXPECT_TRUE(layer2->didLoseContextCalled()); | 2266 EXPECT_TRUE(layer2->didLoseContextCalled()); |
2267 } | 2267 } |
2268 | 2268 |
2269 TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) | 2269 TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost) |
2270 { | 2270 { |
2271 CCLayerTreeSettings settings; | 2271 CCLayerTreeSettings settings; |
2272 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); | 2272 m_hostImpl = CCLayerTreeHostImpl::create(settings, this); |
2273 | 2273 |
2274 // The context initialization will fail, but we should still be able to call
finishAllRendering() without any ill effects. | 2274 // The context initialization will fail, but we should still be able to call
finishAllRendering() without any ill effects. |
2275 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails))); | 2275 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader); |
2276 m_hostImpl->finishAllRendering(); | 2276 m_hostImpl->finishAllRendering(); |
2277 } | 2277 } |
2278 | 2278 |
2279 // Fake WebGraphicsContext3D that will cause a failure if trying to use a | 2279 // Fake WebGraphicsContext3D that will cause a failure if trying to use a |
2280 // resource that wasn't created by it (resources created by | 2280 // resource that wasn't created by it (resources created by |
2281 // FakeWebGraphicsContext3D have an id of 1). | 2281 // FakeWebGraphicsContext3D have an id of 1). |
2282 class StrictWebGraphicsContext3D : public FakeWebGraphicsContext3D { | 2282 class StrictWebGraphicsContext3D : public FakeWebGraphicsContext3D { |
2283 public: | 2283 public: |
2284 StrictWebGraphicsContext3D() | 2284 StrictWebGraphicsContext3D() |
2285 : FakeWebGraphicsContext3D() | 2285 : FakeWebGraphicsContext3D() |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 OwnPtr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create
(8)); | 2547 OwnPtr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create
(8)); |
2548 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); | 2548 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
2549 scrollbarLayer->setBounds(IntSize(10, 10)); | 2549 scrollbarLayer->setBounds(IntSize(10, 10)); |
2550 scrollbarLayer->setContentBounds(IntSize(10, 10)); | 2550 scrollbarLayer->setContentBounds(IntSize(10, 10)); |
2551 scrollbarLayer->setDrawsContent(true); | 2551 scrollbarLayer->setDrawsContent(true); |
2552 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); | 2552 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
2553 scrollbarLayer->createResources(m_hostImpl->resourceProvider()); | 2553 scrollbarLayer->createResources(m_hostImpl->resourceProvider()); |
2554 rootLayer->addChild(scrollbarLayer.release()); | 2554 rootLayer->addChild(scrollbarLayer.release()); |
2555 | 2555 |
2556 // Use a context that supports IOSurfaces | 2556 // Use a context that supports IOSurfaces |
2557 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DWithIOSurface))); | 2557 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new FakeWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); |
2558 | 2558 |
2559 hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D(
)->createTexture()); | 2559 hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D(
)->createTexture()); |
2560 | 2560 |
2561 m_hostImpl->setRootLayer(rootLayer.release()); | 2561 m_hostImpl->setRootLayer(rootLayer.release()); |
2562 | 2562 |
2563 CCLayerTreeHostImpl::FrameData frame; | 2563 CCLayerTreeHostImpl::FrameData frame; |
2564 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 2564 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
2565 m_hostImpl->drawLayers(frame); | 2565 m_hostImpl->drawLayers(frame); |
2566 m_hostImpl->didDrawAllLayers(frame); | 2566 m_hostImpl->didDrawAllLayers(frame); |
2567 m_hostImpl->swapBuffers(); | 2567 m_hostImpl->swapBuffers(); |
2568 | 2568 |
2569 unsigned numResources = m_hostImpl->resourceProvider()->numResources(); | 2569 unsigned numResources = m_hostImpl->resourceProvider()->numResources(); |
2570 | 2570 |
2571 // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSur
face, | 2571 // Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSur
face, |
2572 // that will warn if any resource from the previous context gets used. | 2572 // that will warn if any resource from the previous context gets used. |
2573 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new StrictWebGraphicsContext3DWithIOSurface))); | 2573 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(adoptP
tr(new StrictWebGraphicsContext3DWithIOSurface)), UnthrottledUploader); |
2574 | 2574 |
2575 // Create dummy resources so that looking up an old resource will get an | 2575 // Create dummy resources so that looking up an old resource will get an |
2576 // invalid texture id mapping. | 2576 // invalid texture id mapping. |
2577 for (unsigned i = 0; i < numResources; ++i) | 2577 for (unsigned i = 0; i < numResources; ++i) |
2578 m_hostImpl->resourceProvider()->createResourceFromExternalTexture(1); | 2578 m_hostImpl->resourceProvider()->createResourceFromExternalTexture(1); |
2579 | 2579 |
2580 // The WebVideoFrameProvider is expected to recreate its textures after a | 2580 // The WebVideoFrameProvider is expected to recreate its textures after a |
2581 // lost context (or not serve a frame). | 2581 // lost context (or not serve a frame). |
2582 hwProvider.setFrame(0); | 2582 hwProvider.setFrame(0); |
2583 | 2583 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2676 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); | 2676 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); |
2677 ioSurfaceLayer->setContentBounds(IntSize(10, 10)); | 2677 ioSurfaceLayer->setContentBounds(IntSize(10, 10)); |
2678 ioSurfaceLayer->setDrawsContent(true); | 2678 ioSurfaceLayer->setDrawsContent(true); |
2679 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); | 2679 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); |
2680 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); | 2680 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); |
2681 rootLayer->addChild(ioSurfaceLayer.release()); | 2681 rootLayer->addChild(ioSurfaceLayer.release()); |
2682 | 2682 |
2683 // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which
the CCLayerTreeHostImpl takes ownership of). | 2683 // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which
the CCLayerTreeHostImpl takes ownership of). |
2684 OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(a
doptPtr(new TrackingWebGraphicsContext3D))); | 2684 OwnPtr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::create(a
doptPtr(new TrackingWebGraphicsContext3D))); |
2685 TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<Track
ingWebGraphicsContext3D*>(ccContext->context3D()); | 2685 TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<Track
ingWebGraphicsContext3D*>(ccContext->context3D()); |
2686 m_hostImpl->initializeRenderer(ccContext.release()); | 2686 m_hostImpl->initializeRenderer(ccContext.release(), UnthrottledUploader); |
2687 | 2687 |
2688 m_hostImpl->setRootLayer(rootLayer.release()); | 2688 m_hostImpl->setRootLayer(rootLayer.release()); |
2689 | 2689 |
2690 CCLayerTreeHostImpl::FrameData frame; | 2690 CCLayerTreeHostImpl::FrameData frame; |
2691 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); | 2691 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); |
2692 m_hostImpl->drawLayers(frame); | 2692 m_hostImpl->drawLayers(frame); |
2693 m_hostImpl->didDrawAllLayers(frame); | 2693 m_hostImpl->didDrawAllLayers(frame); |
2694 m_hostImpl->swapBuffers(); | 2694 m_hostImpl->swapBuffers(); |
2695 | 2695 |
2696 EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u); | 2696 EXPECT_GT(trackingWebGraphicsContext->numTextures(), 0u); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2748 layerPtr->setOpaque(true); | 2748 layerPtr->setOpaque(true); |
2749 parent->addChild(layer.release()); | 2749 parent->addChild(layer.release()); |
2750 if (result) | 2750 if (result) |
2751 *result = layerPtr; | 2751 *result = layerPtr; |
2752 } | 2752 } |
2753 | 2753 |
2754 static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl,
CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfac
eLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) | 2754 static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl,
CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfac
eLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize) |
2755 { | 2755 { |
2756 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2756 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
2757 | 2757 |
2758 layerTreeHostImpl->initializeRenderer(context.release()); | 2758 layerTreeHostImpl->initializeRenderer(context.release(), UnthrottledUploader
); |
2759 layerTreeHostImpl->setViewportSize(rootSize, rootSize); | 2759 layerTreeHostImpl->setViewportSize(rootSize, rootSize); |
2760 | 2760 |
2761 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 2761 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
2762 rootPtr = root.get(); | 2762 rootPtr = root.get(); |
2763 | 2763 |
2764 root->setAnchorPoint(FloatPoint(0, 0)); | 2764 root->setAnchorPoint(FloatPoint(0, 0)); |
2765 root->setPosition(FloatPoint(0, 0)); | 2765 root->setPosition(FloatPoint(0, 0)); |
2766 root->setBounds(rootSize); | 2766 root->setBounds(rootSize); |
2767 root->setContentBounds(rootSize); | 2767 root->setContentBounds(rootSize); |
2768 root->setDrawsContent(true); | 2768 root->setDrawsContent(true); |
(...skipping 25 matching lines...) Expand all Loading... |
2794 settings.minimumOcclusionTrackingSize = IntSize(); | 2794 settings.minimumOcclusionTrackingSize = IntSize(); |
2795 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, this); | 2795 OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(setting
s, this); |
2796 | 2796 |
2797 CCLayerImpl* rootPtr; | 2797 CCLayerImpl* rootPtr; |
2798 CCLayerImpl* surfaceLayerPtr; | 2798 CCLayerImpl* surfaceLayerPtr; |
2799 | 2799 |
2800 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2800 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
2801 | 2801 |
2802 IntSize rootSize(100, 100); | 2802 IntSize rootSize(100, 100); |
2803 | 2803 |
2804 myHostImpl->initializeRenderer(context.release()); | 2804 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); |
2805 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 2805 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
2806 | 2806 |
2807 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 2807 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
2808 rootPtr = root.get(); | 2808 rootPtr = root.get(); |
2809 | 2809 |
2810 root->setAnchorPoint(FloatPoint(0, 0)); | 2810 root->setAnchorPoint(FloatPoint(0, 0)); |
2811 root->setPosition(FloatPoint(0, 0)); | 2811 root->setPosition(FloatPoint(0, 0)); |
2812 root->setBounds(rootSize); | 2812 root->setBounds(rootSize); |
2813 root->setContentBounds(rootSize); | 2813 root->setContentBounds(rootSize); |
2814 root->setDrawsContent(true); | 2814 root->setDrawsContent(true); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2906 // L21 occludes L20 (internal) | 2906 // L21 occludes L20 (internal) |
2907 | 2907 |
2908 CCLayerImpl* rootPtr; | 2908 CCLayerImpl* rootPtr; |
2909 CCLayerImpl* layerS1Ptr; | 2909 CCLayerImpl* layerS1Ptr; |
2910 CCLayerImpl* layerS2Ptr; | 2910 CCLayerImpl* layerS2Ptr; |
2911 | 2911 |
2912 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 2912 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
2913 | 2913 |
2914 IntSize rootSize(1000, 1000); | 2914 IntSize rootSize(1000, 1000); |
2915 | 2915 |
2916 myHostImpl->initializeRenderer(context.release()); | 2916 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); |
2917 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 2917 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
2918 | 2918 |
2919 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 2919 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
2920 rootPtr = root.get(); | 2920 rootPtr = root.get(); |
2921 | 2921 |
2922 root->setAnchorPoint(FloatPoint(0, 0)); | 2922 root->setAnchorPoint(FloatPoint(0, 0)); |
2923 root->setPosition(FloatPoint(0, 0)); | 2923 root->setPosition(FloatPoint(0, 0)); |
2924 root->setBounds(rootSize); | 2924 root->setBounds(rootSize); |
2925 root->setContentBounds(rootSize); | 2925 root->setContentBounds(rootSize); |
2926 root->setDrawsContent(true); | 2926 root->setDrawsContent(true); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3019 // | 3019 // |
3020 | 3020 |
3021 CCLayerImpl* rootPtr; | 3021 CCLayerImpl* rootPtr; |
3022 CCLayerImpl* layerS1Ptr; | 3022 CCLayerImpl* layerS1Ptr; |
3023 CCLayerImpl* layerS2Ptr; | 3023 CCLayerImpl* layerS2Ptr; |
3024 | 3024 |
3025 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3025 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3026 | 3026 |
3027 IntSize rootSize(1000, 1000); | 3027 IntSize rootSize(1000, 1000); |
3028 | 3028 |
3029 myHostImpl->initializeRenderer(context.release()); | 3029 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); |
3030 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3030 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
3031 | 3031 |
3032 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3032 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3033 rootPtr = root.get(); | 3033 rootPtr = root.get(); |
3034 | 3034 |
3035 root->setAnchorPoint(FloatPoint(0, 0)); | 3035 root->setAnchorPoint(FloatPoint(0, 0)); |
3036 root->setPosition(FloatPoint(0, 0)); | 3036 root->setPosition(FloatPoint(0, 0)); |
3037 root->setBounds(rootSize); | 3037 root->setBounds(rootSize); |
3038 root->setContentBounds(rootSize); | 3038 root->setContentBounds(rootSize); |
3039 root->setDrawsContent(true); | 3039 root->setDrawsContent(true); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3133 // | 3133 // |
3134 | 3134 |
3135 CCLayerImpl* rootPtr; | 3135 CCLayerImpl* rootPtr; |
3136 CCLayerImpl* layerS1Ptr; | 3136 CCLayerImpl* layerS1Ptr; |
3137 CCLayerImpl* layerS2Ptr; | 3137 CCLayerImpl* layerS2Ptr; |
3138 | 3138 |
3139 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3139 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3140 | 3140 |
3141 IntSize rootSize(1000, 1000); | 3141 IntSize rootSize(1000, 1000); |
3142 | 3142 |
3143 myHostImpl->initializeRenderer(context.release()); | 3143 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); |
3144 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3144 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
3145 | 3145 |
3146 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3146 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3147 rootPtr = root.get(); | 3147 rootPtr = root.get(); |
3148 | 3148 |
3149 root->setAnchorPoint(FloatPoint(0, 0)); | 3149 root->setAnchorPoint(FloatPoint(0, 0)); |
3150 root->setPosition(FloatPoint(0, 0)); | 3150 root->setPosition(FloatPoint(0, 0)); |
3151 root->setBounds(rootSize); | 3151 root->setBounds(rootSize); |
3152 root->setContentBounds(rootSize); | 3152 root->setContentBounds(rootSize); |
3153 root->setDrawsContent(true); | 3153 root->setDrawsContent(true); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3216 // R +-- S1 +- L10 (rotated, drawing) | 3216 // R +-- S1 +- L10 (rotated, drawing) |
3217 // +- L11 (occupies half surface) | 3217 // +- L11 (occupies half surface) |
3218 | 3218 |
3219 CCLayerImpl* rootPtr; | 3219 CCLayerImpl* rootPtr; |
3220 CCLayerImpl* layerS1Ptr; | 3220 CCLayerImpl* layerS1Ptr; |
3221 | 3221 |
3222 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3222 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3223 | 3223 |
3224 IntSize rootSize(1000, 1000); | 3224 IntSize rootSize(1000, 1000); |
3225 | 3225 |
3226 myHostImpl->initializeRenderer(context.release()); | 3226 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); |
3227 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3227 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
3228 | 3228 |
3229 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3229 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3230 rootPtr = root.get(); | 3230 rootPtr = root.get(); |
3231 | 3231 |
3232 root->setAnchorPoint(FloatPoint(0, 0)); | 3232 root->setAnchorPoint(FloatPoint(0, 0)); |
3233 root->setPosition(FloatPoint(0, 0)); | 3233 root->setPosition(FloatPoint(0, 0)); |
3234 root->setBounds(rootSize); | 3234 root->setBounds(rootSize); |
3235 root->setContentBounds(rootSize); | 3235 root->setContentBounds(rootSize); |
3236 root->setDrawsContent(true); | 3236 root->setDrawsContent(true); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3301 // L21 occludes L20 (internal) | 3301 // L21 occludes L20 (internal) |
3302 | 3302 |
3303 CCLayerImpl* rootPtr; | 3303 CCLayerImpl* rootPtr; |
3304 CCLayerImpl* layerS1Ptr; | 3304 CCLayerImpl* layerS1Ptr; |
3305 CCLayerImpl* layerS2Ptr; | 3305 CCLayerImpl* layerS2Ptr; |
3306 | 3306 |
3307 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3307 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3308 | 3308 |
3309 IntSize rootSize(1000, 1000); | 3309 IntSize rootSize(1000, 1000); |
3310 | 3310 |
3311 myHostImpl->initializeRenderer(context.release()); | 3311 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); |
3312 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); | 3312 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In
tSize(rootSize.width(), rootSize.height())); |
3313 | 3313 |
3314 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3314 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3315 rootPtr = root.get(); | 3315 rootPtr = root.get(); |
3316 | 3316 |
3317 root->setAnchorPoint(FloatPoint(0, 0)); | 3317 root->setAnchorPoint(FloatPoint(0, 0)); |
3318 root->setPosition(FloatPoint(0, 0)); | 3318 root->setPosition(FloatPoint(0, 0)); |
3319 root->setBounds(rootSize); | 3319 root->setBounds(rootSize); |
3320 root->setContentBounds(rootSize); | 3320 root->setContentBounds(rootSize); |
3321 root->setDrawsContent(true); | 3321 root->setDrawsContent(true); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3419 */ | 3419 */ |
3420 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); | 3420 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); |
3421 OwnPtr<CCTiledLayerImpl> child = CCTiledLayerImpl::create(2); | 3421 OwnPtr<CCTiledLayerImpl> child = CCTiledLayerImpl::create(2); |
3422 OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); | 3422 OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); |
3423 | 3423 |
3424 IntRect rootRect(0, 0, 100, 100); | 3424 IntRect rootRect(0, 0, 100, 100); |
3425 IntRect childRect(10, 10, 50, 50); | 3425 IntRect childRect(10, 10, 50, 50); |
3426 IntRect grandChildRect(5, 5, 150, 150); | 3426 IntRect grandChildRect(5, 5, 150, 150); |
3427 | 3427 |
3428 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); | 3428 OwnPtr<CCGraphicsContext> context = FakeWebCompositorOutputSurface::create(a
doptPtr(new PartialSwapContext)); |
3429 myHostImpl->initializeRenderer(context.release()); | 3429 myHostImpl->initializeRenderer(context.release(), UnthrottledUploader); |
3430 | 3430 |
3431 root->setAnchorPoint(FloatPoint(0, 0)); | 3431 root->setAnchorPoint(FloatPoint(0, 0)); |
3432 root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); | 3432 root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); |
3433 root->setBounds(IntSize(rootRect.width(), rootRect.height())); | 3433 root->setBounds(IntSize(rootRect.width(), rootRect.height())); |
3434 root->setContentBounds(root->bounds()); | 3434 root->setContentBounds(root->bounds()); |
3435 root->setDrawsContent(true); | 3435 root->setDrawsContent(true); |
3436 root->setMasksToBounds(true); | 3436 root->setMasksToBounds(true); |
3437 | 3437 |
3438 child->setAnchorPoint(FloatPoint(0, 0)); | 3438 child->setAnchorPoint(FloatPoint(0, 0)); |
3439 child->setPosition(FloatPoint(childRect.x(), childRect.y())); | 3439 child->setPosition(FloatPoint(childRect.x(), childRect.y())); |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4176 { | 4176 { |
4177 char actualResult[1024]; | 4177 char actualResult[1024]; |
4178 dumpRenderPassTestData(testData, actualResult); | 4178 dumpRenderPassTestData(testData, actualResult); |
4179 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t
estCase.name; | 4179 EXPECT_STREQ(testCase.expectedResult, actualResult) << "In test case: " << t
estCase.name; |
4180 } | 4180 } |
4181 | 4181 |
4182 TEST_F(CCLayerTreeHostImplTest, testRemoveRenderPasses) | 4182 TEST_F(CCLayerTreeHostImplTest, testRemoveRenderPasses) |
4183 { | 4183 { |
4184 OwnPtr<CCGraphicsContext> context(createContext()); | 4184 OwnPtr<CCGraphicsContext> context(createContext()); |
4185 ASSERT_TRUE(context->context3D()); | 4185 ASSERT_TRUE(context->context3D()); |
4186 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(conte
xt.get())); | 4186 OwnPtr<CCResourceProvider> resourceProvider(CCResourceProvider::create(conte
xt.get(), UnthrottledUploader)); |
4187 | 4187 |
4188 OwnPtr<CCTestRenderer> renderer(CCTestRenderer::create(resourceProvider.get(
))); | 4188 OwnPtr<CCTestRenderer> renderer(CCTestRenderer::create(resourceProvider.get(
))); |
4189 | 4189 |
4190 int testCaseIndex = 0; | 4190 int testCaseIndex = 0; |
4191 while (removeRenderPassesCases[testCaseIndex].name) { | 4191 while (removeRenderPassesCases[testCaseIndex].name) { |
4192 RenderPassRemovalTestData testData; | 4192 RenderPassRemovalTestData testData; |
4193 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS
cript, testData, renderer.get()); | 4193 configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initS
cript, testData, renderer.get()); |
4194 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP
assesWithCachedTextures(*renderer), testData); | 4194 CCLayerTreeHostImpl::removeRenderPasses(CCLayerTreeHostImpl::CullRenderP
assesWithCachedTextures(*renderer), testData); |
4195 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4195 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
4196 testCaseIndex++; | 4196 testCaseIndex++; |
4197 } | 4197 } |
4198 } | 4198 } |
4199 | 4199 |
4200 } // namespace | 4200 } // namespace |
OLD | NEW |