| 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 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1476 // Number of textures should be one for each layer. | 1476 // Number of textures should be one for each layer. |
| 1477 ASSERT_EQ(2u, context->NumTextures()); | 1477 ASSERT_EQ(2u, context->NumTextures()); |
| 1478 // Number of textures used for commit should be one for each layer. | 1478 // Number of textures used for commit should be one for each layer. |
| 1479 EXPECT_EQ(2u, context->NumUsedTextures()); | 1479 EXPECT_EQ(2u, context->NumUsedTextures()); |
| 1480 // Verify that used textures are correct. | 1480 // Verify that used textures are correct. |
| 1481 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); | 1481 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
| 1482 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); | 1482 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
| 1483 context->ResetUsedTextures(); | 1483 context->ResetUsedTextures(); |
| 1484 break; | 1484 break; |
| 1485 case 1: | 1485 case 1: |
| 1486 // Number of textures should be two for each content layer. | 1486 if (HasImplThread()) { |
| 1487 ASSERT_EQ(4u, context->NumTextures()); | 1487 // Number of textures should be two for each content layer. |
| 1488 ASSERT_EQ(4u, context->NumTextures()); |
| 1489 } else { |
| 1490 // In single thread we can always do partial updates, so the limit has |
| 1491 // no effect. |
| 1492 ASSERT_EQ(2u, context->NumTextures()); |
| 1493 } |
| 1488 // Number of textures used for commit should be one for each content | 1494 // Number of textures used for commit should be one for each content |
| 1489 // layer. | 1495 // layer. |
| 1490 EXPECT_EQ(2u, context->NumUsedTextures()); | 1496 EXPECT_EQ(2u, context->NumUsedTextures()); |
| 1491 | 1497 |
| 1492 // First content textures should not have been used. | 1498 if (HasImplThread()) { |
| 1493 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); | 1499 // First content textures should not have been used. |
| 1494 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); | 1500 EXPECT_FALSE(context->UsedTexture(context->TextureAt(0))); |
| 1495 // New textures should have been used. | 1501 EXPECT_FALSE(context->UsedTexture(context->TextureAt(1))); |
| 1496 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); | 1502 // New textures should have been used. |
| 1497 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); | 1503 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); |
| 1504 EXPECT_TRUE(context->UsedTexture(context->TextureAt(3))); |
| 1505 } else { |
| 1506 // In single thread we can always do partial updates, so the limit has |
| 1507 // no effect. |
| 1508 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
| 1509 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
| 1510 } |
| 1498 | 1511 |
| 1499 context->ResetUsedTextures(); | 1512 context->ResetUsedTextures(); |
| 1500 break; | 1513 break; |
| 1501 case 2: | 1514 case 2: |
| 1502 // Number of textures should be two for each content layer. | 1515 if (HasImplThread()) { |
| 1503 ASSERT_EQ(4u, context->NumTextures()); | 1516 // Number of textures should be two for each content layer. |
| 1517 ASSERT_EQ(4u, context->NumTextures()); |
| 1518 } else { |
| 1519 // In single thread we can always do partial updates, so the limit has |
| 1520 // no effect. |
| 1521 ASSERT_EQ(2u, context->NumTextures()); |
| 1522 } |
| 1504 // Number of textures used for commit should be one for each content | 1523 // Number of textures used for commit should be one for each content |
| 1505 // layer. | 1524 // layer. |
| 1506 EXPECT_EQ(2u, context->NumUsedTextures()); | 1525 EXPECT_EQ(2u, context->NumUsedTextures()); |
| 1507 | 1526 |
| 1508 // One content layer does a partial update also. | 1527 if (HasImplThread()) { |
| 1509 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); | 1528 // One content layer does a partial update also. |
| 1510 EXPECT_FALSE(context->UsedTexture(context->TextureAt(3))); | 1529 EXPECT_TRUE(context->UsedTexture(context->TextureAt(2))); |
| 1530 EXPECT_FALSE(context->UsedTexture(context->TextureAt(3))); |
| 1531 } else { |
| 1532 // In single thread we can always do partial updates, so the limit has |
| 1533 // no effect. |
| 1534 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); |
| 1535 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); |
| 1536 } |
| 1511 | 1537 |
| 1512 context->ResetUsedTextures(); | 1538 context->ResetUsedTextures(); |
| 1513 break; | 1539 break; |
| 1514 case 3: | 1540 case 3: |
| 1515 // No textures should be used for commit. | 1541 // No textures should be used for commit. |
| 1516 EXPECT_EQ(0u, context->NumUsedTextures()); | 1542 EXPECT_EQ(0u, context->NumUsedTextures()); |
| 1517 | 1543 |
| 1518 context->ResetUsedTextures(); | 1544 context->ResetUsedTextures(); |
| 1519 break; | 1545 break; |
| 1520 case 4: | 1546 case 4: |
| (...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4836 : public LayerTreeHostTestOffscreenContext { | 4862 : public LayerTreeHostTestOffscreenContext { |
| 4837 protected: | 4863 protected: |
| 4838 LayerTreeHostTestOffscreenContext_WithContext() { with_context_ = true; } | 4864 LayerTreeHostTestOffscreenContext_WithContext() { with_context_ = true; } |
| 4839 }; | 4865 }; |
| 4840 | 4866 |
| 4841 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOffscreenContext_WithContext); | 4867 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOffscreenContext_WithContext); |
| 4842 | 4868 |
| 4843 } // namespace | 4869 } // namespace |
| 4844 | 4870 |
| 4845 } // namespace cc | 4871 } // namespace cc |
| OLD | NEW |