| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 7785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7796 | 7796 |
| 7797 void InitializeSettings(LayerTreeSettings* settings) override { | 7797 void InitializeSettings(LayerTreeSettings* settings) override { |
| 7798 settings->enable_checker_imaging = true; | 7798 settings->enable_checker_imaging = true; |
| 7799 } | 7799 } |
| 7800 | 7800 |
| 7801 void WillBeginMainFrame() override { | 7801 void WillBeginMainFrame() override { |
| 7802 if (!first_) | 7802 if (!first_) |
| 7803 return; | 7803 return; |
| 7804 first_ = false; | 7804 first_ = false; |
| 7805 | 7805 |
| 7806 image_ = PaintImage(PaintImage::GetNextId(), | 7806 image_ = DrawImage(PaintImage(PaintImage::GetNextId(), |
| 7807 CreateDiscardableImage(gfx::Size(400, 400))); | 7807 CreateDiscardableImage(gfx::Size(400, 400))), |
| 7808 SkIRect::MakeWH(400, 400), kNone_SkFilterQuality, |
| 7809 SkMatrix::I(), gfx::ColorSpace()); |
| 7808 auto callback = | 7810 auto callback = |
| 7809 base::Bind(&LayerTreeHostTestQueueImageDecode::ImageDecodeFinished, | 7811 base::Bind(&LayerTreeHostTestQueueImageDecode::ImageDecodeFinished, |
| 7810 base::Unretained(this)); | 7812 base::Unretained(this)); |
| 7811 // Schedule the decode twice for the same image. | 7813 // Schedule the decode twice for the same image. |
| 7812 layer_tree_host()->QueueImageDecode(image_, callback); | 7814 layer_tree_host()->QueueImageDecode(image_.paint_image(), callback); |
| 7813 layer_tree_host()->QueueImageDecode(image_, callback); | 7815 layer_tree_host()->QueueImageDecode(image_.paint_image(), callback); |
| 7814 } | 7816 } |
| 7815 | 7817 |
| 7816 void ReadyToCommitOnThread(LayerTreeHostImpl* impl) override { | 7818 void ReadyToCommitOnThread(LayerTreeHostImpl* impl) override { |
| 7817 if (one_commit_done_) | 7819 if (one_commit_done_) |
| 7818 return; | 7820 return; |
| 7819 EXPECT_TRUE( | 7821 EXPECT_TRUE( |
| 7820 impl->tile_manager()->checker_image_tracker().ShouldCheckerImage( | 7822 impl->tile_manager()->checker_image_tracker().ShouldCheckerImage( |
| 7821 image_, WhichTree::PENDING_TREE)); | 7823 image_, WhichTree::PENDING_TREE)); |
| 7822 // Reset the tracker as if it has never seen this image. | 7824 // Reset the tracker as if it has never seen this image. |
| 7823 impl->tile_manager()->checker_image_tracker().ClearTracker(true); | 7825 impl->tile_manager()->checker_image_tracker().ClearTracker(true); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 7837 if (finished_decode_count_ == 2) | 7839 if (finished_decode_count_ == 2) |
| 7838 EndTest(); | 7840 EndTest(); |
| 7839 } | 7841 } |
| 7840 | 7842 |
| 7841 void AfterTest() override {} | 7843 void AfterTest() override {} |
| 7842 | 7844 |
| 7843 private: | 7845 private: |
| 7844 bool first_ = true; | 7846 bool first_ = true; |
| 7845 bool one_commit_done_ = false; | 7847 bool one_commit_done_ = false; |
| 7846 int finished_decode_count_ = 0; | 7848 int finished_decode_count_ = 0; |
| 7847 PaintImage image_; | 7849 DrawImage image_; |
| 7848 }; | 7850 }; |
| 7849 | 7851 |
| 7850 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestQueueImageDecode); | 7852 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestQueueImageDecode); |
| 7851 | 7853 |
| 7852 class LayerTreeHostTestQueueImageDecodeNonLazy : public LayerTreeHostTest { | 7854 class LayerTreeHostTestQueueImageDecodeNonLazy : public LayerTreeHostTest { |
| 7853 protected: | 7855 protected: |
| 7854 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 7856 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 7855 | 7857 |
| 7856 void WillBeginMainFrame() override { | 7858 void WillBeginMainFrame() override { |
| 7857 if (!first_) | 7859 if (!first_) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7992 void AfterTest() override {} | 7994 void AfterTest() override {} |
| 7993 | 7995 |
| 7994 private: | 7996 private: |
| 7995 bool received_ack_ = false; | 7997 bool received_ack_ = false; |
| 7996 }; | 7998 }; |
| 7997 | 7999 |
| 7998 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); | 8000 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); |
| 7999 | 8001 |
| 8000 } // namespace | 8002 } // namespace |
| 8001 } // namespace cc | 8003 } // namespace cc |
| OLD | NEW |