| 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/layers/texture_layer.h" | 5 #include "cc/layers/texture_layer.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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 void AfterTest() override {} | 750 void AfterTest() override {} |
| 751 | 751 |
| 752 private: | 752 private: |
| 753 base::ThreadChecker main_thread_; | 753 base::ThreadChecker main_thread_; |
| 754 int callback_count_ = 0; | 754 int callback_count_ = 0; |
| 755 int commit_count_ = 0; | 755 int commit_count_ = 0; |
| 756 scoped_refptr<Layer> root_; | 756 scoped_refptr<Layer> root_; |
| 757 scoped_refptr<TextureLayer> layer_; | 757 scoped_refptr<TextureLayer> layer_; |
| 758 }; | 758 }; |
| 759 | 759 |
| 760 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 760 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerImplWithMailboxThreadedCallback); |
| 761 TextureLayerImplWithMailboxThreadedCallback); | |
| 762 | |
| 763 | 761 |
| 764 class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest { | 762 class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest { |
| 765 protected: | 763 protected: |
| 766 TextureLayerMailboxIsActivatedDuringCommit() : activate_count_(0) {} | 764 TextureLayerMailboxIsActivatedDuringCommit() : activate_count_(0) {} |
| 767 | 765 |
| 768 static void ReleaseCallback(const gpu::SyncToken& original_sync_token, | 766 static void ReleaseCallback(const gpu::SyncToken& original_sync_token, |
| 769 const gpu::SyncToken& release_sync_token, | 767 const gpu::SyncToken& release_sync_token, |
| 770 bool lost_resource) {} | 768 bool lost_resource) {} |
| 771 | 769 |
| 772 void SetMailbox(char mailbox_char) { | 770 void SetMailbox(char mailbox_char) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 } | 835 } |
| 838 | 836 |
| 839 void AfterTest() override {} | 837 void AfterTest() override {} |
| 840 | 838 |
| 841 base::Lock activate_count_lock_; | 839 base::Lock activate_count_lock_; |
| 842 int activate_count_; | 840 int activate_count_; |
| 843 scoped_refptr<Layer> root_; | 841 scoped_refptr<Layer> root_; |
| 844 scoped_refptr<TextureLayer> layer_; | 842 scoped_refptr<TextureLayer> layer_; |
| 845 }; | 843 }; |
| 846 | 844 |
| 847 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 845 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerMailboxIsActivatedDuringCommit); |
| 848 TextureLayerMailboxIsActivatedDuringCommit); | |
| 849 | 846 |
| 850 class TextureLayerImplWithMailboxTest : public TextureLayerTest { | 847 class TextureLayerImplWithMailboxTest : public TextureLayerTest { |
| 851 protected: | 848 protected: |
| 852 void SetUp() override { | 849 void SetUp() override { |
| 853 TextureLayerTest::SetUp(); | 850 TextureLayerTest::SetUp(); |
| 854 layer_tree_host_ = | 851 layer_tree_host_ = |
| 855 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 852 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
| 856 host_impl_.SetVisible(true); | 853 host_impl_.SetVisible(true); |
| 857 EXPECT_TRUE(host_impl_.InitializeRenderer(output_surface_.get())); | 854 EXPECT_TRUE(host_impl_.InitializeRenderer(output_surface_.get())); |
| 858 } | 855 } |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 | 1373 |
| 1377 void AfterTest() override { EXPECT_EQ(1, callback_count_); } | 1374 void AfterTest() override { EXPECT_EQ(1, callback_count_); } |
| 1378 | 1375 |
| 1379 private: | 1376 private: |
| 1380 base::ThreadChecker main_thread_; | 1377 base::ThreadChecker main_thread_; |
| 1381 int callback_count_; | 1378 int callback_count_; |
| 1382 scoped_refptr<Layer> root_; | 1379 scoped_refptr<Layer> root_; |
| 1383 scoped_refptr<TextureLayer> layer_; | 1380 scoped_refptr<TextureLayer> layer_; |
| 1384 }; | 1381 }; |
| 1385 | 1382 |
| 1386 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1383 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxMainThreadDeleted); |
| 1387 TextureLayerWithMailboxMainThreadDeleted); | |
| 1388 | 1384 |
| 1389 class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { | 1385 class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { |
| 1390 public: | 1386 public: |
| 1391 void ReleaseCallback(const gpu::SyncToken& sync_token, bool lost_resource) { | 1387 void ReleaseCallback(const gpu::SyncToken& sync_token, bool lost_resource) { |
| 1392 EXPECT_EQ(true, main_thread_.CalledOnValidThread()); | 1388 EXPECT_EQ(true, main_thread_.CalledOnValidThread()); |
| 1393 EXPECT_FALSE(lost_resource); | 1389 EXPECT_FALSE(lost_resource); |
| 1394 ++callback_count_; | 1390 ++callback_count_; |
| 1395 EndTest(); | 1391 EndTest(); |
| 1396 } | 1392 } |
| 1397 | 1393 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 | 1446 |
| 1451 void AfterTest() override { EXPECT_EQ(1, callback_count_); } | 1447 void AfterTest() override { EXPECT_EQ(1, callback_count_); } |
| 1452 | 1448 |
| 1453 private: | 1449 private: |
| 1454 base::ThreadChecker main_thread_; | 1450 base::ThreadChecker main_thread_; |
| 1455 int callback_count_; | 1451 int callback_count_; |
| 1456 scoped_refptr<Layer> root_; | 1452 scoped_refptr<Layer> root_; |
| 1457 scoped_refptr<TextureLayer> layer_; | 1453 scoped_refptr<TextureLayer> layer_; |
| 1458 }; | 1454 }; |
| 1459 | 1455 |
| 1460 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1456 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxImplThreadDeleted); |
| 1461 TextureLayerWithMailboxImplThreadDeleted); | |
| 1462 | 1457 |
| 1463 } // namespace | 1458 } // namespace |
| 1464 } // namespace cc | 1459 } // namespace cc |
| OLD | NEW |