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 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 EXPECT_EQ(10u, host.MaxPartialTextureUpdates()); | 2433 EXPECT_EQ(10u, host.MaxPartialTextureUpdates()); |
2433 } | 2434 } |
2434 } | 2435 } |
2435 | 2436 |
2436 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { | 2437 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { |
2437 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 2438 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
2438 | 2439 |
2439 LayerTreeSettings settings; | 2440 LayerTreeSettings settings; |
2440 settings.max_partial_texture_updates = 4; | 2441 settings.max_partial_texture_updates = 4; |
2441 | 2442 |
2442 scoped_ptr<LayerTreeHost> host = | 2443 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2443 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings); | 2444 new TestSharedBitmapManager()); |
| 2445 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
| 2446 &client, &client, shared_bitmap_manager.get(), settings); |
2444 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2447 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
2445 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2448 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
2446 } | 2449 } |
2447 | 2450 |
2448 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { | 2451 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { |
2449 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); | 2452 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); |
2450 | 2453 |
2451 LayerTreeSettings settings; | 2454 LayerTreeSettings settings; |
2452 settings.max_partial_texture_updates = 4; | 2455 settings.max_partial_texture_updates = 4; |
2453 | 2456 |
2454 scoped_ptr<LayerTreeHost> host = | 2457 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2455 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings); | 2458 new TestSharedBitmapManager()); |
| 2459 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
| 2460 &client, &client, shared_bitmap_manager.get(), settings); |
2456 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2461 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
2457 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2462 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
2458 } | 2463 } |
2459 | 2464 |
2460 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { | 2465 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { |
2461 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); | 2466 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); |
2462 | 2467 |
2463 LayerTreeSettings settings; | 2468 LayerTreeSettings settings; |
2464 settings.max_partial_texture_updates = 4; | 2469 settings.max_partial_texture_updates = 4; |
2465 | 2470 |
2466 scoped_ptr<LayerTreeHost> host = | 2471 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2467 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings); | 2472 new TestSharedBitmapManager()); |
| 2473 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
| 2474 &client, &client, shared_bitmap_manager.get(), settings); |
2468 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2475 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
2469 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2476 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2470 } | 2477 } |
2471 | 2478 |
2472 TEST(LayerTreeHostTest, | 2479 TEST(LayerTreeHostTest, |
2473 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { | 2480 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { |
2474 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); | 2481 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); |
2475 | 2482 |
2476 LayerTreeSettings settings; | 2483 LayerTreeSettings settings; |
2477 settings.max_partial_texture_updates = 4; | 2484 settings.max_partial_texture_updates = 4; |
2478 | 2485 |
2479 scoped_ptr<LayerTreeHost> host = | 2486 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2480 LayerTreeHost::CreateSingleThreaded(&client, &client, NULL, settings); | 2487 new TestSharedBitmapManager()); |
| 2488 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
| 2489 &client, &client, shared_bitmap_manager.get(), settings); |
2481 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2490 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
2482 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2491 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2483 } | 2492 } |
2484 | 2493 |
2485 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted | 2494 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted |
2486 : public LayerTreeHostTest { | 2495 : public LayerTreeHostTest { |
2487 public: | 2496 public: |
2488 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() | 2497 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() |
2489 : root_layer_(FakeContentLayer::Create(&client_)), | 2498 : root_layer_(FakeContentLayer::Create(&client_)), |
2490 child_layer1_(FakeContentLayer::Create(&client_)), | 2499 child_layer1_(FakeContentLayer::Create(&client_)), |
(...skipping 2699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5190 } | 5199 } |
5191 | 5200 |
5192 virtual void AfterTest() OVERRIDE {} | 5201 virtual void AfterTest() OVERRIDE {} |
5193 | 5202 |
5194 FakeContentLayerClient client_; | 5203 FakeContentLayerClient client_; |
5195 }; | 5204 }; |
5196 | 5205 |
5197 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationSetting); | 5206 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationSetting); |
5198 | 5207 |
5199 } // namespace cc | 5208 } // namespace cc |
OLD | NEW |