| 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 "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
| 9 #include "cc/layers/delegated_frame_provider.h" | 9 #include "cc/layers/delegated_frame_provider.h" |
| 10 #include "cc/layers/delegated_frame_resource_collection.h" | 10 #include "cc/layers/delegated_frame_resource_collection.h" |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 if (!host_impl->settings().impl_side_painting) { | 573 if (!host_impl->settings().impl_side_painting) { |
| 574 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( | 574 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( |
| 575 host_impl->active_tree()->root_layer()->children()[0]); | 575 host_impl->active_tree()->root_layer()->children()[0]); |
| 576 // Even though the context was lost, we should have a resource. The | 576 // Even though the context was lost, we should have a resource. The |
| 577 // TestWebGraphicsContext3D ensures that this resource is created with | 577 // TestWebGraphicsContext3D ensures that this resource is created with |
| 578 // the active context. | 578 // the active context. |
| 579 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); | 579 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); |
| 580 } else { | 580 } else { |
| 581 FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>( | 581 FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>( |
| 582 host_impl->active_tree()->root_layer()->children()[0]); | 582 host_impl->active_tree()->root_layer()->children()[0]); |
| 583 EXPECT_TRUE(picture_impl->HighResTiling()->TileAt(0, 0)->IsReadyToDraw()); | 583 EXPECT_TRUE(picture_impl->HighResTiling() |
| 584 ->TileAt(0, 0) |
| 585 ->draw_info() |
| 586 .IsReadyToDraw()); |
| 584 } | 587 } |
| 585 } | 588 } |
| 586 | 589 |
| 587 protected: | 590 protected: |
| 588 FakeContentLayerClient client_; | 591 FakeContentLayerClient client_; |
| 589 scoped_refptr<Layer> root_; | 592 scoped_refptr<Layer> root_; |
| 590 scoped_refptr<Layer> layer_; | 593 scoped_refptr<Layer> layer_; |
| 591 }; | 594 }; |
| 592 | 595 |
| 593 // This test uses TiledLayer and PictureLayer to check for a working context. | 596 // This test uses TiledLayer and PictureLayer to check for a working context. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 if (!lose_after_evict_) { | 693 if (!lose_after_evict_) { |
| 691 LoseContext(); | 694 LoseContext(); |
| 692 lost_context_ = true; | 695 lost_context_ = true; |
| 693 } | 696 } |
| 694 } | 697 } |
| 695 | 698 |
| 696 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 699 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 697 if (impl->settings().impl_side_painting) { | 700 if (impl->settings().impl_side_painting) { |
| 698 FakePictureLayerImpl* picture_impl = | 701 FakePictureLayerImpl* picture_impl = |
| 699 static_cast<FakePictureLayerImpl*>(impl->active_tree()->root_layer()); | 702 static_cast<FakePictureLayerImpl*>(impl->active_tree()->root_layer()); |
| 700 EXPECT_TRUE(picture_impl->HighResTiling()->TileAt(0, 0)->IsReadyToDraw()); | 703 EXPECT_TRUE(picture_impl->HighResTiling() |
| 704 ->TileAt(0, 0) |
| 705 ->draw_info() |
| 706 .IsReadyToDraw()); |
| 701 } else { | 707 } else { |
| 702 FakeContentLayerImpl* content_impl = | 708 FakeContentLayerImpl* content_impl = |
| 703 static_cast<FakeContentLayerImpl*>(impl->active_tree()->root_layer()); | 709 static_cast<FakeContentLayerImpl*>(impl->active_tree()->root_layer()); |
| 704 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); | 710 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); |
| 705 } | 711 } |
| 706 | 712 |
| 707 impl_host_ = impl; | 713 impl_host_ = impl; |
| 708 if (lost_context_) | 714 if (lost_context_) |
| 709 EndTest(); | 715 EndTest(); |
| 710 } | 716 } |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 void AfterTest() override {} | 1798 void AfterTest() override {} |
| 1793 | 1799 |
| 1794 bool deferred_; | 1800 bool deferred_; |
| 1795 }; | 1801 }; |
| 1796 | 1802 |
| 1797 SINGLE_AND_MULTI_THREAD_TEST_F( | 1803 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1798 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1804 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
| 1799 | 1805 |
| 1800 } // namespace | 1806 } // namespace |
| 1801 } // namespace cc | 1807 } // namespace cc |
| OLD | NEW |