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" | |
6 | |
7 #include <stddef.h> | 5 #include <stddef.h> |
8 #include <stdint.h> | 6 #include <stdint.h> |
9 | 7 |
| 8 #include "base/memory/ptr_util.h" |
10 #include "cc/layers/heads_up_display_layer.h" | 9 #include "cc/layers/heads_up_display_layer.h" |
11 #include "cc/layers/io_surface_layer.h" | 10 #include "cc/layers/io_surface_layer.h" |
12 #include "cc/layers/layer_impl.h" | 11 #include "cc/layers/layer_impl.h" |
13 #include "cc/layers/painted_scrollbar_layer.h" | 12 #include "cc/layers/painted_scrollbar_layer.h" |
14 #include "cc/layers/picture_layer.h" | 13 #include "cc/layers/picture_layer.h" |
15 #include "cc/layers/texture_layer.h" | 14 #include "cc/layers/texture_layer.h" |
16 #include "cc/layers/texture_layer_impl.h" | 15 #include "cc/layers/texture_layer_impl.h" |
17 #include "cc/layers/video_layer.h" | 16 #include "cc/layers/video_layer.h" |
18 #include "cc/layers/video_layer_impl.h" | 17 #include "cc/layers/video_layer_impl.h" |
19 #include "cc/output/filter_operations.h" | 18 #include "cc/output/filter_operations.h" |
20 #include "cc/resources/single_release_callback.h" | 19 #include "cc/resources/single_release_callback.h" |
21 #include "cc/test/failure_output_surface.h" | 20 #include "cc/test/failure_output_surface.h" |
22 #include "cc/test/fake_content_layer_client.h" | 21 #include "cc/test/fake_content_layer_client.h" |
23 #include "cc/test/fake_layer_tree_host_client.h" | 22 #include "cc/test/fake_layer_tree_host_client.h" |
24 #include "cc/test/fake_output_surface.h" | 23 #include "cc/test/fake_output_surface.h" |
25 #include "cc/test/fake_output_surface_client.h" | 24 #include "cc/test/fake_output_surface_client.h" |
26 #include "cc/test/fake_painted_scrollbar_layer.h" | 25 #include "cc/test/fake_painted_scrollbar_layer.h" |
27 #include "cc/test/fake_picture_layer.h" | 26 #include "cc/test/fake_picture_layer.h" |
28 #include "cc/test/fake_picture_layer_impl.h" | 27 #include "cc/test/fake_picture_layer_impl.h" |
29 #include "cc/test/fake_resource_provider.h" | 28 #include "cc/test/fake_resource_provider.h" |
30 #include "cc/test/fake_scoped_ui_resource.h" | 29 #include "cc/test/fake_scoped_ui_resource.h" |
31 #include "cc/test/fake_scrollbar.h" | 30 #include "cc/test/fake_scrollbar.h" |
32 #include "cc/test/fake_video_frame_provider.h" | 31 #include "cc/test/fake_video_frame_provider.h" |
33 #include "cc/test/layer_tree_test.h" | 32 #include "cc/test/layer_tree_test.h" |
34 #include "cc/test/render_pass_test_utils.h" | 33 #include "cc/test/render_pass_test_utils.h" |
35 #include "cc/test/test_context_provider.h" | 34 #include "cc/test/test_context_provider.h" |
36 #include "cc/test/test_shared_bitmap_manager.h" | 35 #include "cc/test/test_shared_bitmap_manager.h" |
37 #include "cc/test/test_web_graphics_context_3d.h" | 36 #include "cc/test/test_web_graphics_context_3d.h" |
| 37 #include "cc/trees/layer_tree_host.h" |
38 #include "cc/trees/layer_tree_host_impl.h" | 38 #include "cc/trees/layer_tree_host_impl.h" |
39 #include "cc/trees/layer_tree_impl.h" | 39 #include "cc/trees/layer_tree_impl.h" |
40 #include "cc/trees/single_thread_proxy.h" | 40 #include "cc/trees/single_thread_proxy.h" |
41 #include "gpu/GLES2/gl2extchromium.h" | 41 #include "gpu/GLES2/gl2extchromium.h" |
42 #include "media/base/media.h" | 42 #include "media/base/media.h" |
43 | 43 |
44 using media::VideoFrame; | 44 using media::VideoFrame; |
45 | 45 |
46 namespace cc { | 46 namespace cc { |
47 namespace { | 47 namespace { |
(...skipping 22 matching lines...) Expand all Loading... |
70 // to make sure we don't set it to null after recreating it there. | 70 // to make sure we don't set it to null after recreating it there. |
71 base::AutoLock lock(context3d_lock_); | 71 base::AutoLock lock(context3d_lock_); |
72 // For sanity-checking tests, they should only call this when the | 72 // For sanity-checking tests, they should only call this when the |
73 // context is not lost. | 73 // context is not lost. |
74 CHECK(context3d_); | 74 CHECK(context3d_); |
75 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 75 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
76 GL_INNOCENT_CONTEXT_RESET_ARB); | 76 GL_INNOCENT_CONTEXT_RESET_ARB); |
77 context3d_ = NULL; | 77 context3d_ = NULL; |
78 } | 78 } |
79 | 79 |
80 virtual scoped_ptr<TestWebGraphicsContext3D> CreateContext3d() { | 80 virtual std::unique_ptr<TestWebGraphicsContext3D> CreateContext3d() { |
81 return TestWebGraphicsContext3D::Create(); | 81 return TestWebGraphicsContext3D::Create(); |
82 } | 82 } |
83 | 83 |
84 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 84 std::unique_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
85 if (times_to_fail_create_) { | 85 if (times_to_fail_create_) { |
86 --times_to_fail_create_; | 86 --times_to_fail_create_; |
87 ExpectCreateToFail(); | 87 ExpectCreateToFail(); |
88 return make_scoped_ptr(new FailureOutputSurface(delegating_renderer())); | 88 return base::WrapUnique(new FailureOutputSurface(delegating_renderer())); |
89 } | 89 } |
90 | 90 |
91 scoped_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); | 91 std::unique_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); |
92 base::AutoLock lock(context3d_lock_); | 92 base::AutoLock lock(context3d_lock_); |
93 context3d_ = context3d.get(); | 93 context3d_ = context3d.get(); |
94 | 94 |
95 if (context_should_support_io_surface_) { | 95 if (context_should_support_io_surface_) { |
96 context3d_->set_have_extension_io_surface(true); | 96 context3d_->set_have_extension_io_surface(true); |
97 context3d_->set_have_extension_egl_image(true); | 97 context3d_->set_have_extension_egl_image(true); |
98 } | 98 } |
99 | 99 |
100 if (delegating_renderer()) | 100 if (delegating_renderer()) |
101 return FakeOutputSurface::CreateDelegating3d(std::move(context3d)); | 101 return FakeOutputSurface::CreateDelegating3d(std::move(context3d)); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 MainThreadTaskRunner()->PostTask( | 182 MainThreadTaskRunner()->PostTask( |
183 FROM_HERE, base::Bind(&LayerTreeHostContextTestLostContextSucceeds:: | 183 FROM_HERE, base::Bind(&LayerTreeHostContextTestLostContextSucceeds:: |
184 CreateAndSetOutputSurface, | 184 CreateAndSetOutputSurface, |
185 base::Unretained(this))); | 185 base::Unretained(this))); |
186 } else { | 186 } else { |
187 CreateAndSetOutputSurface(); | 187 CreateAndSetOutputSurface(); |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 void CreateAndSetOutputSurface() { | 191 void CreateAndSetOutputSurface() { |
192 scoped_ptr<OutputSurface> surface( | 192 std::unique_ptr<OutputSurface> surface( |
193 LayerTreeHostContextTest::CreateOutputSurface()); | 193 LayerTreeHostContextTest::CreateOutputSurface()); |
194 CHECK(surface); | 194 CHECK(surface); |
195 layer_tree_host()->SetOutputSurface(std::move(surface)); | 195 layer_tree_host()->SetOutputSurface(std::move(surface)); |
196 } | 196 } |
197 | 197 |
198 void DidInitializeOutputSurface() override { | 198 void DidInitializeOutputSurface() override { |
199 if (first_initialized_) | 199 if (first_initialized_) |
200 ++num_losses_; | 200 ++num_losses_; |
201 else | 201 else |
202 first_initialized_ = true; | 202 first_initialized_ = true; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 void WillBeginTest() override { | 361 void WillBeginTest() override { |
362 // Override to not become visible. | 362 // Override to not become visible. |
363 DCHECK(!layer_tree_host()->visible()); | 363 DCHECK(!layer_tree_host()->visible()); |
364 } | 364 } |
365 | 365 |
366 void BeginTest() override { | 366 void BeginTest() override { |
367 PostSetNeedsCommitToMainThread(); | 367 PostSetNeedsCommitToMainThread(); |
368 EndTest(); | 368 EndTest(); |
369 } | 369 } |
370 | 370 |
371 scoped_ptr<OutputSurface> CreateOutputSurface() override { | 371 std::unique_ptr<OutputSurface> CreateOutputSurface() override { |
372 EXPECT_TRUE(false); | 372 EXPECT_TRUE(false); |
373 return nullptr; | 373 return nullptr; |
374 } | 374 } |
375 | 375 |
376 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } | 376 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } |
377 | 377 |
378 void AfterTest() override {} | 378 void AfterTest() override {} |
379 }; | 379 }; |
380 | 380 |
381 SINGLE_AND_MULTI_THREAD_TEST_F( | 381 SINGLE_AND_MULTI_THREAD_TEST_F( |
(...skipping 13 matching lines...) Expand all Loading... |
395 : LayerTreeHostContextTest(), setos_counter_(0) {} | 395 : LayerTreeHostContextTest(), setos_counter_(0) {} |
396 | 396 |
397 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 397 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
398 | 398 |
399 void RequestNewOutputSurface() override { | 399 void RequestNewOutputSurface() override { |
400 if (layer_tree_host()->visible()) | 400 if (layer_tree_host()->visible()) |
401 CreateAndSetOutputSurface(); | 401 CreateAndSetOutputSurface(); |
402 } | 402 } |
403 | 403 |
404 void CreateAndSetOutputSurface() { | 404 void CreateAndSetOutputSurface() { |
405 scoped_ptr<OutputSurface> surface = | 405 std::unique_ptr<OutputSurface> surface = |
406 LayerTreeHostContextTest::CreateOutputSurface(); | 406 LayerTreeHostContextTest::CreateOutputSurface(); |
407 CHECK(surface); | 407 CHECK(surface); |
408 setos_counter_++; | 408 setos_counter_++; |
409 layer_tree_host()->SetOutputSurface(std::move(surface)); | 409 layer_tree_host()->SetOutputSurface(std::move(surface)); |
410 } | 410 } |
411 | 411 |
412 void HideAndReleaseOutputSurface() { | 412 void HideAndReleaseOutputSurface() { |
413 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); | 413 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); |
414 layer_tree_host()->SetVisible(false); | 414 layer_tree_host()->SetVisible(false); |
415 scoped_ptr<OutputSurface> surface = | 415 std::unique_ptr<OutputSurface> surface = |
416 layer_tree_host()->ReleaseOutputSurface(); | 416 layer_tree_host()->ReleaseOutputSurface(); |
417 CHECK(surface); | 417 CHECK(surface); |
418 MainThreadTaskRunner()->PostTask( | 418 MainThreadTaskRunner()->PostTask( |
419 FROM_HERE, | 419 FROM_HERE, |
420 base::Bind(&LayerTreeHostClientTakeAwayOutputSurface::MakeVisible, | 420 base::Bind(&LayerTreeHostClientTakeAwayOutputSurface::MakeVisible, |
421 base::Unretained(this))); | 421 base::Unretained(this))); |
422 } | 422 } |
423 | 423 |
424 void DidInitializeOutputSurface() override { | 424 void DidInitializeOutputSurface() override { |
425 EXPECT_TRUE(layer_tree_host()->visible()); | 425 EXPECT_TRUE(layer_tree_host()->visible()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 void RequestNewOutputSurface() override { | 459 void RequestNewOutputSurface() override { |
460 EXPECT_GE(1, ++request_count_); | 460 EXPECT_GE(1, ++request_count_); |
461 EndTest(); | 461 EndTest(); |
462 } | 462 } |
463 | 463 |
464 void BeginTest() override { | 464 void BeginTest() override { |
465 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | 465 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
466 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); | 466 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); |
467 } | 467 } |
468 | 468 |
469 scoped_ptr<OutputSurface> CreateOutputSurface() override { | 469 std::unique_ptr<OutputSurface> CreateOutputSurface() override { |
470 EXPECT_TRUE(false); | 470 EXPECT_TRUE(false); |
471 return nullptr; | 471 return nullptr; |
472 } | 472 } |
473 | 473 |
474 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } | 474 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } |
475 | 475 |
476 void AfterTest() override {} | 476 void AfterTest() override {} |
477 | 477 |
478 int request_count_; | 478 int request_count_; |
479 }; | 479 }; |
(...skipping 18 matching lines...) Expand all Loading... |
498 void RequestNewOutputSurface() override { | 498 void RequestNewOutputSurface() override { |
499 num_requests_++; | 499 num_requests_++; |
500 // There should be one initial request and then one request from | 500 // There should be one initial request and then one request from |
501 // the LayerTreeTest test hooks DidFailToInitializeOutputSurface (which is | 501 // the LayerTreeTest test hooks DidFailToInitializeOutputSurface (which is |
502 // hard to skip). This second request is just ignored and is test cruft. | 502 // hard to skip). This second request is just ignored and is test cruft. |
503 EXPECT_LE(num_requests_, 2); | 503 EXPECT_LE(num_requests_, 2); |
504 if (num_requests_ > 1) | 504 if (num_requests_ > 1) |
505 return; | 505 return; |
506 ExpectCreateToFail(); | 506 ExpectCreateToFail(); |
507 layer_tree_host()->SetOutputSurface( | 507 layer_tree_host()->SetOutputSurface( |
508 make_scoped_ptr(new FailureOutputSurface(false))); | 508 base::WrapUnique(new FailureOutputSurface(false))); |
509 } | 509 } |
510 | 510 |
511 void BeginTest() override { | 511 void BeginTest() override { |
512 // First composite tries to create a surface. | 512 // First composite tries to create a surface. |
513 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | 513 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
514 EXPECT_EQ(num_requests_, 2); | 514 EXPECT_EQ(num_requests_, 2); |
515 EXPECT_TRUE(has_failed_); | 515 EXPECT_TRUE(has_failed_); |
516 | 516 |
517 // Second composite should not request or fail. | 517 // Second composite should not request or fail. |
518 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); | 518 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 child_output_surface_.get(), shared_bitmap_manager_.get()); | 911 child_output_surface_.get(), shared_bitmap_manager_.get()); |
912 } | 912 } |
913 | 913 |
914 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, | 914 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, |
915 bool lost) {} | 915 bool lost) {} |
916 | 916 |
917 void SetupTree() override { | 917 void SetupTree() override { |
918 gpu::gles2::GLES2Interface* gl = | 918 gpu::gles2::GLES2Interface* gl = |
919 child_output_surface_->context_provider()->ContextGL(); | 919 child_output_surface_->context_provider()->ContextGL(); |
920 | 920 |
921 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 921 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
922 | 922 |
923 scoped_ptr<RenderPass> pass_for_quad = RenderPass::Create(); | 923 std::unique_ptr<RenderPass> pass_for_quad = RenderPass::Create(); |
924 pass_for_quad->SetNew( | 924 pass_for_quad->SetNew( |
925 // AppendOneOfEveryQuadType() makes a RenderPass quad with this id. | 925 // AppendOneOfEveryQuadType() makes a RenderPass quad with this id. |
926 RenderPassId(2, 1), | 926 RenderPassId(2, 1), |
927 gfx::Rect(0, 0, 10, 10), | 927 gfx::Rect(0, 0, 10, 10), |
928 gfx::Rect(0, 0, 10, 10), | 928 gfx::Rect(0, 0, 10, 10), |
929 gfx::Transform()); | 929 gfx::Transform()); |
930 | 930 |
931 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 931 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
932 pass->SetNew(RenderPassId(1, 1), | 932 pass->SetNew(RenderPassId(1, 1), |
933 gfx::Rect(0, 0, 10, 10), | 933 gfx::Rect(0, 0, 10, 10), |
934 gfx::Rect(0, 0, 10, 10), | 934 gfx::Rect(0, 0, 10, 10), |
935 gfx::Transform()); | 935 gfx::Transform()); |
936 gpu::SyncToken mailbox_sync_token; | 936 gpu::SyncToken mailbox_sync_token; |
937 AddOneOfEveryQuadType(pass.get(), child_resource_provider_.get(), | 937 AddOneOfEveryQuadType(pass.get(), child_resource_provider_.get(), |
938 RenderPassId(2, 1), &mailbox_sync_token); | 938 RenderPassId(2, 1), &mailbox_sync_token); |
939 | 939 |
940 frame_data->render_pass_list.push_back(std::move(pass_for_quad)); | 940 frame_data->render_pass_list.push_back(std::move(pass_for_quad)); |
941 frame_data->render_pass_list.push_back(std::move(pass)); | 941 frame_data->render_pass_list.push_back(std::move(pass)); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 io_surface->SetIsDrawable(true); | 1027 io_surface->SetIsDrawable(true); |
1028 io_surface->SetIOSurfaceProperties(1, gfx::Size(10, 10)); | 1028 io_surface->SetIOSurfaceProperties(1, gfx::Size(10, 10)); |
1029 root->AddChild(io_surface); | 1029 root->AddChild(io_surface); |
1030 | 1030 |
1031 // Enable the hud. | 1031 // Enable the hud. |
1032 LayerTreeDebugState debug_state; | 1032 LayerTreeDebugState debug_state; |
1033 debug_state.show_property_changed_rects = true; | 1033 debug_state.show_property_changed_rects = true; |
1034 layer_tree_host()->SetDebugState(debug_state); | 1034 layer_tree_host()->SetDebugState(debug_state); |
1035 | 1035 |
1036 scoped_refptr<PaintedScrollbarLayer> scrollbar = | 1036 scoped_refptr<PaintedScrollbarLayer> scrollbar = |
1037 PaintedScrollbarLayer::Create(scoped_ptr<Scrollbar>(new FakeScrollbar), | 1037 PaintedScrollbarLayer::Create( |
1038 layer->id()); | 1038 std::unique_ptr<Scrollbar>(new FakeScrollbar), layer->id()); |
1039 scrollbar->SetBounds(gfx::Size(10, 10)); | 1039 scrollbar->SetBounds(gfx::Size(10, 10)); |
1040 scrollbar->SetIsDrawable(true); | 1040 scrollbar->SetIsDrawable(true); |
1041 root->AddChild(scrollbar); | 1041 root->AddChild(scrollbar); |
1042 | 1042 |
1043 layer_tree_host()->SetRootLayer(root); | 1043 layer_tree_host()->SetRootLayer(root); |
1044 LayerTreeHostContextTest::SetupTree(); | 1044 LayerTreeHostContextTest::SetupTree(); |
1045 } | 1045 } |
1046 | 1046 |
1047 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1047 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
1048 | 1048 |
(...skipping 13 matching lines...) Expand all Loading... |
1062 LayerTreeHostImpl::FrameData* frame, | 1062 LayerTreeHostImpl::FrameData* frame, |
1063 DrawResult draw_result) override { | 1063 DrawResult draw_result) override { |
1064 if (host_impl->active_tree()->source_frame_number() == 2) { | 1064 if (host_impl->active_tree()->source_frame_number() == 2) { |
1065 // Lose the context during draw on the second commit. This will cause | 1065 // Lose the context during draw on the second commit. This will cause |
1066 // a third commit to recover. | 1066 // a third commit to recover. |
1067 context3d_->set_times_bind_texture_succeeds(0); | 1067 context3d_->set_times_bind_texture_succeeds(0); |
1068 } | 1068 } |
1069 return draw_result; | 1069 return draw_result; |
1070 } | 1070 } |
1071 | 1071 |
1072 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 1072 std::unique_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
1073 // This will get called twice: | 1073 // This will get called twice: |
1074 // First when we create the initial output surface... | 1074 // First when we create the initial output surface... |
1075 if (layer_tree_host()->source_frame_number() > 0) { | 1075 if (layer_tree_host()->source_frame_number() > 0) { |
1076 // ... and then again after we forced the context to be lost. | 1076 // ... and then again after we forced the context to be lost. |
1077 lost_context_ = true; | 1077 lost_context_ = true; |
1078 } | 1078 } |
1079 return LayerTreeHostContextTest::CreateFakeOutputSurface(); | 1079 return LayerTreeHostContextTest::CreateFakeOutputSurface(); |
1080 } | 1080 } |
1081 | 1081 |
1082 void DidCommitAndDrawFrame() override { | 1082 void DidCommitAndDrawFrame() override { |
1083 ASSERT_TRUE(layer_tree_host()->hud_layer()); | 1083 ASSERT_TRUE(layer_tree_host()->hud_layer()); |
1084 // End the test once we know the 3nd frame drew. | 1084 // End the test once we know the 3nd frame drew. |
1085 if (layer_tree_host()->source_frame_number() < 5) { | 1085 if (layer_tree_host()->source_frame_number() < 5) { |
1086 layer_tree_host()->root_layer()->SetNeedsDisplay(); | 1086 layer_tree_host()->root_layer()->SetNeedsDisplay(); |
1087 layer_tree_host()->SetNeedsCommit(); | 1087 layer_tree_host()->SetNeedsCommit(); |
1088 } else { | 1088 } else { |
1089 EndTest(); | 1089 EndTest(); |
1090 } | 1090 } |
1091 } | 1091 } |
1092 | 1092 |
1093 void AfterTest() override { EXPECT_TRUE(lost_context_); } | 1093 void AfterTest() override { EXPECT_TRUE(lost_context_); } |
1094 | 1094 |
1095 private: | 1095 private: |
1096 FakeContentLayerClient client_; | 1096 FakeContentLayerClient client_; |
1097 bool lost_context_; | 1097 bool lost_context_; |
1098 | 1098 |
1099 FakeOutputSurfaceClient output_surface_client_; | 1099 FakeOutputSurfaceClient output_surface_client_; |
1100 scoped_ptr<FakeOutputSurface> child_output_surface_; | 1100 std::unique_ptr<FakeOutputSurface> child_output_surface_; |
1101 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | 1101 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; |
1102 scoped_ptr<ResourceProvider> child_resource_provider_; | 1102 std::unique_ptr<ResourceProvider> child_resource_provider_; |
1103 | 1103 |
1104 scoped_refptr<VideoFrame> color_video_frame_; | 1104 scoped_refptr<VideoFrame> color_video_frame_; |
1105 scoped_refptr<VideoFrame> hw_video_frame_; | 1105 scoped_refptr<VideoFrame> hw_video_frame_; |
1106 scoped_refptr<VideoFrame> scaled_hw_video_frame_; | 1106 scoped_refptr<VideoFrame> scaled_hw_video_frame_; |
1107 | 1107 |
1108 FakeVideoFrameProvider color_frame_provider_; | 1108 FakeVideoFrameProvider color_frame_provider_; |
1109 FakeVideoFrameProvider hw_frame_provider_; | 1109 FakeVideoFrameProvider hw_frame_provider_; |
1110 FakeVideoFrameProvider scaled_hw_frame_provider_; | 1110 FakeVideoFrameProvider scaled_hw_frame_provider_; |
1111 }; | 1111 }; |
1112 | 1112 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 void PostLoseContextToImplThread() { | 1221 void PostLoseContextToImplThread() { |
1222 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); | 1222 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); |
1223 ImplThreadTaskRunner()->PostTask( | 1223 ImplThreadTaskRunner()->PostTask( |
1224 FROM_HERE, | 1224 FROM_HERE, |
1225 base::Bind(&LayerTreeHostContextTest::LoseContext, | 1225 base::Bind(&LayerTreeHostContextTest::LoseContext, |
1226 base::Unretained(this))); | 1226 base::Unretained(this))); |
1227 } | 1227 } |
1228 | 1228 |
1229 protected: | 1229 protected: |
1230 int time_step_; | 1230 int time_step_; |
1231 scoped_ptr<FakeScopedUIResource> ui_resource_; | 1231 std::unique_ptr<FakeScopedUIResource> ui_resource_; |
1232 | 1232 |
1233 private: | 1233 private: |
1234 void StepCompleteOnMainThreadInternal(int step) { | 1234 void StepCompleteOnMainThreadInternal(int step) { |
1235 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); | 1235 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); |
1236 StepCompleteOnMainThread(step); | 1236 StepCompleteOnMainThread(step); |
1237 } | 1237 } |
1238 }; | 1238 }; |
1239 | 1239 |
1240 class UIResourceLostTestSimple : public UIResourceLostTest { | 1240 class UIResourceLostTestSimple : public UIResourceLostTest { |
1241 public: | 1241 public: |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 void AfterTest() override {} | 1610 void AfterTest() override {} |
1611 | 1611 |
1612 bool deferred_; | 1612 bool deferred_; |
1613 }; | 1613 }; |
1614 | 1614 |
1615 SINGLE_AND_MULTI_THREAD_TEST_F( | 1615 SINGLE_AND_MULTI_THREAD_TEST_F( |
1616 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1616 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
1617 | 1617 |
1618 } // namespace | 1618 } // namespace |
1619 } // namespace cc | 1619 } // namespace cc |
OLD | NEW |