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/test/layer_tree_test.h" | 5 #include "cc/test/layer_tree_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 | 847 |
848 void LayerTreeTest::RequestNewOutputSurface() { | 848 void LayerTreeTest::RequestNewOutputSurface() { |
849 if (settings_.use_external_begin_frame_source && | 849 if (settings_.use_external_begin_frame_source && |
850 settings_.wait_for_beginframe_interval) { | 850 settings_.wait_for_beginframe_interval) { |
851 DCHECK(external_begin_frame_source_); | 851 DCHECK(external_begin_frame_source_); |
852 } | 852 } |
853 SetOutputSurfaceOnLayerTreeHost(CreateOutputSurface()); | 853 SetOutputSurfaceOnLayerTreeHost(CreateOutputSurface()); |
854 } | 854 } |
855 | 855 |
856 std::unique_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() { | 856 std::unique_ptr<OutputSurface> LayerTreeTest::CreateOutputSurface() { |
857 return delegating_renderer_ ? FakeOutputSurface::CreateDelegating3d() | 857 if (delegating_renderer_) |
858 : FakeOutputSurface::Create3d(); | 858 return FakeOutputSurface::CreateDelegating3d(); |
| 859 |
| 860 // Make a worker context in a non-delegating OutputSurface. This is an |
| 861 // exceptional situation for these tests as they put a non-delegating |
| 862 // OutputSurface into the LayerTreeHost. |
| 863 return FakeOutputSurface::Create3d(TestContextProvider::Create(), |
| 864 TestContextProvider::CreateWorker()); |
859 } | 865 } |
860 | 866 |
861 void LayerTreeTest::DestroyLayerTreeHost() { | 867 void LayerTreeTest::DestroyLayerTreeHost() { |
862 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 868 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
863 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 869 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
864 layer_tree_host_ = nullptr; | 870 layer_tree_host_ = nullptr; |
865 | 871 |
866 DCHECK(!remote_proto_channel_bridge_.channel_main.HasReceiver()); | 872 DCHECK(!remote_proto_channel_bridge_.channel_main.HasReceiver()); |
867 | 873 |
868 // Destroying the LayerTreeHost should destroy the remote client | 874 // Destroying the LayerTreeHost should destroy the remote client |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 } | 932 } |
927 | 933 |
928 LayerTreeHost* LayerTreeTest::remote_client_layer_tree_host() { | 934 LayerTreeHost* LayerTreeTest::remote_client_layer_tree_host() { |
929 DCHECK(IsRemoteTest()); | 935 DCHECK(IsRemoteTest()); |
930 DCHECK(task_runner_provider()->IsMainThread() || | 936 DCHECK(task_runner_provider()->IsMainThread() || |
931 task_runner_provider()->IsMainThreadBlocked()); | 937 task_runner_provider()->IsMainThreadBlocked()); |
932 return remote_client_layer_tree_host_.get(); | 938 return remote_client_layer_tree_host_.get(); |
933 } | 939 } |
934 | 940 |
935 } // namespace cc | 941 } // namespace cc |
OLD | NEW |