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 "cc/tiled_layer.h" | 5 #include "cc/tiled_layer.h" |
6 | 6 |
7 #include "cc/bitmap_content_layer_updater.h" | 7 #include "cc/bitmap_content_layer_updater.h" |
8 #include "cc/layer_painter.h" | 8 #include "cc/layer_painter.h" |
9 #include "cc/overdraw_metrics.h" | 9 #include "cc/overdraw_metrics.h" |
10 #include "cc/rendering_stats.h" | 10 #include "cc/rendering_stats.h" |
11 #include "cc/resource_update_controller.h" | 11 #include "cc/resource_update_controller.h" |
12 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread | 12 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
13 #include "cc/test/animation_test_common.h" | 13 #include "cc/test/animation_test_common.h" |
14 #include "cc/test/fake_graphics_context.h" | |
15 #include "cc/test/fake_layer_tree_host_client.h" | 14 #include "cc/test/fake_layer_tree_host_client.h" |
| 15 #include "cc/test/fake_output_surface.h" |
16 #include "cc/test/fake_proxy.h" | 16 #include "cc/test/fake_proxy.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 "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "ui/gfx/rect_conversions.h" | 20 #include "ui/gfx/rect_conversions.h" |
21 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
22 | 22 |
23 using namespace WebKitTests; | 23 using namespace WebKitTests; |
24 | 24 |
25 namespace cc { | 25 namespace cc { |
(...skipping 15 matching lines...) Expand all Loading... |
41 virtual gfx::Rect layerClipRectInTarget(const Layer* layer) const OVERRIDE {
return m_layerClipRectInTarget; } | 41 virtual gfx::Rect layerClipRectInTarget(const Layer* layer) const OVERRIDE {
return m_layerClipRectInTarget; } |
42 | 42 |
43 private: | 43 private: |
44 gfx::Rect m_layerClipRectInTarget; | 44 gfx::Rect m_layerClipRectInTarget; |
45 }; | 45 }; |
46 | 46 |
47 class TiledLayerTest : public testing::Test { | 47 class TiledLayerTest : public testing::Test { |
48 public: | 48 public: |
49 TiledLayerTest() | 49 TiledLayerTest() |
50 : m_proxy(NULL) | 50 : m_proxy(NULL) |
51 , m_context(WebKit::createFakeGraphicsContext()) | 51 , m_outputSurface(createFakeOutputSurface()) |
52 , m_queue(make_scoped_ptr(new ResourceUpdateQueue)) | 52 , m_queue(make_scoped_ptr(new ResourceUpdateQueue)) |
53 , m_occlusion(0) | 53 , m_occlusion(0) |
54 { | 54 { |
55 } | 55 } |
56 | 56 |
57 virtual void SetUp() | 57 virtual void SetUp() |
58 { | 58 { |
59 m_layerTreeHost = LayerTreeHost::create(&m_fakeLayerImplTreeHostClient,
m_settings, scoped_ptr<Thread>(NULL)); | 59 m_layerTreeHost = LayerTreeHost::create(&m_fakeLayerImplTreeHostClient,
m_settings, scoped_ptr<Thread>(NULL)); |
60 m_proxy = m_layerTreeHost->proxy(); | 60 m_proxy = m_layerTreeHost->proxy(); |
61 m_resourceManager = PrioritizedResourceManager::create(Renderer::Content
Pool, m_proxy); | 61 m_resourceManager = PrioritizedResourceManager::create(Renderer::Content
Pool, m_proxy); |
62 m_layerTreeHost->initializeRendererIfNeeded(); | 62 m_layerTreeHost->initializeRendererIfNeeded(); |
63 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(m_proxy); | 63 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(m_proxy); |
64 m_resourceProvider = ResourceProvider::create(m_context.get()); | 64 m_resourceProvider = ResourceProvider::create(m_outputSurface.get()); |
65 } | 65 } |
66 | 66 |
67 virtual ~TiledLayerTest() | 67 virtual ~TiledLayerTest() |
68 { | 68 { |
69 resourceManagerClearAllMemory(m_resourceManager.get(), m_resourceProvide
r.get()); | 69 resourceManagerClearAllMemory(m_resourceManager.get(), m_resourceProvide
r.get()); |
70 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(m_proxy); | 70 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc
ked(m_proxy); |
71 m_resourceProvider.reset(); | 71 m_resourceProvider.reset(); |
72 } | 72 } |
73 | 73 |
74 class ScopedFakeTiledLayerImpl { | 74 class ScopedFakeTiledLayerImpl { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 layerPushPropertiesTo(layer1, layerImpl1); | 157 layerPushPropertiesTo(layer1, layerImpl1); |
158 if (layer2) | 158 if (layer2) |
159 layerPushPropertiesTo(layer2, layerImpl2); | 159 layerPushPropertiesTo(layer2, layerImpl2); |
160 | 160 |
161 return needsUpdate; | 161 return needsUpdate; |
162 } | 162 } |
163 | 163 |
164 public: | 164 public: |
165 Proxy* m_proxy; | 165 Proxy* m_proxy; |
166 LayerTreeSettings m_settings; | 166 LayerTreeSettings m_settings; |
167 scoped_ptr<GraphicsContext> m_context; | 167 scoped_ptr<OutputSurface> m_outputSurface; |
168 scoped_ptr<ResourceProvider> m_resourceProvider; | 168 scoped_ptr<ResourceProvider> m_resourceProvider; |
169 scoped_ptr<ResourceUpdateQueue> m_queue; | 169 scoped_ptr<ResourceUpdateQueue> m_queue; |
170 RenderingStats m_stats; | 170 RenderingStats m_stats; |
171 PriorityCalculator m_priorityCalculator; | 171 PriorityCalculator m_priorityCalculator; |
172 FakeLayerImplTreeHostClient m_fakeLayerImplTreeHostClient; | 172 FakeLayerImplTreeHostClient m_fakeLayerImplTreeHostClient; |
173 scoped_ptr<LayerTreeHost> m_layerTreeHost; | 173 scoped_ptr<LayerTreeHost> m_layerTreeHost; |
174 scoped_ptr<PrioritizedResourceManager> m_resourceManager; | 174 scoped_ptr<PrioritizedResourceManager> m_resourceManager; |
175 TestOcclusionTracker* m_occlusion; | 175 TestOcclusionTracker* m_occlusion; |
176 }; | 176 }; |
177 | 177 |
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 | 1622 |
1623 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. | 1623 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. |
1624 layer->setNeedsDisplayRect(layerRect); | 1624 layer->setNeedsDisplayRect(layerRect); |
1625 layer->update(*m_queue.get(), 0, m_stats); | 1625 layer->update(*m_queue.get(), 0, m_stats); |
1626 | 1626 |
1627 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); | 1627 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
1628 } | 1628 } |
1629 | 1629 |
1630 } // namespace | 1630 } // namespace |
1631 } // namespace cc | 1631 } // namespace cc |
OLD | NEW |