| 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" |
| 11 #include "cc/layers/painted_scrollbar_layer.h" | 11 #include "cc/layers/painted_scrollbar_layer.h" |
| 12 #include "cc/layers/picture_layer.h" | 12 #include "cc/layers/picture_layer.h" |
| 13 #include "cc/layers/texture_layer.h" | 13 #include "cc/layers/texture_layer.h" |
| 14 #include "cc/layers/texture_layer_impl.h" | 14 #include "cc/layers/texture_layer_impl.h" |
| 15 #include "cc/layers/video_layer.h" | 15 #include "cc/layers/video_layer.h" |
| 16 #include "cc/layers/video_layer_impl.h" | 16 #include "cc/layers/video_layer_impl.h" |
| 17 #include "cc/output/filter_operations.h" | 17 #include "cc/output/filter_operations.h" |
| 18 #include "cc/paint/paint_flags.h" |
| 18 #include "cc/resources/single_release_callback.h" | 19 #include "cc/resources/single_release_callback.h" |
| 19 #include "cc/resources/ui_resource_manager.h" | 20 #include "cc/resources/ui_resource_manager.h" |
| 20 #include "cc/test/fake_content_layer_client.h" | 21 #include "cc/test/fake_content_layer_client.h" |
| 21 #include "cc/test/fake_layer_tree_host_client.h" | 22 #include "cc/test/fake_layer_tree_host_client.h" |
| 22 #include "cc/test/fake_painted_scrollbar_layer.h" | 23 #include "cc/test/fake_painted_scrollbar_layer.h" |
| 23 #include "cc/test/fake_picture_layer.h" | 24 #include "cc/test/fake_picture_layer.h" |
| 24 #include "cc/test/fake_picture_layer_impl.h" | 25 #include "cc/test/fake_picture_layer_impl.h" |
| 25 #include "cc/test/fake_resource_provider.h" | 26 #include "cc/test/fake_resource_provider.h" |
| 26 #include "cc/test/fake_scoped_ui_resource.h" | 27 #include "cc/test/fake_scoped_ui_resource.h" |
| 27 #include "cc/test/fake_scrollbar.h" | 28 #include "cc/test/fake_scrollbar.h" |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 // This test uses PictureLayer to check for a working context. | 603 // This test uses PictureLayer to check for a working context. |
| 603 class LayerTreeHostContextTestLostContextSucceedsWithContent | 604 class LayerTreeHostContextTestLostContextSucceedsWithContent |
| 604 : public LayerTreeHostContextTestLostContextSucceeds { | 605 : public LayerTreeHostContextTestLostContextSucceeds { |
| 605 public: | 606 public: |
| 606 void SetupTree() override { | 607 void SetupTree() override { |
| 607 root_ = Layer::Create(); | 608 root_ = Layer::Create(); |
| 608 root_->SetBounds(gfx::Size(10, 10)); | 609 root_->SetBounds(gfx::Size(10, 10)); |
| 609 root_->SetIsDrawable(true); | 610 root_->SetIsDrawable(true); |
| 610 | 611 |
| 611 // Paint non-solid color. | 612 // Paint non-solid color. |
| 612 SkPaint paint; | 613 PaintFlags paint; |
| 613 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); | 614 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); |
| 614 client_.add_draw_rect(gfx::Rect(5, 5), paint); | 615 client_.add_draw_rect(gfx::Rect(5, 5), paint); |
| 615 | 616 |
| 616 layer_ = FakePictureLayer::Create(&client_); | 617 layer_ = FakePictureLayer::Create(&client_); |
| 617 layer_->SetBounds(gfx::Size(10, 10)); | 618 layer_->SetBounds(gfx::Size(10, 10)); |
| 618 layer_->SetIsDrawable(true); | 619 layer_->SetIsDrawable(true); |
| 619 | 620 |
| 620 root_->AddChild(layer_); | 621 root_->AddChild(layer_); |
| 621 | 622 |
| 622 layer_tree()->SetRootLayer(root_); | 623 layer_tree()->SetRootLayer(root_); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 : public LayerTreeHostContextTest { | 682 : public LayerTreeHostContextTest { |
| 682 public: | 683 public: |
| 683 LayerTreeHostContextTestLostContextAndEvictTextures() | 684 LayerTreeHostContextTestLostContextAndEvictTextures() |
| 684 : LayerTreeHostContextTest(), | 685 : LayerTreeHostContextTest(), |
| 685 impl_host_(0), | 686 impl_host_(0), |
| 686 num_commits_(0), | 687 num_commits_(0), |
| 687 lost_context_(false) {} | 688 lost_context_(false) {} |
| 688 | 689 |
| 689 void SetupTree() override { | 690 void SetupTree() override { |
| 690 // Paint non-solid color. | 691 // Paint non-solid color. |
| 691 SkPaint paint; | 692 PaintFlags paint; |
| 692 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); | 693 paint.setColor(SkColorSetARGB(100, 80, 200, 200)); |
| 693 client_.add_draw_rect(gfx::Rect(5, 5), paint); | 694 client_.add_draw_rect(gfx::Rect(5, 5), paint); |
| 694 | 695 |
| 695 scoped_refptr<FakePictureLayer> picture_layer = | 696 scoped_refptr<FakePictureLayer> picture_layer = |
| 696 FakePictureLayer::Create(&client_); | 697 FakePictureLayer::Create(&client_); |
| 697 picture_layer->SetBounds(gfx::Size(10, 20)); | 698 picture_layer->SetBounds(gfx::Size(10, 20)); |
| 698 client_.set_bounds(picture_layer->bounds()); | 699 client_.set_bounds(picture_layer->bounds()); |
| 699 layer_tree()->SetRootLayer(picture_layer); | 700 layer_tree()->SetRootLayer(picture_layer); |
| 700 | 701 |
| 701 LayerTreeHostContextTest::SetupTree(); | 702 LayerTreeHostContextTest::SetupTree(); |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 SINGLE_AND_MULTI_THREAD_TEST_F( | 1596 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1596 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1597 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
| 1597 | 1598 |
| 1598 // This test causes context loss on the worker context but not the compositor | 1599 // This test causes context loss on the worker context but not the compositor |
| 1599 // context and checks that draw still occurs. The resources might be in a bad | 1600 // context and checks that draw still occurs. The resources might be in a bad |
| 1600 // state e.g. null sync tokens but that shouldn't cause the draw to fail. | 1601 // state e.g. null sync tokens but that shouldn't cause the draw to fail. |
| 1601 class LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles | 1602 class LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles |
| 1602 : public LayerTreeTest { | 1603 : public LayerTreeTest { |
| 1603 protected: | 1604 protected: |
| 1604 void SetupTree() override { | 1605 void SetupTree() override { |
| 1605 SkPaint paint; | 1606 PaintFlags paint; |
| 1606 client_.set_fill_with_nonsolid_color(true); | 1607 client_.set_fill_with_nonsolid_color(true); |
| 1607 client_.add_draw_rect(gfx::Rect(5, 5), paint); | 1608 client_.add_draw_rect(gfx::Rect(5, 5), paint); |
| 1608 | 1609 |
| 1609 scoped_refptr<FakePictureLayer> picture_layer = | 1610 scoped_refptr<FakePictureLayer> picture_layer = |
| 1610 FakePictureLayer::Create(&client_); | 1611 FakePictureLayer::Create(&client_); |
| 1611 picture_layer->SetBounds(gfx::Size(10, 20)); | 1612 picture_layer->SetBounds(gfx::Size(10, 20)); |
| 1612 client_.set_bounds(picture_layer->bounds()); | 1613 client_.set_bounds(picture_layer->bounds()); |
| 1613 layer_tree()->SetRootLayer(picture_layer); | 1614 layer_tree()->SetRootLayer(picture_layer); |
| 1614 | 1615 |
| 1615 LayerTreeTest::SetupTree(); | 1616 LayerTreeTest::SetupTree(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1635 | 1636 |
| 1636 FakeContentLayerClient client_; | 1637 FakeContentLayerClient client_; |
| 1637 int num_draws_ = 0; | 1638 int num_draws_ = 0; |
| 1638 }; | 1639 }; |
| 1639 | 1640 |
| 1640 MULTI_THREAD_TEST_F( | 1641 MULTI_THREAD_TEST_F( |
| 1641 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles); | 1642 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles); |
| 1642 | 1643 |
| 1643 } // namespace | 1644 } // namespace |
| 1644 } // namespace cc | 1645 } // namespace cc |
| OLD | NEW |