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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 12519006: cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated all tests Created 7 years, 9 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/proxy.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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/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 14 matching lines...) Expand all
25 #include "cc/output/compositor_frame_metadata.h" 25 #include "cc/output/compositor_frame_metadata.h"
26 #include "cc/output/gl_renderer.h" 26 #include "cc/output/gl_renderer.h"
27 #include "cc/quads/render_pass_draw_quad.h" 27 #include "cc/quads/render_pass_draw_quad.h"
28 #include "cc/quads/solid_color_draw_quad.h" 28 #include "cc/quads/solid_color_draw_quad.h"
29 #include "cc/quads/texture_draw_quad.h" 29 #include "cc/quads/texture_draw_quad.h"
30 #include "cc/quads/tile_draw_quad.h" 30 #include "cc/quads/tile_draw_quad.h"
31 #include "cc/resources/layer_tiling_data.h" 31 #include "cc/resources/layer_tiling_data.h"
32 #include "cc/test/animation_test_common.h" 32 #include "cc/test/animation_test_common.h"
33 #include "cc/test/fake_output_surface.h" 33 #include "cc/test/fake_output_surface.h"
34 #include "cc/test/fake_proxy.h" 34 #include "cc/test/fake_proxy.h"
35 #include "cc/test/fake_rendering_stats_instrumentation.h"
35 #include "cc/test/fake_video_frame_provider.h" 36 #include "cc/test/fake_video_frame_provider.h"
36 #include "cc/test/fake_web_scrollbar_theme_geometry.h" 37 #include "cc/test/fake_web_scrollbar_theme_geometry.h"
37 #include "cc/test/geometry_test_utils.h" 38 #include "cc/test/geometry_test_utils.h"
38 #include "cc/test/layer_test_common.h" 39 #include "cc/test/layer_test_common.h"
39 #include "cc/test/render_pass_test_common.h" 40 #include "cc/test/render_pass_test_common.h"
40 #include "cc/test/test_web_graphics_context_3d.h" 41 #include "cc/test/test_web_graphics_context_3d.h"
41 #include "cc/trees/layer_tree_impl.h" 42 #include "cc/trees/layer_tree_impl.h"
42 #include "cc/trees/single_thread_proxy.h" 43 #include "cc/trees/single_thread_proxy.h"
43 #include "media/base/media.h" 44 #include "media/base/media.h"
44 #include "testing/gmock/include/gmock/gmock.h" 45 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 26 matching lines...) Expand all
71 , m_reduceMemoryResult(true) 72 , m_reduceMemoryResult(true)
72 { 73 {
73 media::InitializeMediaLibraryForTesting(); 74 media::InitializeMediaLibraryForTesting();
74 } 75 }
75 76
76 virtual void SetUp() 77 virtual void SetUp()
77 { 78 {
78 LayerTreeSettings settings; 79 LayerTreeSettings settings;
79 settings.minimum_occlusion_tracking_size = gfx::Size(); 80 settings.minimum_occlusion_tracking_size = gfx::Size();
80 81
81 m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); 82 m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_stat sInstrumentation);
82 m_hostImpl->InitializeRenderer(createOutputSurface()); 83 m_hostImpl->InitializeRenderer(createOutputSurface());
83 m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 84 m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
84 } 85 }
85 86
86 virtual void TearDown() 87 virtual void TearDown()
87 { 88 {
88 } 89 }
89 90
90 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE { } 91 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE { }
91 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE { } 92 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE { }
(...skipping 13 matching lines...) Expand all
105 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) OV ERRIDE { } 106 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) OV ERRIDE { }
106 107
107 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; } 108 void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; }
108 109
109 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS urface) 110 void createLayerTreeHost(bool partialSwap, scoped_ptr<OutputSurface> outputS urface)
110 { 111 {
111 LayerTreeSettings settings; 112 LayerTreeSettings settings;
112 settings.minimum_occlusion_tracking_size = gfx::Size(); 113 settings.minimum_occlusion_tracking_size = gfx::Size();
113 settings.partial_swap_enabled = partialSwap; 114 settings.partial_swap_enabled = partialSwap;
114 115
115 m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); 116 m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_stat sInstrumentation);
116 117
117 m_hostImpl->InitializeRenderer(outputSurface.Pass()); 118 m_hostImpl->InitializeRenderer(outputSurface.Pass());
118 m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 119 m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
119 } 120 }
120 121
121 void setupRootLayerImpl(scoped_ptr<LayerImpl> root) 122 void setupRootLayerImpl(scoped_ptr<LayerImpl> root)
122 { 123 {
123 root->SetAnchorPoint(gfx::PointF(0, 0)); 124 root->SetAnchorPoint(gfx::PointF(0, 0));
124 root->SetPosition(gfx::PointF(0, 0)); 125 root->SetPosition(gfx::PointF(0, 0));
125 root->SetBounds(gfx::Size(10, 10)); 126 root->SetBounds(gfx::Size(10, 10));
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 LayerTreeHostImpl::FrameData frameData; 218 LayerTreeHostImpl::FrameData frameData;
218 m_hostImpl->PrepareToDraw(&frameData); 219 m_hostImpl->PrepareToDraw(&frameData);
219 m_hostImpl->DidDrawAllLayers(frameData); 220 m_hostImpl->DidDrawAllLayers(frameData);
220 } 221 }
221 222
222 FakeProxy m_proxy; 223 FakeProxy m_proxy;
223 DebugScopedSetImplThread m_alwaysImplThread; 224 DebugScopedSetImplThread m_alwaysImplThread;
224 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked; 225 DebugScopedSetMainThreadBlocked m_alwaysMainThreadBlocked;
225 226
226 scoped_ptr<LayerTreeHostImpl> m_hostImpl; 227 scoped_ptr<LayerTreeHostImpl> m_hostImpl;
228 FakeRenderingStatsInstrumentation m_statsInstrumentation;
227 bool m_onCanDrawStateChangedCalled; 229 bool m_onCanDrawStateChangedCalled;
228 bool m_hasPendingTree; 230 bool m_hasPendingTree;
229 bool m_didRequestCommit; 231 bool m_didRequestCommit;
230 bool m_didRequestRedraw; 232 bool m_didRequestRedraw;
231 bool m_didUploadVisibleTile; 233 bool m_didUploadVisibleTile;
232 bool m_reduceMemoryResult; 234 bool m_reduceMemoryResult;
233 }; 235 };
234 236
235 class TestWebGraphicsContext3DMakeCurrentFails : public TestWebGraphicsContext3D { 237 class TestWebGraphicsContext3DMakeCurrentFails : public TestWebGraphicsContext3D {
236 public: 238 public:
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 379
378 TEST_F(LayerTreeHostImplTest, scrollWithoutRootLayer) 380 TEST_F(LayerTreeHostImplTest, scrollWithoutRootLayer)
379 { 381 {
380 // We should not crash when trying to scroll an empty layer tree. 382 // We should not crash when trying to scroll an empty layer tree.
381 EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee l), InputHandlerClient::ScrollIgnored); 383 EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee l), InputHandlerClient::ScrollIgnored);
382 } 384 }
383 385
384 TEST_F(LayerTreeHostImplTest, scrollWithoutRenderer) 386 TEST_F(LayerTreeHostImplTest, scrollWithoutRenderer)
385 { 387 {
386 LayerTreeSettings settings; 388 LayerTreeSettings settings;
387 m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); 389 m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsIns trumentation);
388 390
389 // Initialization will fail here. 391 // Initialization will fail here.
390 m_hostImpl->InitializeRenderer(FakeOutputSurface::Create3d(scoped_ptr<WebKit ::WebGraphicsContext3D>(new TestWebGraphicsContext3DMakeCurrentFails)).PassAs<Ou tputSurface>()); 392 m_hostImpl->InitializeRenderer(FakeOutputSurface::Create3d(scoped_ptr<WebKit ::WebGraphicsContext3D>(new TestWebGraphicsContext3DMakeCurrentFails)).PassAs<Ou tputSurface>());
391 m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 393 m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
392 394
393 setupScrollAndContentsLayers(gfx::Size(100, 100)); 395 setupScrollAndContentsLayers(gfx::Size(100, 100));
394 396
395 // We should not crash when trying to scroll after the renderer initializati on fails. 397 // We should not crash when trying to scroll after the renderer initializati on fails.
396 EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee l), InputHandlerClient::ScrollIgnored); 398 EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee l), InputHandlerClient::ScrollIgnored);
397 } 399 }
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 EXPECT_FALSE(m_didRequestRedraw); 1097 EXPECT_FALSE(m_didRequestRedraw);
1096 EXPECT_FALSE(m_didRequestCommit); 1098 EXPECT_FALSE(m_didRequestCommit);
1097 } 1099 }
1098 1100
1099 TEST_F(LayerTreeHostImplTest, scrollNonScrollableRootWithTopControls) 1101 TEST_F(LayerTreeHostImplTest, scrollNonScrollableRootWithTopControls)
1100 { 1102 {
1101 LayerTreeSettings settings; 1103 LayerTreeSettings settings;
1102 settings.calculate_top_controls_position = true; 1104 settings.calculate_top_controls_position = true;
1103 settings.top_controls_height = 50; 1105 settings.top_controls_height = 50;
1104 1106
1105 m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy); 1107 m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy, &m_statsIns trumentation);
1106 m_hostImpl->InitializeRenderer(createOutputSurface()); 1108 m_hostImpl->InitializeRenderer(createOutputSurface());
1107 m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 1109 m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
1108 1110
1109 gfx::Size layerSize(5, 5); 1111 gfx::Size layerSize(5, 5);
1110 scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1) ; 1112 scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1) ;
1111 root->SetScrollable(true); 1113 root->SetScrollable(true);
1112 root->SetMaxScrollOffset(gfx::Vector2d(layerSize.width(), layerSize.height() )); 1114 root->SetMaxScrollOffset(gfx::Vector2d(layerSize.width(), layerSize.height() ));
1113 root->SetBounds(layerSize); 1115 root->SetBounds(layerSize);
1114 root->SetContentBounds(layerSize); 1116 root->SetContentBounds(layerSize);
1115 root->SetPosition(gfx::PointF(0, 0)); 1117 root->SetPosition(gfx::PointF(0, 0));
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 // where it should request to swap only the subBuffer that is damaged. 2147 // where it should request to swap only the subBuffer that is damaged.
2146 TEST_F(LayerTreeHostImplTest, partialSwapReceivesDamageRect) 2148 TEST_F(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
2147 { 2149 {
2148 scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped _ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<Output Surface>(); 2150 scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped _ptr<WebKit::WebGraphicsContext3D>(new PartialSwapTrackerContext)).PassAs<Output Surface>();
2149 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack erContext*>(outputSurface->context3d()); 2151 PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrack erContext*>(outputSurface->context3d());
2150 2152
2151 // This test creates its own LayerTreeHostImpl, so 2153 // This test creates its own LayerTreeHostImpl, so
2152 // that we can force partial swap enabled. 2154 // that we can force partial swap enabled.
2153 LayerTreeSettings settings; 2155 LayerTreeSettings settings;
2154 settings.partial_swap_enabled = true; 2156 settings.partial_swap_enabled = true;
2155 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::Create( settings, this, &m_proxy); 2157 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::Create( settings, this, &m_proxy, &m_statsInstrumentation);
2156 layerTreeHostImpl->InitializeRenderer(outputSurface.Pass()); 2158 layerTreeHostImpl->InitializeRenderer(outputSurface.Pass());
2157 layerTreeHostImpl->SetViewportSize(gfx::Size(500, 500), gfx::Size(500, 500)) ; 2159 layerTreeHostImpl->SetViewportSize(gfx::Size(500, 500), gfx::Size(500, 500)) ;
2158 2160
2159 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::Create(layerTreeHostImpl ->active_tree(), 1); 2161 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::Create(layerTreeHostImpl ->active_tree(), 1);
2160 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::Create(layerTreeHostImp l->active_tree(), 2); 2162 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::Create(layerTreeHostImp l->active_tree(), 2);
2161 child->SetPosition(gfx::PointF(12, 13)); 2163 child->SetPosition(gfx::PointF(12, 13));
2162 child->SetAnchorPoint(gfx::PointF(0, 0)); 2164 child->SetAnchorPoint(gfx::PointF(0, 0));
2163 child->SetBounds(gfx::Size(14, 15)); 2165 child->SetBounds(gfx::Size(14, 15));
2164 child->SetContentBounds(gfx::Size(14, 15)); 2166 child->SetContentBounds(gfx::Size(14, 15));
2165 child->SetDrawsContent(true); 2167 child->SetDrawsContent(true);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
2437 } 2439 }
2438 2440
2439 // Unlimited texture size. 2441 // Unlimited texture size.
2440 virtual void getIntegerv(WebKit::WGC3Denum pname, WebKit::WGC3Dint* value) 2442 virtual void getIntegerv(WebKit::WGC3Denum pname, WebKit::WGC3Dint* value)
2441 { 2443 {
2442 if (pname == GL_MAX_TEXTURE_SIZE) 2444 if (pname == GL_MAX_TEXTURE_SIZE)
2443 *value = 8192; 2445 *value = 8192;
2444 } 2446 }
2445 }; 2447 };
2446 2448
2447 static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay erTreeHostImplClient* client, Proxy* proxy) 2449 static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay erTreeHostImplClient* client, Proxy* proxy, RenderingStatsInstrumentation* stats Instrumentation)
2448 { 2450 {
2449 scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped _ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface >(); 2451 scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped _ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface >();
2450 2452
2451 LayerTreeSettings settings; 2453 LayerTreeSettings settings;
2452 settings.partial_swap_enabled = partialSwap; 2454 settings.partial_swap_enabled = partialSwap;
2453 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, client, proxy); 2455 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, client, proxy, statsInstrumentation);
2454 myHostImpl->InitializeRenderer(outputSurface.Pass()); 2456 myHostImpl->InitializeRenderer(outputSurface.Pass());
2455 myHostImpl->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); 2457 myHostImpl->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
2456 2458
2457 /* 2459 /*
2458 Layers are created as follows: 2460 Layers are created as follows:
2459 2461
2460 +--------------------+ 2462 +--------------------+
2461 | 1 | 2463 | 1 |
2462 | +-----------+ | 2464 | +-----------+ |
2463 | | 2 | | 2465 | | 2 | |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 2509
2508 child->AddChild(grandChild.Pass()); 2510 child->AddChild(grandChild.Pass());
2509 root->AddChild(child.Pass()); 2511 root->AddChild(child.Pass());
2510 2512
2511 myHostImpl->active_tree()->SetRootLayer(root.Pass()); 2513 myHostImpl->active_tree()->SetRootLayer(root.Pass());
2512 return myHostImpl.Pass(); 2514 return myHostImpl.Pass();
2513 } 2515 }
2514 2516
2515 TEST_F(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) 2517 TEST_F(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap)
2516 { 2518 {
2517 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this, &m_proxy); 2519 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(true, this, &m_proxy, &m_statsInstrumentation);
2518 2520
2519 { 2521 {
2520 LayerTreeHostImpl::FrameData frame; 2522 LayerTreeHostImpl::FrameData frame;
2521 EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame)); 2523 EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
2522 2524
2523 // Verify all quads have been computed 2525 // Verify all quads have been computed
2524 ASSERT_EQ(2U, frame.render_passes.size()); 2526 ASSERT_EQ(2U, frame.render_passes.size());
2525 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); 2527 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
2526 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); 2528 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
2527 EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.render_passes[0]->quad_list[0]->m aterial); 2529 EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.render_passes[0]->quad_list[0]->m aterial);
2528 EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->m aterial); 2530 EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->m aterial);
2529 2531
2530 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now()); 2532 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now());
2531 myHostImpl->DidDrawAllLayers(frame); 2533 myHostImpl->DidDrawAllLayers(frame);
2532 } 2534 }
2533 } 2535 }
2534 2536
2535 TEST_F(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap) 2537 TEST_F(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap)
2536 { 2538 {
2537 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this , &m_proxy); 2539 scoped_ptr<LayerTreeHostImpl> myHostImpl = setupLayersForOpacity(false, this , &m_proxy, &m_statsInstrumentation);
2538 2540
2539 { 2541 {
2540 LayerTreeHostImpl::FrameData frame; 2542 LayerTreeHostImpl::FrameData frame;
2541 EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame)); 2543 EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
2542 2544
2543 // Verify all quads have been computed 2545 // Verify all quads have been computed
2544 ASSERT_EQ(2U, frame.render_passes.size()); 2546 ASSERT_EQ(2U, frame.render_passes.size());
2545 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); 2547 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
2546 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); 2548 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
2547 EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.render_passes[0]->quad_list[0]->m aterial); 2549 EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.render_passes[0]->quad_list[0]->m aterial);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2742 class GLRendererWithReleaseTextures : public GLRenderer { 2744 class GLRendererWithReleaseTextures : public GLRenderer {
2743 public: 2745 public:
2744 using GLRenderer::ReleaseRenderPassTextures; 2746 using GLRenderer::ReleaseRenderPassTextures;
2745 }; 2747 };
2746 2748
2747 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusion) 2749 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusion)
2748 { 2750 {
2749 LayerTreeSettings settings; 2751 LayerTreeSettings settings;
2750 settings.minimum_occlusion_tracking_size = gfx::Size(); 2752 settings.minimum_occlusion_tracking_size = gfx::Size();
2751 settings.cache_render_pass_contents = true; 2753 settings.cache_render_pass_contents = true;
2752 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy); 2754 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy, &m_statsInstrumentation);
2753 2755
2754 // Layers are structure as follows: 2756 // Layers are structure as follows:
2755 // 2757 //
2756 // R +-- S1 +- L10 (owning) 2758 // R +-- S1 +- L10 (owning)
2757 // | +- L11 2759 // | +- L11
2758 // | +- L12 2760 // | +- L12
2759 // | 2761 // |
2760 // +-- S2 +- L20 (owning) 2762 // +-- S2 +- L20 (owning)
2761 // +- L21 2763 // +- L21
2762 // 2764 //
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 myHostImpl->DidDrawAllLayers(frame); 2859 myHostImpl->DidDrawAllLayers(frame);
2858 } 2860 }
2859 2861
2860 } 2862 }
2861 2863
2862 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut) 2864 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
2863 { 2865 {
2864 LayerTreeSettings settings; 2866 LayerTreeSettings settings;
2865 settings.minimum_occlusion_tracking_size = gfx::Size(); 2867 settings.minimum_occlusion_tracking_size = gfx::Size();
2866 settings.cache_render_pass_contents = true; 2868 settings.cache_render_pass_contents = true;
2867 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy); 2869 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy, &m_statsInstrumentation);
2868 2870
2869 // Layers are structure as follows: 2871 // Layers are structure as follows:
2870 // 2872 //
2871 // R +-- S1 +- L10 (owning, non drawing) 2873 // R +-- S1 +- L10 (owning, non drawing)
2872 // | +- L11 (corner, unoccluded) 2874 // | +- L11 (corner, unoccluded)
2873 // | +- L12 (corner, unoccluded) 2875 // | +- L12 (corner, unoccluded)
2874 // | +- L13 (corner, unoccluded) 2876 // | +- L13 (corner, unoccluded)
2875 // | +- L14 (corner, entirely occluded) 2877 // | +- L14 (corner, entirely occluded)
2876 // | 2878 // |
2877 // +-- S2 +- L20 (owning, drawing) 2879 // +-- S2 +- L20 (owning, drawing)
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2972 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now()); 2974 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now());
2973 myHostImpl->DidDrawAllLayers(frame); 2975 myHostImpl->DidDrawAllLayers(frame);
2974 } 2976 }
2975 } 2977 }
2976 2978
2977 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) 2979 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
2978 { 2980 {
2979 LayerTreeSettings settings; 2981 LayerTreeSettings settings;
2980 settings.minimum_occlusion_tracking_size = gfx::Size(); 2982 settings.minimum_occlusion_tracking_size = gfx::Size();
2981 settings.cache_render_pass_contents = true; 2983 settings.cache_render_pass_contents = true;
2982 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy); 2984 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy, &m_statsInstrumentation);
2983 2985
2984 // Layers are structured as follows: 2986 // Layers are structured as follows:
2985 // 2987 //
2986 // R +-- S1 +- L10 (owning, drawing) 2988 // R +-- S1 +- L10 (owning, drawing)
2987 // | +- L11 (corner, occluded by L12) 2989 // | +- L11 (corner, occluded by L12)
2988 // | +- L12 (opposite corner) 2990 // | +- L12 (opposite corner)
2989 // | 2991 // |
2990 // +-- S2 +- L20 (owning, drawing) 2992 // +-- S2 +- L20 (owning, drawing)
2991 // 2993 //
2992 2994
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 3061
3060 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now()); 3062 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now());
3061 myHostImpl->DidDrawAllLayers(frame); 3063 myHostImpl->DidDrawAllLayers(frame);
3062 } 3064 }
3063 } 3065 }
3064 3066
3065 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) 3067 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
3066 { 3068 {
3067 LayerTreeSettings settings; 3069 LayerTreeSettings settings;
3068 settings.cache_render_pass_contents = true; 3070 settings.cache_render_pass_contents = true;
3069 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy); 3071 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy, &m_statsInstrumentation);
3070 3072
3071 // Layers are structured as follows: 3073 // Layers are structured as follows:
3072 // 3074 //
3073 // R +-- S1 +- L10 (rotated, drawing) 3075 // R +-- S1 +- L10 (rotated, drawing)
3074 // +- L11 (occupies half surface) 3076 // +- L11 (occupies half surface)
3075 3077
3076 LayerImpl* rootPtr; 3078 LayerImpl* rootPtr;
3077 LayerImpl* layerS1Ptr; 3079 LayerImpl* layerS1Ptr;
3078 3080
3079 scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped _ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface >(); 3081 scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped _ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface >();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3134 myHostImpl->DidDrawAllLayers(frame); 3136 myHostImpl->DidDrawAllLayers(frame);
3135 } 3137 }
3136 } 3138 }
3137 3139
3138 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap) 3140 TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
3139 { 3141 {
3140 LayerTreeSettings settings; 3142 LayerTreeSettings settings;
3141 settings.minimum_occlusion_tracking_size = gfx::Size(); 3143 settings.minimum_occlusion_tracking_size = gfx::Size();
3142 settings.partial_swap_enabled = true; 3144 settings.partial_swap_enabled = true;
3143 settings.cache_render_pass_contents = true; 3145 settings.cache_render_pass_contents = true;
3144 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy); 3146 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy, &m_statsInstrumentation);
3145 3147
3146 // Layers are structure as follows: 3148 // Layers are structure as follows:
3147 // 3149 //
3148 // R +-- S1 +- L10 (owning) 3150 // R +-- S1 +- L10 (owning)
3149 // | +- L11 3151 // | +- L11
3150 // | +- L12 3152 // | +- L12
3151 // | 3153 // |
3152 // +-- S2 +- L20 (owning) 3154 // +-- S2 +- L20 (owning)
3153 // +- L21 3155 // +- L21
3154 // 3156 //
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
3246 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now()); 3248 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now());
3247 myHostImpl->DidDrawAllLayers(frame); 3249 myHostImpl->DidDrawAllLayers(frame);
3248 } 3250 }
3249 } 3251 }
3250 3252
3251 TEST_F(LayerTreeHostImplTest, textureCachingWithScissor) 3253 TEST_F(LayerTreeHostImplTest, textureCachingWithScissor)
3252 { 3254 {
3253 LayerTreeSettings settings; 3255 LayerTreeSettings settings;
3254 settings.minimum_occlusion_tracking_size = gfx::Size(); 3256 settings.minimum_occlusion_tracking_size = gfx::Size();
3255 settings.cache_render_pass_contents = true; 3257 settings.cache_render_pass_contents = true;
3256 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy); 3258 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy, &m_statsInstrumentation);
3257 3259
3258 /* 3260 /*
3259 Layers are created as follows: 3261 Layers are created as follows:
3260 3262
3261 +--------------------+ 3263 +--------------------+
3262 | 1 | 3264 | 1 |
3263 | +-----------+ | 3265 | +-----------+ |
3264 | | 2 | | 3266 | | 2 | |
3265 | | +-------------------+ 3267 | | +-------------------+
3266 | | | 3 | 3268 | | | 3 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 // We should have a cached texture for surface 2 again even though it was da maged. 3355 // We should have a cached texture for surface 2 again even though it was da maged.
3354 EXPECT_TRUE(myHostImpl->renderer()->HaveCachedResourcesForRenderPassId(child PassId)); 3356 EXPECT_TRUE(myHostImpl->renderer()->HaveCachedResourcesForRenderPassId(child PassId));
3355 } 3357 }
3356 3358
3357 TEST_F(LayerTreeHostImplTest, surfaceTextureCaching) 3359 TEST_F(LayerTreeHostImplTest, surfaceTextureCaching)
3358 { 3360 {
3359 LayerTreeSettings settings; 3361 LayerTreeSettings settings;
3360 settings.minimum_occlusion_tracking_size = gfx::Size(); 3362 settings.minimum_occlusion_tracking_size = gfx::Size();
3361 settings.partial_swap_enabled = true; 3363 settings.partial_swap_enabled = true;
3362 settings.cache_render_pass_contents = true; 3364 settings.cache_render_pass_contents = true;
3363 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy); 3365 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy, &m_statsInstrumentation);
3364 3366
3365 LayerImpl* rootPtr; 3367 LayerImpl* rootPtr;
3366 LayerImpl* intermediateLayerPtr; 3368 LayerImpl* intermediateLayerPtr;
3367 LayerImpl* surfaceLayerPtr; 3369 LayerImpl* surfaceLayerPtr;
3368 LayerImpl* childPtr; 3370 LayerImpl* childPtr;
3369 3371
3370 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, gfx::Size(100, 100)); 3372 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, gfx::Size(100, 100));
3371 3373
3372 { 3374 {
3373 LayerTreeHostImpl::FrameData frame; 3375 LayerTreeHostImpl::FrameData frame;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
3512 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now()); 3514 myHostImpl->DrawLayers(&frame, base::TimeTicks::Now());
3513 myHostImpl->DidDrawAllLayers(frame); 3515 myHostImpl->DidDrawAllLayers(frame);
3514 } 3516 }
3515 } 3517 }
3516 3518
3517 TEST_F(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) 3519 TEST_F(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
3518 { 3520 {
3519 LayerTreeSettings settings; 3521 LayerTreeSettings settings;
3520 settings.minimum_occlusion_tracking_size = gfx::Size(); 3522 settings.minimum_occlusion_tracking_size = gfx::Size();
3521 settings.cache_render_pass_contents = true; 3523 settings.cache_render_pass_contents = true;
3522 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy); 3524 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(setting s, this, &m_proxy, &m_statsInstrumentation);
3523 3525
3524 LayerImpl* rootPtr; 3526 LayerImpl* rootPtr;
3525 LayerImpl* intermediateLayerPtr; 3527 LayerImpl* intermediateLayerPtr;
3526 LayerImpl* surfaceLayerPtr; 3528 LayerImpl* surfaceLayerPtr;
3527 LayerImpl* childPtr; 3529 LayerImpl* childPtr;
3528 3530
3529 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, gfx::Size(100, 100)); 3531 setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr , surfaceLayerPtr, childPtr, gfx::Size(100, 100));
3530 3532
3531 { 3533 {
3532 LayerTreeHostImpl::FrameData frame; 3534 LayerTreeHostImpl::FrameData frame;
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
4342 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), renderPassQuad->rect.ToS tring()); 4344 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), renderPassQuad->rect.ToS tring());
4343 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mas k_uv_rect.ToString()); 4345 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mas k_uv_rect.ToString());
4344 4346
4345 m_hostImpl->DrawLayers(&frame, base::TimeTicks::Now()); 4347 m_hostImpl->DrawLayers(&frame, base::TimeTicks::Now());
4346 m_hostImpl->DidDrawAllLayers(frame); 4348 m_hostImpl->DidDrawAllLayers(frame);
4347 } 4349 }
4348 } 4350 }
4349 4351
4350 } // namespace 4352 } // namespace
4351 } // namespace cc 4353 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698