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

Side by Side Diff: webkit/compositor_bindings/TiledLayerChromiumTest.cpp

Issue 10917251: Move TextureCopier and TextureUploader from CCRenderer to CCResourceProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix rebase merge issues Created 8 years, 3 months 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/test/CCTiledLayerTestCommon.h ('k') | no next file » | 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 "config.h" 5 #include "config.h"
6 6
7 #include "TiledLayerChromium.h" 7 #include "TiledLayerChromium.h"
8 8
9 #include "BitmapCanvasLayerTextureUpdater.h" 9 #include "BitmapCanvasLayerTextureUpdater.h"
10 #include "CCAnimationTestCommon.h" 10 #include "CCAnimationTestCommon.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 class TiledLayerChromiumTest : public testing::Test { 50 class TiledLayerChromiumTest : public testing::Test {
51 public: 51 public:
52 TiledLayerChromiumTest() 52 TiledLayerChromiumTest()
53 : m_compositorInitializer(0) 53 : m_compositorInitializer(0)
54 , m_context(WebKit::createFakeCCGraphicsContext()) 54 , m_context(WebKit::createFakeCCGraphicsContext())
55 , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 102 4, CCRenderer::ContentPool)) 55 , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 102 4, CCRenderer::ContentPool))
56 , m_occlusion(0) 56 , m_occlusion(0)
57 { 57 {
58 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked; 58 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked;
59 m_resourceProvider = CCResourceProvider::create(m_context.get()); 59 m_resourceProvider = CCResourceProvider::create(m_context.get(), Unthrot tledUploader);
60 } 60 }
61 61
62 virtual ~TiledLayerChromiumTest() 62 virtual ~TiledLayerChromiumTest()
63 { 63 {
64 textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider. get()); 64 textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider. get());
65 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked; 65 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked;
66 m_resourceProvider.clear(); 66 m_resourceProvider.clear();
67 } 67 }
68 68
69 // Helper classes and functions that set the current thread to be the impl t hread 69 // Helper classes and functions that set the current thread to be the impl t hread
(...skipping 22 matching lines...) Expand all
92 FakeCCTiledLayerImpl* m_layerImpl; 92 FakeCCTiledLayerImpl* m_layerImpl;
93 }; 93 };
94 void textureManagerClearAllMemory(CCPrioritizedTextureManager* textureManage r, CCResourceProvider* resourceProvider) 94 void textureManagerClearAllMemory(CCPrioritizedTextureManager* textureManage r, CCResourceProvider* resourceProvider)
95 { 95 {
96 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked; 96 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked;
97 textureManager->clearAllMemory(resourceProvider); 97 textureManager->clearAllMemory(resourceProvider);
98 } 98 }
99 void updateTextures(int count = 500) 99 void updateTextures(int count = 500)
100 { 100 {
101 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked; 101 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked;
102 CCTextureUpdateController::updateTextures(m_resourceProvider.get(), &m_c opier, &m_uploader, &m_queue, count); 102 CCTextureUpdateController::updateTextures(m_resourceProvider.get(), &m_u ploader, &m_queue, count);
103 } 103 }
104 void layerPushPropertiesTo(FakeTiledLayerChromium* layer, FakeCCTiledLayerIm pl* layerImpl) 104 void layerPushPropertiesTo(FakeTiledLayerChromium* layer, FakeCCTiledLayerIm pl* layerImpl)
105 { 105 {
106 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked; 106 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked;
107 layer->pushPropertiesTo(layerImpl); 107 layer->pushPropertiesTo(layerImpl);
108 } 108 }
109 void layerUpdate(FakeTiledLayerChromium* layer, TestCCOcclusionTracker* occl uded) 109 void layerUpdate(FakeTiledLayerChromium* layer, TestCCOcclusionTracker* occl uded)
110 { 110 {
111 DebugScopedSetMainThread mainThread; 111 DebugScopedSetMainThread mainThread;
112 layer->update(m_queue, occluded, m_stats); 112 layer->update(m_queue, occluded, m_stats);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 return needsUpdate; 147 return needsUpdate;
148 } 148 }
149 149
150 public: 150 public:
151 WebKitTests::WebCompositorInitializer m_compositorInitializer; 151 WebKitTests::WebCompositorInitializer m_compositorInitializer;
152 OwnPtr<CCGraphicsContext> m_context; 152 OwnPtr<CCGraphicsContext> m_context;
153 OwnPtr<CCResourceProvider> m_resourceProvider; 153 OwnPtr<CCResourceProvider> m_resourceProvider;
154 CCTextureUpdateQueue m_queue; 154 CCTextureUpdateQueue m_queue;
155 CCRenderingStats m_stats; 155 CCRenderingStats m_stats;
156 FakeTextureCopier m_copier;
157 FakeTextureUploader m_uploader; 156 FakeTextureUploader m_uploader;
158 CCPriorityCalculator m_priorityCalculator; 157 CCPriorityCalculator m_priorityCalculator;
159 OwnPtr<CCPrioritizedTextureManager> m_textureManager; 158 OwnPtr<CCPrioritizedTextureManager> m_textureManager;
160 TestCCOcclusionTracker* m_occlusion; 159 TestCCOcclusionTracker* m_occlusion;
161 }; 160 };
162 161
163 TEST_F(TiledLayerChromiumTest, pushDirtyTiles) 162 TEST_F(TiledLayerChromiumTest, pushDirtyTiles)
164 { 163 {
165 RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m _textureManager.get())); 164 RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m _textureManager.get()));
166 ScopedFakeCCTiledLayerImpl layerImpl(1); 165 ScopedFakeCCTiledLayerImpl layerImpl(1);
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 updateTextures(); 1544 updateTextures();
1546 1545
1547 // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. 1546 // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds.
1548 layer->setNeedsDisplayRect(layerRect); 1547 layer->setNeedsDisplayRect(layerRect);
1549 layer->update(m_queue, 0, m_stats); 1548 layer->update(m_queue, 0, m_stats);
1550 1549
1551 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); 1550 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect());
1552 } 1551 }
1553 1552
1554 } // namespace 1553 } // namespace
OLDNEW
« no previous file with comments | « cc/test/CCTiledLayerTestCommon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698