| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/debug/test_context_provider.h" | 8 #include "cc/debug/test_context_provider.h" |
| 9 #include "cc/debug/test_web_graphics_context_3d.h" | 9 #include "cc/debug/test_web_graphics_context_3d.h" |
| 10 #include "cc/layers/content_layer.h" | 10 #include "cc/layers/content_layer.h" |
| 11 #include "cc/layers/delegated_frame_provider.h" |
| 12 #include "cc/layers/delegated_frame_resource_collection.h" |
| 11 #include "cc/layers/heads_up_display_layer.h" | 13 #include "cc/layers/heads_up_display_layer.h" |
| 12 #include "cc/layers/io_surface_layer.h" | 14 #include "cc/layers/io_surface_layer.h" |
| 13 #include "cc/layers/layer_impl.h" | 15 #include "cc/layers/layer_impl.h" |
| 14 #include "cc/layers/painted_scrollbar_layer.h" | 16 #include "cc/layers/painted_scrollbar_layer.h" |
| 15 #include "cc/layers/picture_layer.h" | 17 #include "cc/layers/picture_layer.h" |
| 16 #include "cc/layers/texture_layer.h" | 18 #include "cc/layers/texture_layer.h" |
| 17 #include "cc/layers/texture_layer_impl.h" | 19 #include "cc/layers/texture_layer_impl.h" |
| 18 #include "cc/layers/video_layer.h" | 20 #include "cc/layers/video_layer.h" |
| 19 #include "cc/layers/video_layer_impl.h" | 21 #include "cc/layers/video_layer_impl.h" |
| 20 #include "cc/output/filter_operations.h" | 22 #include "cc/output/filter_operations.h" |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 LayerTreeHostContextTestDontUseLostResources() : lost_context_(false) { | 1108 LayerTreeHostContextTestDontUseLostResources() : lost_context_(false) { |
| 1107 context_should_support_io_surface_ = true; | 1109 context_should_support_io_surface_ = true; |
| 1108 } | 1110 } |
| 1109 | 1111 |
| 1110 virtual void SetupTree() OVERRIDE { | 1112 virtual void SetupTree() OVERRIDE { |
| 1111 scoped_refptr<Layer> root = Layer::Create(); | 1113 scoped_refptr<Layer> root = Layer::Create(); |
| 1112 root->SetBounds(gfx::Size(10, 10)); | 1114 root->SetBounds(gfx::Size(10, 10)); |
| 1113 root->SetAnchorPoint(gfx::PointF()); | 1115 root->SetAnchorPoint(gfx::PointF()); |
| 1114 root->SetIsDrawable(true); | 1116 root->SetIsDrawable(true); |
| 1115 | 1117 |
| 1118 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
| 1119 frame_data->render_pass_list.push_back(RenderPass::Create()); |
| 1120 frame_data->render_pass_list.back()->SetNew(RenderPass::Id(1, 0), |
| 1121 gfx::Rect(10, 10), |
| 1122 gfx::Rect(10, 10), |
| 1123 gfx::Transform()); |
| 1124 |
| 1125 delegated_resource_collection_ = new DelegatedFrameResourceCollection; |
| 1126 delegated_frame_provider_ = new DelegatedFrameProvider( |
| 1127 delegated_resource_collection_.get(), frame_data.Pass()); |
| 1128 |
| 1116 scoped_refptr<FakeDelegatedRendererLayer> delegated = | 1129 scoped_refptr<FakeDelegatedRendererLayer> delegated = |
| 1117 FakeDelegatedRendererLayer::Create(NULL); | 1130 FakeDelegatedRendererLayer::Create(NULL, |
| 1131 delegated_frame_provider_.get()); |
| 1118 delegated->SetBounds(gfx::Size(10, 10)); | 1132 delegated->SetBounds(gfx::Size(10, 10)); |
| 1119 delegated->SetAnchorPoint(gfx::PointF()); | 1133 delegated->SetAnchorPoint(gfx::PointF()); |
| 1120 delegated->SetIsDrawable(true); | 1134 delegated->SetIsDrawable(true); |
| 1121 root->AddChild(delegated); | 1135 root->AddChild(delegated); |
| 1122 | 1136 |
| 1123 scoped_refptr<ContentLayer> content = ContentLayer::Create(&client_); | 1137 scoped_refptr<ContentLayer> content = ContentLayer::Create(&client_); |
| 1124 content->SetBounds(gfx::Size(10, 10)); | 1138 content->SetBounds(gfx::Size(10, 10)); |
| 1125 content->SetAnchorPoint(gfx::PointF()); | 1139 content->SetAnchorPoint(gfx::PointF()); |
| 1126 content->SetIsDrawable(true); | 1140 content->SetIsDrawable(true); |
| 1127 root->AddChild(content); | 1141 root->AddChild(content); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 } | 1334 } |
| 1321 | 1335 |
| 1322 virtual void AfterTest() OVERRIDE { | 1336 virtual void AfterTest() OVERRIDE { |
| 1323 EXPECT_TRUE(lost_context_); | 1337 EXPECT_TRUE(lost_context_); |
| 1324 } | 1338 } |
| 1325 | 1339 |
| 1326 private: | 1340 private: |
| 1327 FakeContentLayerClient client_; | 1341 FakeContentLayerClient client_; |
| 1328 bool lost_context_; | 1342 bool lost_context_; |
| 1329 | 1343 |
| 1344 scoped_refptr<DelegatedFrameResourceCollection> |
| 1345 delegated_resource_collection_; |
| 1346 scoped_refptr<DelegatedFrameProvider> delegated_frame_provider_; |
| 1347 |
| 1330 scoped_refptr<VideoFrame> color_video_frame_; | 1348 scoped_refptr<VideoFrame> color_video_frame_; |
| 1331 scoped_refptr<VideoFrame> hw_video_frame_; | 1349 scoped_refptr<VideoFrame> hw_video_frame_; |
| 1332 scoped_refptr<VideoFrame> scaled_hw_video_frame_; | 1350 scoped_refptr<VideoFrame> scaled_hw_video_frame_; |
| 1333 | 1351 |
| 1334 FakeVideoFrameProvider color_frame_provider_; | 1352 FakeVideoFrameProvider color_frame_provider_; |
| 1335 FakeVideoFrameProvider hw_frame_provider_; | 1353 FakeVideoFrameProvider hw_frame_provider_; |
| 1336 FakeVideoFrameProvider scaled_hw_frame_provider_; | 1354 FakeVideoFrameProvider scaled_hw_frame_provider_; |
| 1337 }; | 1355 }; |
| 1338 | 1356 |
| 1339 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestDontUseLostResources); | 1357 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestDontUseLostResources); |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 EXPECT_TRUE(impl->CanDraw()); | 2240 EXPECT_TRUE(impl->CanDraw()); |
| 2223 break; | 2241 break; |
| 2224 } | 2242 } |
| 2225 } | 2243 } |
| 2226 }; | 2244 }; |
| 2227 | 2245 |
| 2228 SINGLE_AND_MULTI_THREAD_TEST_F(UIResourceLostEviction); | 2246 SINGLE_AND_MULTI_THREAD_TEST_F(UIResourceLostEviction); |
| 2229 | 2247 |
| 2230 } // namespace | 2248 } // namespace |
| 2231 } // namespace cc | 2249 } // namespace cc |
| OLD | NEW |