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

Side by Side Diff: cc/tiled_layer_unittest.cc

Issue 11270047: cc: Rename TextureUpdate to ResourceUpdate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
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 "cc/tiled_layer.h" 7 #include "cc/tiled_layer.h"
8 8
9 #include "cc/bitmap_content_layer_updater.h" 9 #include "cc/bitmap_content_layer_updater.h"
10 #include "cc/layer_painter.h" 10 #include "cc/layer_painter.h"
11 #include "cc/overdraw_metrics.h" 11 #include "cc/overdraw_metrics.h"
12 #include "cc/rendering_stats.h" 12 #include "cc/rendering_stats.h"
13 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread 13 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread
14 #include "cc/test/animation_test_common.h" 14 #include "cc/test/animation_test_common.h"
15 #include "cc/test/fake_graphics_context.h" 15 #include "cc/test/fake_graphics_context.h"
16 #include "cc/test/fake_layer_tree_host_client.h" 16 #include "cc/test/fake_layer_tree_host_client.h"
17 #include "cc/test/geometry_test_utils.h" 17 #include "cc/test/geometry_test_utils.h"
18 #include "cc/test/tiled_layer_test_common.h" 18 #include "cc/test/tiled_layer_test_common.h"
19 #include "cc/test/web_compositor_initializer.h" 19 #include "cc/test/web_compositor_initializer.h"
20 #include "cc/texture_update_controller.h" 20 #include "cc/resource_update_controller.h"
enne (OOO) 2012/10/25 20:54:30 Sorting.
reveman 2012/10/25 21:07:45 Done.
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 #include <public/WebTransformationMatrix.h> 22 #include <public/WebTransformationMatrix.h>
23 23
24 using namespace cc; 24 using namespace cc;
25 using namespace WebKitTests; 25 using namespace WebKitTests;
26 using WebKit::WebTransformationMatrix; 26 using WebKit::WebTransformationMatrix;
27 27
28 namespace { 28 namespace {
29 29
30 class TestOcclusionTracker : public OcclusionTracker { 30 class TestOcclusionTracker : public OcclusionTracker {
(...skipping 13 matching lines...) Expand all
44 44
45 private: 45 private:
46 IntRect m_layerClipRectInTarget; 46 IntRect m_layerClipRectInTarget;
47 }; 47 };
48 48
49 class TiledLayerTest : public testing::Test { 49 class TiledLayerTest : public testing::Test {
50 public: 50 public:
51 TiledLayerTest() 51 TiledLayerTest()
52 : m_compositorInitializer(0) 52 : m_compositorInitializer(0)
53 , m_context(WebKit::createFakeGraphicsContext()) 53 , m_context(WebKit::createFakeGraphicsContext())
54 , m_queue(make_scoped_ptr(new TextureUpdateQueue)) 54 , m_queue(make_scoped_ptr(new ResourceUpdateQueue))
55 , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool)) 55 , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool))
56 , m_occlusion(0) 56 , m_occlusion(0)
57 { 57 {
58 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked; 58 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked;
59 m_resourceProvider = ResourceProvider::create(m_context.get()); 59 m_resourceProvider = ResourceProvider::create(m_context.get());
60 } 60 }
61 61
62 virtual ~TiledLayerTest() 62 virtual ~TiledLayerTest()
63 { 63 {
64 textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider. get()); 64 textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider. get());
(...skipping 29 matching lines...) Expand all
94 void textureManagerClearAllMemory(PrioritizedTextureManager* textureManager, ResourceProvider* resourceProvider) 94 void textureManagerClearAllMemory(PrioritizedTextureManager* textureManager, ResourceProvider* resourceProvider)
95 { 95 {
96 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked; 96 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked;
97 textureManager->clearAllMemory(resourceProvider); 97 textureManager->clearAllMemory(resourceProvider);
98 textureManager->reduceMemory(resourceProvider); 98 textureManager->reduceMemory(resourceProvider);
99 } 99 }
100 void updateTextures() 100 void updateTextures()
101 { 101 {
102 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked; 102 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked;
103 DCHECK(m_queue); 103 DCHECK(m_queue);
104 scoped_ptr<TextureUpdateController> updateController = 104 scoped_ptr<ResourceUpdateController> updateController =
105 TextureUpdateController::create( 105 ResourceUpdateController::create(
106 NULL, 106 NULL,
107 Proxy::implThread(), 107 Proxy::implThread(),
108 m_queue.Pass(), 108 m_queue.Pass(),
109 m_resourceProvider.get()); 109 m_resourceProvider.get());
110 updateController->finalize(); 110 updateController->finalize();
111 m_queue = make_scoped_ptr(new TextureUpdateQueue); 111 m_queue = make_scoped_ptr(new ResourceUpdateQueue);
112 } 112 }
113 void layerPushPropertiesTo(FakeTiledLayer* layer, FakeTiledLayerImpl* layerI mpl) 113 void layerPushPropertiesTo(FakeTiledLayer* layer, FakeTiledLayerImpl* layerI mpl)
114 { 114 {
115 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked; 115 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked;
116 layer->pushPropertiesTo(layerImpl); 116 layer->pushPropertiesTo(layerImpl);
117 } 117 }
118 void layerUpdate(FakeTiledLayer* layer, TestOcclusionTracker* occluded) 118 void layerUpdate(FakeTiledLayer* layer, TestOcclusionTracker* occluded)
119 { 119 {
120 DebugScopedSetMainThread mainThread; 120 DebugScopedSetMainThread mainThread;
121 layer->update(*m_queue.get(), occluded, m_stats); 121 layer->update(*m_queue.get(), occluded, m_stats);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (layer2) 153 if (layer2)
154 layerPushPropertiesTo(layer2, layerImpl2); 154 layerPushPropertiesTo(layer2, layerImpl2);
155 155
156 return needsUpdate; 156 return needsUpdate;
157 } 157 }
158 158
159 public: 159 public:
160 WebKitTests::WebCompositorInitializer m_compositorInitializer; 160 WebKitTests::WebCompositorInitializer m_compositorInitializer;
161 scoped_ptr<GraphicsContext> m_context; 161 scoped_ptr<GraphicsContext> m_context;
162 scoped_ptr<ResourceProvider> m_resourceProvider; 162 scoped_ptr<ResourceProvider> m_resourceProvider;
163 scoped_ptr<TextureUpdateQueue> m_queue; 163 scoped_ptr<ResourceUpdateQueue> m_queue;
164 RenderingStats m_stats; 164 RenderingStats m_stats;
165 PriorityCalculator m_priorityCalculator; 165 PriorityCalculator m_priorityCalculator;
166 scoped_ptr<PrioritizedTextureManager> m_textureManager; 166 scoped_ptr<PrioritizedTextureManager> m_textureManager;
167 TestOcclusionTracker* m_occlusion; 167 TestOcclusionTracker* m_occlusion;
168 }; 168 };
169 169
170 TEST_F(TiledLayerTest, pushDirtyTiles) 170 TEST_F(TiledLayerTest, pushDirtyTiles)
171 { 171 {
172 scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer( m_textureManager.get())); 172 scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer( m_textureManager.get()));
173 ScopedFakeTiledLayerImpl layerImpl(1); 173 ScopedFakeTiledLayerImpl layerImpl(1);
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 updateTextures(); 1619 updateTextures();
1620 1620
1621 // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. 1621 // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds.
1622 layer->setNeedsDisplayRect(layerRect); 1622 layer->setNeedsDisplayRect(layerRect);
1623 layer->update(*m_queue.get(), 0, m_stats); 1623 layer->update(*m_queue.get(), 0, m_stats);
1624 1624
1625 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); 1625 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect());
1626 } 1626 }
1627 1627
1628 } // namespace 1628 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698