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/frame_rate_controller.h" | 10 #include "cc/frame_rate_controller.h" |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 | 1033 |
1034 virtual void beginTest() OVERRIDE | 1034 virtual void beginTest() OVERRIDE |
1035 { | 1035 { |
1036 postSetNeedsCommitToMainThread(); | 1036 postSetNeedsCommitToMainThread(); |
1037 } | 1037 } |
1038 | 1038 |
1039 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE | 1039 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE |
1040 { | 1040 { |
1041 ASSERT_EQ(0u, m_layerTreeHost->settings().maxPartialTextureUpdates); | 1041 ASSERT_EQ(0u, m_layerTreeHost->settings().maxPartialTextureUpdates); |
1042 | 1042 |
1043 FakeWebGraphicsContext3D* context = static_cast<FakeWebGraphicsContext3D
*>(impl->outputSurface()->Context3D()); | 1043 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D
*>(impl->outputSurface()->Context3D()); |
1044 | 1044 |
1045 switch (impl->activeTree()->source_frame_number()) { | 1045 switch (impl->activeTree()->source_frame_number()) { |
1046 case 0: | 1046 case 0: |
1047 // Number of textures should be one for each layer | 1047 // Number of textures should be one for each layer |
1048 ASSERT_EQ(2, context->NumTextures()); | 1048 ASSERT_EQ(2, context->NumTextures()); |
1049 // Number of textures used for commit should be one for each layer. | 1049 // Number of textures used for commit should be one for each layer. |
1050 EXPECT_EQ(2, context->NumUsedTextures()); | 1050 EXPECT_EQ(2, context->NumUsedTextures()); |
1051 // Verify that used texture is correct. | 1051 // Verify that used texture is correct. |
1052 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); | 1052 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
1053 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); | 1053 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
(...skipping 21 matching lines...) Expand all Loading... |
1075 endTest(); | 1075 endTest(); |
1076 break; | 1076 break; |
1077 default: | 1077 default: |
1078 NOTREACHED(); | 1078 NOTREACHED(); |
1079 break; | 1079 break; |
1080 } | 1080 } |
1081 } | 1081 } |
1082 | 1082 |
1083 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE | 1083 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE |
1084 { | 1084 { |
1085 FakeWebGraphicsContext3D* context = static_cast<FakeWebGraphicsContext3D
*>(impl->outputSurface()->Context3D()); | 1085 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D
*>(impl->outputSurface()->Context3D()); |
1086 | 1086 |
1087 // Number of textures used for draw should always be one for each layer. | 1087 // Number of textures used for draw should always be one for each layer. |
1088 EXPECT_EQ(2, context->NumUsedTextures()); | 1088 EXPECT_EQ(2, context->NumUsedTextures()); |
1089 context->ResetUsedTextures(); | 1089 context->ResetUsedTextures(); |
1090 } | 1090 } |
1091 | 1091 |
1092 virtual void layout() OVERRIDE | 1092 virtual void layout() OVERRIDE |
1093 { | 1093 { |
1094 m_layer->setNeedsDisplay(); | 1094 m_layer->setNeedsDisplay(); |
1095 m_scrollbar->setNeedsDisplay(); | 1095 m_scrollbar->setNeedsDisplay(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 | 1165 |
1166 virtual void beginTest() OVERRIDE | 1166 virtual void beginTest() OVERRIDE |
1167 { | 1167 { |
1168 postSetNeedsCommitToMainThread(); | 1168 postSetNeedsCommitToMainThread(); |
1169 } | 1169 } |
1170 | 1170 |
1171 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE | 1171 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE |
1172 { | 1172 { |
1173 ASSERT_EQ(1u, m_layerTreeHost->settings().maxPartialTextureUpdates); | 1173 ASSERT_EQ(1u, m_layerTreeHost->settings().maxPartialTextureUpdates); |
1174 | 1174 |
1175 FakeWebGraphicsContext3D* context = static_cast<FakeWebGraphicsContext3D
*>(impl->outputSurface()->Context3D()); | 1175 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D
*>(impl->outputSurface()->Context3D()); |
1176 | 1176 |
1177 switch (impl->activeTree()->source_frame_number()) { | 1177 switch (impl->activeTree()->source_frame_number()) { |
1178 case 0: | 1178 case 0: |
1179 // Number of textures should be one for each layer. | 1179 // Number of textures should be one for each layer. |
1180 ASSERT_EQ(4, context->NumTextures()); | 1180 ASSERT_EQ(4, context->NumTextures()); |
1181 // Number of textures used for commit should be one for each layer. | 1181 // Number of textures used for commit should be one for each layer. |
1182 EXPECT_EQ(4, context->NumUsedTextures()); | 1182 EXPECT_EQ(4, context->NumUsedTextures()); |
1183 // Verify that used textures are correct. | 1183 // Verify that used textures are correct. |
1184 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); | 1184 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
1185 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); | 1185 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 endTest(); | 1250 endTest(); |
1251 break; | 1251 break; |
1252 default: | 1252 default: |
1253 NOTREACHED(); | 1253 NOTREACHED(); |
1254 break; | 1254 break; |
1255 } | 1255 } |
1256 } | 1256 } |
1257 | 1257 |
1258 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE | 1258 virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE |
1259 { | 1259 { |
1260 FakeWebGraphicsContext3D* context = static_cast<FakeWebGraphicsContext3D
*>(impl->outputSurface()->Context3D()); | 1260 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D
*>(impl->outputSurface()->Context3D()); |
1261 | 1261 |
1262 // Number of textures used for drawing should one per layer except for | 1262 // Number of textures used for drawing should one per layer except for |
1263 // frame 3 where the viewport only contains one layer. | 1263 // frame 3 where the viewport only contains one layer. |
1264 if (impl->activeTree()->source_frame_number() == 3) | 1264 if (impl->activeTree()->source_frame_number() == 3) |
1265 EXPECT_EQ(1, context->NumUsedTextures()); | 1265 EXPECT_EQ(1, context->NumUsedTextures()); |
1266 else | 1266 else |
1267 EXPECT_EQ(4, context->NumUsedTextures()); | 1267 EXPECT_EQ(4, context->NumUsedTextures()); |
1268 | 1268 |
1269 context->ResetUsedTextures(); | 1269 context->ResetUsedTextures(); |
1270 } | 1270 } |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2099 } | 2099 } |
2100 | 2100 |
2101 TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer) | 2101 TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer) |
2102 { | 2102 { |
2103 m_delegatingRenderer = false; | 2103 m_delegatingRenderer = false; |
2104 runTest(true); | 2104 runTest(true); |
2105 } | 2105 } |
2106 | 2106 |
2107 } // namespace | 2107 } // namespace |
2108 } // namespace cc | 2108 } // namespace cc |
OLD | NEW |