| 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 } |
| 7823 |
| 7824 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 7825 one_commit_done_ = true; |
| 7826 EXPECT_FALSE( |
| 7827 impl->tile_manager()->checker_image_tracker().ShouldCheckerImage( |
| 7828 image_, WhichTree::PENDING_TREE)); |
| 7810 } | 7829 } |
| 7811 | 7830 |
| 7812 void ImageDecodeFinished(bool decode_succeeded) { | 7831 void ImageDecodeFinished(bool decode_succeeded) { |
| 7813 EXPECT_TRUE(decode_succeeded); | 7832 EXPECT_TRUE(decode_succeeded); |
| 7814 ++finished_decode_count_; | 7833 ++finished_decode_count_; |
| 7815 EXPECT_LE(finished_decode_count_, 2); | 7834 EXPECT_LE(finished_decode_count_, 2); |
| 7816 if (finished_decode_count_ == 2) | 7835 if (finished_decode_count_ == 2) |
| 7817 EndTest(); | 7836 EndTest(); |
| 7818 } | 7837 } |
| 7819 | 7838 |
| 7820 void AfterTest() override {} | 7839 void AfterTest() override {} |
| 7821 | 7840 |
| 7822 private: | 7841 private: |
| 7823 bool first_ = true; | 7842 bool first_ = true; |
| 7843 bool one_commit_done_ = false; |
| 7824 int finished_decode_count_ = 0; | 7844 int finished_decode_count_ = 0; |
| 7845 PaintImage image_; |
| 7825 }; | 7846 }; |
| 7826 | 7847 |
| 7827 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestQueueImageDecode); | 7848 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestQueueImageDecode); |
| 7828 | 7849 |
| 7829 class LayerTreeHostTestQueueImageDecodeNonLazy : public LayerTreeHostTest { | 7850 class LayerTreeHostTestQueueImageDecodeNonLazy : public LayerTreeHostTest { |
| 7830 protected: | 7851 protected: |
| 7831 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 7852 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 7832 | 7853 |
| 7833 void WillBeginMainFrame() override { | 7854 void WillBeginMainFrame() override { |
| 7834 if (!first_) | 7855 if (!first_) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7969 void AfterTest() override {} | 7990 void AfterTest() override {} |
| 7970 | 7991 |
| 7971 private: | 7992 private: |
| 7972 bool received_ack_ = false; | 7993 bool received_ack_ = false; |
| 7973 }; | 7994 }; |
| 7974 | 7995 |
| 7975 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); | 7996 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); |
| 7976 | 7997 |
| 7977 } // namespace | 7998 } // namespace |
| 7978 } // namespace cc | 7999 } // namespace cc |
| OLD | NEW |