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 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 } | 2036 } |
2037 | 2037 |
2038 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { | 2038 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { |
2039 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 2039 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
2040 | 2040 |
2041 LayerTreeSettings settings; | 2041 LayerTreeSettings settings; |
2042 settings.max_partial_texture_updates = 4; | 2042 settings.max_partial_texture_updates = 4; |
2043 | 2043 |
2044 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2044 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2045 new TestSharedBitmapManager()); | 2045 new TestSharedBitmapManager()); |
2046 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( | 2046 scoped_ptr<LayerTreeHost> host = |
2047 &client, &client, shared_bitmap_manager.get(), settings); | 2047 LayerTreeHost::CreateSingleThreaded(&client, |
| 2048 &client, |
| 2049 shared_bitmap_manager.get(), |
| 2050 settings, |
| 2051 base::MessageLoopProxy::current()); |
2048 host->Composite(base::TimeTicks::Now()); | 2052 host->Composite(base::TimeTicks::Now()); |
2049 | 2053 |
2050 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2054 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
2051 } | 2055 } |
2052 | 2056 |
2053 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { | 2057 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { |
2054 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); | 2058 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); |
2055 | 2059 |
2056 LayerTreeSettings settings; | 2060 LayerTreeSettings settings; |
2057 settings.max_partial_texture_updates = 4; | 2061 settings.max_partial_texture_updates = 4; |
2058 | 2062 |
2059 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2063 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2060 new TestSharedBitmapManager()); | 2064 new TestSharedBitmapManager()); |
2061 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( | 2065 scoped_ptr<LayerTreeHost> host = |
2062 &client, &client, shared_bitmap_manager.get(), settings); | 2066 LayerTreeHost::CreateSingleThreaded(&client, |
| 2067 &client, |
| 2068 shared_bitmap_manager.get(), |
| 2069 settings, |
| 2070 base::MessageLoopProxy::current()); |
2063 host->Composite(base::TimeTicks::Now()); | 2071 host->Composite(base::TimeTicks::Now()); |
2064 | 2072 |
2065 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2073 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
2066 } | 2074 } |
2067 | 2075 |
2068 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { | 2076 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { |
2069 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); | 2077 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); |
2070 | 2078 |
2071 LayerTreeSettings settings; | 2079 LayerTreeSettings settings; |
2072 settings.max_partial_texture_updates = 4; | 2080 settings.max_partial_texture_updates = 4; |
2073 | 2081 |
2074 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2082 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2075 new TestSharedBitmapManager()); | 2083 new TestSharedBitmapManager()); |
2076 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( | 2084 scoped_ptr<LayerTreeHost> host = |
2077 &client, &client, shared_bitmap_manager.get(), settings); | 2085 LayerTreeHost::CreateSingleThreaded(&client, |
| 2086 &client, |
| 2087 shared_bitmap_manager.get(), |
| 2088 settings, |
| 2089 base::MessageLoopProxy::current()); |
2078 host->Composite(base::TimeTicks::Now()); | 2090 host->Composite(base::TimeTicks::Now()); |
2079 | 2091 |
2080 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2092 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2081 } | 2093 } |
2082 | 2094 |
2083 TEST(LayerTreeHostTest, | 2095 TEST(LayerTreeHostTest, |
2084 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { | 2096 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { |
2085 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); | 2097 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); |
2086 | 2098 |
2087 LayerTreeSettings settings; | 2099 LayerTreeSettings settings; |
2088 settings.max_partial_texture_updates = 4; | 2100 settings.max_partial_texture_updates = 4; |
2089 | 2101 |
2090 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2102 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2091 new TestSharedBitmapManager()); | 2103 new TestSharedBitmapManager()); |
2092 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( | 2104 scoped_ptr<LayerTreeHost> host = |
2093 &client, &client, shared_bitmap_manager.get(), settings); | 2105 LayerTreeHost::CreateSingleThreaded(&client, |
| 2106 &client, |
| 2107 shared_bitmap_manager.get(), |
| 2108 settings, |
| 2109 base::MessageLoopProxy::current()); |
2094 host->Composite(base::TimeTicks::Now()); | 2110 host->Composite(base::TimeTicks::Now()); |
2095 | 2111 |
2096 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2112 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2097 } | 2113 } |
2098 | 2114 |
2099 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted | 2115 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted |
2100 : public LayerTreeHostTest { | 2116 : public LayerTreeHostTest { |
2101 public: | 2117 public: |
2102 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() | 2118 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() |
2103 : root_layer_(FakeContentLayer::Create(&client_)), | 2119 : root_layer_(FakeContentLayer::Create(&client_)), |
(...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4895 const gfx::Size bounds_; | 4911 const gfx::Size bounds_; |
4896 FakeContentLayerClient client_; | 4912 FakeContentLayerClient client_; |
4897 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 4913 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
4898 scoped_refptr<FakePictureLayer> picture_layer_; | 4914 scoped_refptr<FakePictureLayer> picture_layer_; |
4899 Layer* child_layer_; | 4915 Layer* child_layer_; |
4900 }; | 4916 }; |
4901 | 4917 |
4902 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 4918 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
4903 | 4919 |
4904 } // namespace cc | 4920 } // namespace cc |
OLD | NEW |