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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "cc/test/fake_layer_tree_host_client.h" | 33 #include "cc/test/fake_layer_tree_host_client.h" |
34 #include "cc/test/fake_output_surface.h" | 34 #include "cc/test/fake_output_surface.h" |
35 #include "cc/test/fake_painted_scrollbar_layer.h" | 35 #include "cc/test/fake_painted_scrollbar_layer.h" |
36 #include "cc/test/fake_picture_layer.h" | 36 #include "cc/test/fake_picture_layer.h" |
37 #include "cc/test/fake_picture_layer_impl.h" | 37 #include "cc/test/fake_picture_layer_impl.h" |
38 #include "cc/test/fake_proxy.h" | 38 #include "cc/test/fake_proxy.h" |
39 #include "cc/test/fake_scoped_ui_resource.h" | 39 #include "cc/test/fake_scoped_ui_resource.h" |
40 #include "cc/test/fake_video_frame_provider.h" | 40 #include "cc/test/fake_video_frame_provider.h" |
41 #include "cc/test/geometry_test_utils.h" | 41 #include "cc/test/geometry_test_utils.h" |
42 #include "cc/test/layer_tree_test.h" | 42 #include "cc/test/layer_tree_test.h" |
| 43 #include "cc/test/test_shared_bitmap_manager.h" |
43 #include "cc/test/test_web_graphics_context_3d.h" | 44 #include "cc/test/test_web_graphics_context_3d.h" |
44 #include "cc/trees/layer_tree_host_impl.h" | 45 #include "cc/trees/layer_tree_host_impl.h" |
45 #include "cc/trees/layer_tree_impl.h" | 46 #include "cc/trees/layer_tree_impl.h" |
46 #include "cc/trees/single_thread_proxy.h" | 47 #include "cc/trees/single_thread_proxy.h" |
47 #include "cc/trees/thread_proxy.h" | 48 #include "cc/trees/thread_proxy.h" |
48 #include "gpu/GLES2/gl2extchromium.h" | 49 #include "gpu/GLES2/gl2extchromium.h" |
49 #include "skia/ext/refptr.h" | 50 #include "skia/ext/refptr.h" |
50 #include "testing/gmock/include/gmock/gmock.h" | 51 #include "testing/gmock/include/gmock/gmock.h" |
51 #include "third_party/khronos/GLES2/gl2.h" | 52 #include "third_party/khronos/GLES2/gl2.h" |
52 #include "third_party/khronos/GLES2/gl2ext.h" | 53 #include "third_party/khronos/GLES2/gl2ext.h" |
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 EXPECT_EQ(10u, host.MaxPartialTextureUpdates()); | 2435 EXPECT_EQ(10u, host.MaxPartialTextureUpdates()); |
2435 } | 2436 } |
2436 } | 2437 } |
2437 | 2438 |
2438 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { | 2439 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { |
2439 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 2440 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
2440 | 2441 |
2441 LayerTreeSettings settings; | 2442 LayerTreeSettings settings; |
2442 settings.max_partial_texture_updates = 4; | 2443 settings.max_partial_texture_updates = 4; |
2443 | 2444 |
2444 scoped_ptr<LayerTreeHost> host = | 2445 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2445 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings); | 2446 new TestSharedBitmapManager()); |
| 2447 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
| 2448 &client, &client, shared_bitmap_manager.get(), settings); |
2446 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2449 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
2447 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2450 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
2448 } | 2451 } |
2449 | 2452 |
2450 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { | 2453 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { |
2451 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); | 2454 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); |
2452 | 2455 |
2453 LayerTreeSettings settings; | 2456 LayerTreeSettings settings; |
2454 settings.max_partial_texture_updates = 4; | 2457 settings.max_partial_texture_updates = 4; |
2455 | 2458 |
2456 scoped_ptr<LayerTreeHost> host = | 2459 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2457 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings); | 2460 new TestSharedBitmapManager()); |
| 2461 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
| 2462 &client, &client, shared_bitmap_manager.get(), settings); |
2458 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2463 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
2459 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2464 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
2460 } | 2465 } |
2461 | 2466 |
2462 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { | 2467 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { |
2463 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); | 2468 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); |
2464 | 2469 |
2465 LayerTreeSettings settings; | 2470 LayerTreeSettings settings; |
2466 settings.max_partial_texture_updates = 4; | 2471 settings.max_partial_texture_updates = 4; |
2467 | 2472 |
2468 scoped_ptr<LayerTreeHost> host = | 2473 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2469 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings); | 2474 new TestSharedBitmapManager()); |
| 2475 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
| 2476 &client, &client, shared_bitmap_manager.get(), settings); |
2470 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2477 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
2471 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2478 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2472 } | 2479 } |
2473 | 2480 |
2474 TEST(LayerTreeHostTest, | 2481 TEST(LayerTreeHostTest, |
2475 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { | 2482 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { |
2476 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); | 2483 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); |
2477 | 2484 |
2478 LayerTreeSettings settings; | 2485 LayerTreeSettings settings; |
2479 settings.max_partial_texture_updates = 4; | 2486 settings.max_partial_texture_updates = 4; |
2480 | 2487 |
2481 scoped_ptr<LayerTreeHost> host = | 2488 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2482 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings); | 2489 new TestSharedBitmapManager()); |
| 2490 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
| 2491 &client, &client, shared_bitmap_manager.get(), settings); |
2483 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2492 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
2484 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2493 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2485 } | 2494 } |
2486 | 2495 |
2487 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted | 2496 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted |
2488 : public LayerTreeHostTest { | 2497 : public LayerTreeHostTest { |
2489 public: | 2498 public: |
2490 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() | 2499 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() |
2491 : root_layer_(FakeContentLayer::Create(&client_)), | 2500 : root_layer_(FakeContentLayer::Create(&client_)), |
2492 child_layer1_(FakeContentLayer::Create(&client_)), | 2501 child_layer1_(FakeContentLayer::Create(&client_)), |
(...skipping 2699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5192 } | 5201 } |
5193 | 5202 |
5194 virtual void AfterTest() OVERRIDE {} | 5203 virtual void AfterTest() OVERRIDE {} |
5195 | 5204 |
5196 FakeContentLayerClient client_; | 5205 FakeContentLayerClient client_; |
5197 }; | 5206 }; |
5198 | 5207 |
5199 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationSetting); | 5208 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationSetting); |
5200 | 5209 |
5201 } // namespace cc | 5210 } // namespace cc |
OLD | NEW |