OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "cc/layers/heads_up_display_layer.h" | 9 #include "cc/layers/heads_up_display_layer.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 case 3: | 1438 case 3: |
1439 LoseContext(); | 1439 LoseContext(); |
1440 break; | 1440 break; |
1441 } | 1441 } |
1442 } | 1442 } |
1443 | 1443 |
1444 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 1444 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
1445 LayerTreeHostContextTest::DidActivateTreeOnThread(impl); | 1445 LayerTreeHostContextTest::DidActivateTreeOnThread(impl); |
1446 switch (time_step_) { | 1446 switch (time_step_) { |
1447 case 1: | 1447 case 1: |
1448 // The pending requests on the impl-side should have been processed. | 1448 // The pending requests on the impl-side should not have been processed |
1449 EXPECT_NE(0u, impl->ResourceIdForUIResource(ui_resource_->id())); | 1449 // since the context was lost. But we should have marked the resource as |
| 1450 // evicted instead. |
| 1451 EXPECT_EQ(0u, impl->ResourceIdForUIResource(ui_resource_->id())); |
| 1452 EXPECT_TRUE(impl->EvictedUIResourcesExist()); |
1450 break; | 1453 break; |
1451 case 2: | 1454 case 2: |
1452 // The "lost resource" callback should have been called once. | 1455 // The "lost resource" callback should have been called once and it |
| 1456 // should have gotten recreated now and shouldn't be marked as evicted |
| 1457 // anymore. |
1453 EXPECT_EQ(1, ui_resource_->lost_resource_count); | 1458 EXPECT_EQ(1, ui_resource_->lost_resource_count); |
| 1459 EXPECT_NE(0u, impl->ResourceIdForUIResource(ui_resource_->id())); |
| 1460 EXPECT_FALSE(impl->EvictedUIResourcesExist()); |
1454 break; | 1461 break; |
1455 case 4: | 1462 case 4: |
1456 // The resource is deleted and should not be in the manager. Use | 1463 // The resource is deleted and should not be in the manager. Use |
1457 // test_id_ since ui_resource_ has been deleted. | 1464 // test_id_ since ui_resource_ has been deleted. |
1458 EXPECT_EQ(0u, impl->ResourceIdForUIResource(test_id_)); | 1465 EXPECT_EQ(0u, impl->ResourceIdForUIResource(test_id_)); |
1459 break; | 1466 break; |
1460 } | 1467 } |
1461 | 1468 |
1462 PostStepCompleteToMainThread(); | 1469 PostStepCompleteToMainThread(); |
1463 ++time_step_; | 1470 ++time_step_; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 | 1636 |
1630 bool deferred_ = false; | 1637 bool deferred_ = false; |
1631 bool lost_ = true; | 1638 bool lost_ = true; |
1632 }; | 1639 }; |
1633 | 1640 |
1634 SINGLE_AND_MULTI_THREAD_TEST_F( | 1641 SINGLE_AND_MULTI_THREAD_TEST_F( |
1635 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1642 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
1636 | 1643 |
1637 } // namespace | 1644 } // namespace |
1638 } // namespace cc | 1645 } // namespace cc |
OLD | NEW |