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 7776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7787 BeginFrameArgs current_begin_main_frame_args_on_impl_; | 7787 BeginFrameArgs current_begin_main_frame_args_on_impl_; |
7788 LayerTreeHostImpl::FrameData* frame_data_; | 7788 LayerTreeHostImpl::FrameData* frame_data_; |
7789 }; | 7789 }; |
7790 | 7790 |
7791 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestBeginFrameSequenceNumbers); | 7791 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestBeginFrameSequenceNumbers); |
7792 | 7792 |
7793 class LayerTreeHostTestQueueImageDecode : public LayerTreeHostTest { | 7793 class LayerTreeHostTestQueueImageDecode : public LayerTreeHostTest { |
7794 protected: | 7794 protected: |
7795 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 7795 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
7796 | 7796 |
| 7797 void InitializeSettings(LayerTreeSettings* settings) override { |
| 7798 settings->enable_checker_imaging = true; |
| 7799 } |
| 7800 |
7797 void WillBeginMainFrame() override { | 7801 void WillBeginMainFrame() override { |
7798 if (!first_) | 7802 if (!first_) |
7799 return; | 7803 return; |
7800 first_ = false; | 7804 first_ = false; |
7801 | 7805 |
7802 PaintImage image(PaintImage::GetNextId(), | 7806 image_ = PaintImage(PaintImage::GetNextId(), |
7803 CreateDiscardableImage(gfx::Size(10, 10))); | 7807 CreateDiscardableImage(gfx::Size(400, 400))); |
7804 auto callback = | 7808 auto callback = |
7805 base::Bind(&LayerTreeHostTestQueueImageDecode::ImageDecodeFinished, | 7809 base::Bind(&LayerTreeHostTestQueueImageDecode::ImageDecodeFinished, |
7806 base::Unretained(this)); | 7810 base::Unretained(this)); |
7807 // Schedule the decode twice for the same image. | 7811 // Schedule the decode twice for the same image. |
7808 layer_tree_host()->QueueImageDecode(image, callback); | 7812 layer_tree_host()->QueueImageDecode(image_, callback); |
7809 layer_tree_host()->QueueImageDecode(image, callback); | 7813 layer_tree_host()->QueueImageDecode(image_, callback); |
| 7814 } |
| 7815 |
| 7816 void ReadyToCommitOnThread(LayerTreeHostImpl* impl) override { |
| 7817 if (one_commit_done_) |
| 7818 return; |
| 7819 EXPECT_TRUE( |
| 7820 impl->tile_manager()->checker_image_tracker().ShouldCheckerImage( |
| 7821 image_, WhichTree::PENDING_TREE)); |
| 7822 // Reset the tracker as if it has never seen this image. |
| 7823 impl->tile_manager()->checker_image_tracker().ClearTracker(true); |
| 7824 } |
| 7825 |
| 7826 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 7827 one_commit_done_ = true; |
| 7828 EXPECT_FALSE( |
| 7829 impl->tile_manager()->checker_image_tracker().ShouldCheckerImage( |
| 7830 image_, WhichTree::PENDING_TREE)); |
7810 } | 7831 } |
7811 | 7832 |
7812 void ImageDecodeFinished(bool decode_succeeded) { | 7833 void ImageDecodeFinished(bool decode_succeeded) { |
7813 EXPECT_TRUE(decode_succeeded); | 7834 EXPECT_TRUE(decode_succeeded); |
7814 ++finished_decode_count_; | 7835 ++finished_decode_count_; |
7815 EXPECT_LE(finished_decode_count_, 2); | 7836 EXPECT_LE(finished_decode_count_, 2); |
7816 if (finished_decode_count_ == 2) | 7837 if (finished_decode_count_ == 2) |
7817 EndTest(); | 7838 EndTest(); |
7818 } | 7839 } |
7819 | 7840 |
7820 void AfterTest() override {} | 7841 void AfterTest() override {} |
7821 | 7842 |
7822 private: | 7843 private: |
7823 bool first_ = true; | 7844 bool first_ = true; |
| 7845 bool one_commit_done_ = false; |
7824 int finished_decode_count_ = 0; | 7846 int finished_decode_count_ = 0; |
| 7847 PaintImage image_; |
7825 }; | 7848 }; |
7826 | 7849 |
7827 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestQueueImageDecode); | 7850 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestQueueImageDecode); |
7828 | 7851 |
7829 class LayerTreeHostTestQueueImageDecodeNonLazy : public LayerTreeHostTest { | 7852 class LayerTreeHostTestQueueImageDecodeNonLazy : public LayerTreeHostTest { |
7830 protected: | 7853 protected: |
7831 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 7854 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
7832 | 7855 |
7833 void WillBeginMainFrame() override { | 7856 void WillBeginMainFrame() override { |
7834 if (!first_) | 7857 if (!first_) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7969 void AfterTest() override {} | 7992 void AfterTest() override {} |
7970 | 7993 |
7971 private: | 7994 private: |
7972 bool received_ack_ = false; | 7995 bool received_ack_ = false; |
7973 }; | 7996 }; |
7974 | 7997 |
7975 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); | 7998 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); |
7976 | 7999 |
7977 } // namespace | 8000 } // namespace |
7978 } // namespace cc | 8001 } // namespace cc |
OLD | NEW |