Chromium Code Reviews| 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 636 class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { | 636 class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { |
| 637 public: | 637 public: |
| 638 TextureLayerImplWithMailboxThreadedCallback() = default; | 638 TextureLayerImplWithMailboxThreadedCallback() = default; |
| 639 | 639 |
| 640 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( | 640 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( |
| 641 scoped_refptr<ContextProvider> compositor_context_provider, | 641 scoped_refptr<ContextProvider> compositor_context_provider, |
| 642 scoped_refptr<ContextProvider> worker_context_provider) override { | 642 scoped_refptr<ContextProvider> worker_context_provider) override { |
| 643 bool synchronous_composite = | 643 bool synchronous_composite = |
| 644 !HasImplThread() && | 644 !HasImplThread() && |
| 645 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; | 645 !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; |
| 646 // Allow relaim resources for this test so that mailboxes in the display | 646 auto sink = base::MakeUnique<TestCompositorFrameSink>( |
| 647 // will be returned inside the commit that replaces them. | |
| 648 bool force_disable_reclaim_resources = false; | |
| 649 return base::MakeUnique<TestCompositorFrameSink>( | |
| 650 compositor_context_provider, std::move(worker_context_provider), | 647 compositor_context_provider, std::move(worker_context_provider), |
| 651 shared_bitmap_manager(), gpu_memory_buffer_manager(), | 648 shared_bitmap_manager(), gpu_memory_buffer_manager(), |
| 652 layer_tree_host()->GetSettings().renderer_settings, | 649 layer_tree_host()->GetSettings().renderer_settings, |
| 653 ImplThreadTaskRunner(), synchronous_composite, | 650 ImplThreadTaskRunner(), synchronous_composite); |
| 654 force_disable_reclaim_resources); | 651 |
| 652 // Ensure that resources are immediately returned after swap and release | |
| 653 // callbacks are triggered. | |
| 654 sink->SetForceReclaimResourcesAfterSwap(); | |
|
ericrk
2017/01/04 18:10:48
This is now a test-only method which is used for t
| |
| 655 return sink; | |
| 655 } | 656 } |
| 656 | 657 |
| 657 // Make sure callback is received on main and doesn't block the impl thread. | 658 // Make sure callback is received on main and doesn't block the impl thread. |
| 658 void ReleaseCallback(char mailbox_char, | 659 void ReleaseCallback(char mailbox_char, |
| 659 const gpu::SyncToken& sync_token, | 660 const gpu::SyncToken& sync_token, |
| 660 bool lost_resource) { | 661 bool lost_resource) { |
| 661 EXPECT_EQ(true, main_thread_.CalledOnValidThread()); | 662 EXPECT_EQ(true, main_thread_.CalledOnValidThread()); |
| 662 EXPECT_FALSE(lost_resource); | 663 EXPECT_FALSE(lost_resource); |
| 663 ++callback_count_; | 664 ++callback_count_; |
| 664 } | 665 } |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1454 base::ThreadChecker main_thread_; | 1455 base::ThreadChecker main_thread_; |
| 1455 int callback_count_; | 1456 int callback_count_; |
| 1456 scoped_refptr<Layer> root_; | 1457 scoped_refptr<Layer> root_; |
| 1457 scoped_refptr<TextureLayer> layer_; | 1458 scoped_refptr<TextureLayer> layer_; |
| 1458 }; | 1459 }; |
| 1459 | 1460 |
| 1460 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxImplThreadDeleted); | 1461 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerWithMailboxImplThreadDeleted); |
| 1461 | 1462 |
| 1462 } // namespace | 1463 } // namespace |
| 1463 } // namespace cc | 1464 } // namespace cc |
| OLD | NEW |