| 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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/synchronization/lock.h" | 7 #include "base/synchronization/lock.h" |
| 8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
| 9 #include "cc/content_layer_client.h" | 9 #include "cc/content_layer_client.h" |
| 10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
| (...skipping 2941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2952 class LayerTreeHostTestLostContextWhileUpdatingResources : public LayerTreeHostT
est { | 2952 class LayerTreeHostTestLostContextWhileUpdatingResources : public LayerTreeHostT
est { |
| 2953 public: | 2953 public: |
| 2954 LayerTreeHostTestLostContextWhileUpdatingResources() | 2954 LayerTreeHostTestLostContextWhileUpdatingResources() |
| 2955 : m_parent(ContentLayerWithUpdateTracking::create(&m_client)) | 2955 : m_parent(ContentLayerWithUpdateTracking::create(&m_client)) |
| 2956 , m_numChildren(50) | 2956 , m_numChildren(50) |
| 2957 { | 2957 { |
| 2958 for (int i = 0; i < m_numChildren; i++) | 2958 for (int i = 0; i < m_numChildren; i++) |
| 2959 m_children.push_back(ContentLayerWithUpdateTracking::create(&m_clien
t)); | 2959 m_children.push_back(ContentLayerWithUpdateTracking::create(&m_clien
t)); |
| 2960 } | 2960 } |
| 2961 | 2961 |
| 2962 virtual scoped_ptr<OutputSurface> createOutputSurface() | |
| 2963 { | |
| 2964 return FakeOutputSurface::Create3d(CompositorFakeWebGraphicsContext3DWit
hEndQueryCausingLostContext::create(WebGraphicsContext3D::Attributes()).PassAs<W
ebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | |
| 2965 } | |
| 2966 | |
| 2967 virtual void beginTest() | 2962 virtual void beginTest() |
| 2968 { | 2963 { |
| 2969 m_layerTreeHost->setRootLayer(m_parent); | 2964 m_layerTreeHost->setRootLayer(m_parent); |
| 2970 m_layerTreeHost->setViewportSize(gfx::Size(m_numChildren, 1), gfx::Size(
m_numChildren, 1)); | 2965 m_layerTreeHost->setViewportSize(gfx::Size(m_numChildren, 1), gfx::Size(
m_numChildren, 1)); |
| 2971 | 2966 |
| 2972 gfx::Transform identityMatrix; | 2967 gfx::Transform identityMatrix; |
| 2973 setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, gfx::Poi
ntF(0, 0), gfx::PointF(0, 0), gfx::Size(m_numChildren, 1), true); | 2968 setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, gfx::Poi
ntF(0, 0), gfx::PointF(0, 0), gfx::Size(m_numChildren, 1), true); |
| 2974 for (int i = 0; i < m_numChildren; i++) | 2969 for (int i = 0; i < m_numChildren; i++) |
| 2975 setLayerPropertiesForTesting(m_children[i].get(), m_parent.get(), id
entityMatrix, gfx::PointF(0, 0), gfx::PointF(i, 0), gfx::Size(1, 1), false); | 2970 setLayerPropertiesForTesting(m_children[i].get(), m_parent.get(), id
entityMatrix, gfx::PointF(0, 0), gfx::PointF(i, 0), gfx::Size(1, 1), false); |
| 2976 | 2971 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3327 LayerTreeHostWithProxy host(&client, settings, proxy.PassAs<Proxy>()); | 3322 LayerTreeHostWithProxy host(&client, settings, proxy.PassAs<Proxy>()); |
| 3328 EXPECT_TRUE(host.initializeRendererIfNeeded()); | 3323 EXPECT_TRUE(host.initializeRendererIfNeeded()); |
| 3329 | 3324 |
| 3330 EXPECT_EQ(10u, host.settings().maxPartialTextureUpdates); | 3325 EXPECT_EQ(10u, host.settings().maxPartialTextureUpdates); |
| 3331 } | 3326 } |
| 3332 } | 3327 } |
| 3333 | 3328 |
| 3334 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) | 3329 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) |
| 3335 { | 3330 { |
| 3336 bool useSoftwareRendering = false; | 3331 bool useSoftwareRendering = false; |
| 3337 FakeLayerImplTreeHostClient client(useSoftwareRendering); | 3332 bool useDelegatingRenderer = false; |
| 3333 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender
er); |
| 3338 | 3334 |
| 3339 LayerTreeSettings settings; | 3335 LayerTreeSettings settings; |
| 3340 settings.maxPartialTextureUpdates = 4; | 3336 settings.maxPartialTextureUpdates = 4; |
| 3341 | 3337 |
| 3342 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); | 3338 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); |
| 3343 EXPECT_TRUE(host->initializeRendererIfNeeded()); | 3339 EXPECT_TRUE(host->initializeRendererIfNeeded()); |
| 3344 EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates); | 3340 EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates); |
| 3345 } | 3341 } |
| 3346 | 3342 |
| 3347 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) | 3343 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) |
| 3348 { | 3344 { |
| 3349 bool useSoftwareRendering = true; | 3345 bool useSoftwareRendering = true; |
| 3350 FakeLayerImplTreeHostClient client(useSoftwareRendering); | 3346 bool useDelegatingRenderer = false; |
| 3347 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender
er); |
| 3351 | 3348 |
| 3352 LayerTreeSettings settings; | 3349 LayerTreeSettings settings; |
| 3353 settings.maxPartialTextureUpdates = 4; | 3350 settings.maxPartialTextureUpdates = 4; |
| 3354 | 3351 |
| 3355 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); | 3352 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); |
| 3356 EXPECT_TRUE(host->initializeRendererIfNeeded()); | 3353 EXPECT_TRUE(host->initializeRendererIfNeeded()); |
| 3357 EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates); | 3354 EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates); |
| 3358 } | 3355 } |
| 3359 | 3356 |
| 3357 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) |
| 3358 { |
| 3359 bool useSoftwareRendering = false; |
| 3360 bool useDelegatingRenderer = true; |
| 3361 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender
er); |
| 3362 |
| 3363 LayerTreeSettings settings; |
| 3364 settings.maxPartialTextureUpdates = 4; |
| 3365 |
| 3366 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); |
| 3367 EXPECT_TRUE(host->initializeRendererIfNeeded()); |
| 3368 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); |
| 3369 } |
| 3370 |
| 3371 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndSoftwareContent) |
| 3372 { |
| 3373 bool useSoftwareRendering = true; |
| 3374 bool useDelegatingRenderer = true; |
| 3375 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender
er); |
| 3376 |
| 3377 LayerTreeSettings settings; |
| 3378 settings.maxPartialTextureUpdates = 4; |
| 3379 |
| 3380 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); |
| 3381 EXPECT_TRUE(host->initializeRendererIfNeeded()); |
| 3382 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); |
| 3383 } |
| 3384 |
| 3360 } // namespace | 3385 } // namespace |
| 3361 } // namespace cc | 3386 } // namespace cc |
| OLD | NEW |