Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11578019: Remove the pools from the ResourceProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-resolve against HEAD Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/prioritized_resource_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/layer_tree_host_impl.h" 5 #include "cc/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 1044
1045 private: 1045 private:
1046 MissingTextureAnimatingLayer(LayerTreeImpl* treeImpl, int id, bool tileMissi ng, bool skipsDraw, bool animating, ResourceProvider* resourceProvider) 1046 MissingTextureAnimatingLayer(LayerTreeImpl* treeImpl, int id, bool tileMissi ng, bool skipsDraw, bool animating, ResourceProvider* resourceProvider)
1047 : DidDrawCheckLayer(treeImpl, id) 1047 : DidDrawCheckLayer(treeImpl, id)
1048 { 1048 {
1049 scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(gfx::Si ze(10, 10), LayerTilingData::NoBorderTexels); 1049 scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(gfx::Si ze(10, 10), LayerTilingData::NoBorderTexels);
1050 tilingData->setBounds(bounds()); 1050 tilingData->setBounds(bounds());
1051 setTilingData(*tilingData.get()); 1051 setTilingData(*tilingData.get());
1052 setSkipsDraw(skipsDraw); 1052 setSkipsDraw(skipsDraw);
1053 if (!tileMissing) { 1053 if (!tileMissing) {
1054 ResourceProvider::ResourceId resource = resourceProvider->createReso urce(Renderer::ContentPool, gfx::Size(), GL_RGBA, ResourceProvider::TextureUsage Any); 1054 ResourceProvider::ResourceId resource = resourceProvider->createReso urce(gfx::Size(), GL_RGBA, ResourceProvider::TextureUsageAny);
1055 pushTileProperties(0, 0, resource, gfx::Rect(), false); 1055 pushTileProperties(0, 0, resource, gfx::Rect(), false);
1056 } 1056 }
1057 if (animating) 1057 if (animating)
1058 addAnimatedTransformToLayer(*this, 10, 3, 0); 1058 addAnimatedTransformToLayer(*this, 10, 3, 0);
1059 } 1059 }
1060 }; 1060 };
1061 1061
1062 TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard) 1062 TEST_P(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard)
1063 { 1063 {
1064 // When the texture is not missing, we draw as usual. 1064 // When the texture is not missing, we draw as usual.
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 void setOpaqueContentRect(const gfx::Rect& rect) { m_opaqueContentRect = rec t; } 1668 void setOpaqueContentRect(const gfx::Rect& rect) { m_opaqueContentRect = rec t; }
1669 1669
1670 private: 1670 private:
1671 BlendStateCheckLayer(LayerTreeImpl* treeImpl, int id, ResourceProvider* reso urceProvider) 1671 BlendStateCheckLayer(LayerTreeImpl* treeImpl, int id, ResourceProvider* reso urceProvider)
1672 : LayerImpl(treeImpl, id) 1672 : LayerImpl(treeImpl, id)
1673 , m_blend(false) 1673 , m_blend(false)
1674 , m_hasRenderSurface(false) 1674 , m_hasRenderSurface(false)
1675 , m_quadsAppended(false) 1675 , m_quadsAppended(false)
1676 , m_quadRect(5, 5, 5, 5) 1676 , m_quadRect(5, 5, 5, 5)
1677 , m_quadVisibleRect(5, 5, 5, 5) 1677 , m_quadVisibleRect(5, 5, 5, 5)
1678 , m_resourceId(resourceProvider->createResource(Renderer::ContentPool, g fx::Size(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny)) 1678 , m_resourceId(resourceProvider->createResource(gfx::Size(1, 1), GL_RGBA , ResourceProvider::TextureUsageAny))
1679 { 1679 {
1680 setAnchorPoint(gfx::PointF(0, 0)); 1680 setAnchorPoint(gfx::PointF(0, 0));
1681 setBounds(gfx::Size(10, 10)); 1681 setBounds(gfx::Size(10, 10));
1682 setContentBounds(gfx::Size(10, 10)); 1682 setContentBounds(gfx::Size(10, 10));
1683 setDrawsContent(true); 1683 setDrawsContent(true);
1684 } 1684 }
1685 1685
1686 bool m_blend; 1686 bool m_blend;
1687 bool m_hasRenderSurface; 1687 bool m_hasRenderSurface;
1688 bool m_quadsAppended; 1688 bool m_quadsAppended;
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 class FakeScrollbarLayerImpl : public ScrollbarLayerImpl { 2743 class FakeScrollbarLayerImpl : public ScrollbarLayerImpl {
2744 public: 2744 public:
2745 static scoped_ptr<FakeScrollbarLayerImpl> create(LayerTreeImpl* treeImpl, in t id) 2745 static scoped_ptr<FakeScrollbarLayerImpl> create(LayerTreeImpl* treeImpl, in t id)
2746 { 2746 {
2747 return make_scoped_ptr(new FakeScrollbarLayerImpl(treeImpl, id)); 2747 return make_scoped_ptr(new FakeScrollbarLayerImpl(treeImpl, id));
2748 } 2748 }
2749 2749
2750 void createResources(ResourceProvider* provider) 2750 void createResources(ResourceProvider* provider)
2751 { 2751 {
2752 DCHECK(provider); 2752 DCHECK(provider);
2753 int pool = 0;
2754 gfx::Size size(10, 10); 2753 gfx::Size size(10, 10);
2755 GLenum format = GL_RGBA; 2754 GLenum format = GL_RGBA;
2756 ResourceProvider::TextureUsageHint hint = ResourceProvider::TextureUsage Any; 2755 ResourceProvider::TextureUsageHint hint = ResourceProvider::TextureUsage Any;
2757 setScrollbarGeometry(ScrollbarGeometryFixedThumb::create(FakeWebScrollba rThemeGeometryNonEmpty::create())); 2756 setScrollbarGeometry(ScrollbarGeometryFixedThumb::create(FakeWebScrollba rThemeGeometryNonEmpty::create()));
2758 2757
2759 setBackTrackResourceId(provider->createResource(pool, size, format, hint )); 2758 setBackTrackResourceId(provider->createResource(size, format, hint));
2760 setForeTrackResourceId(provider->createResource(pool, size, format, hint )); 2759 setForeTrackResourceId(provider->createResource(size, format, hint));
2761 setThumbResourceId(provider->createResource(pool, size, format, hint)); 2760 setThumbResourceId(provider->createResource(size, format, hint));
2762 } 2761 }
2763 2762
2764 protected: 2763 protected:
2765 FakeScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id) 2764 FakeScrollbarLayerImpl(LayerTreeImpl* treeImpl, int id)
2766 : ScrollbarLayerImpl(treeImpl, id) 2765 : ScrollbarLayerImpl(treeImpl, id)
2767 { 2766 {
2768 } 2767 }
2769 }; 2768 };
2770 2769
2771 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid er* provider) 2770 static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid er* provider)
2772 { 2771 {
2773 ResourceProvider::ResourceId resourceId = provider->createResource(0, gfx::S ize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny); 2772 ResourceProvider::ResourceId resourceId = provider->createResource(gfx::Size (1, 1), GL_RGBA, ResourceProvider::TextureUsageAny);
2774 2773
2775 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); 2774 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create();
2776 pass->SetNew(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), gfx::Transform()); 2775 pass->SetNew(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), gfx::Transform());
2777 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create(); 2776 scoped_ptr<SharedQuadState> sharedState = SharedQuadState::Create();
2778 sharedState->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), false, 1); 2777 sharedState->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), false, 1);
2779 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); 2778 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create();
2780 quad->SetNew(sharedState.get(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1) , resourceId, false, gfx::RectF(0, 0, 1, 1), false); 2779 quad->SetNew(sharedState.get(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1) , resourceId, false, gfx::RectF(0, 0, 1, 1), false);
2781 2780
2782 pass->AppendSharedQuadState(sharedState.Pass()); 2781 pass->AppendSharedQuadState(sharedState.Pass());
2783 pass->AppendQuad(quad.PassAs<DrawQuad>()); 2782 pass->AppendQuad(quad.PassAs<DrawQuad>());
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4928 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); 4927 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize());
4929 drawFrameAndTestDamage(noDamage); 4928 drawFrameAndTestDamage(noDamage);
4930 } 4929 }
4931 4930
4932 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4931 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4933 LayerTreeHostImplTest, 4932 LayerTreeHostImplTest,
4934 ::testing::Values(false, true)); 4933 ::testing::Values(false, true));
4935 4934
4936 } // namespace 4935 } // namespace
4937 } // namespace cc 4936 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/prioritized_resource_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698