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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 int num_draws_; | 267 int num_draws_; |
268 }; | 268 }; |
269 | 269 |
270 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw); | 270 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw); |
271 | 271 |
272 // After setNeedsRedrawRect(invalid_rect) the final damage_rect | 272 // After setNeedsRedrawRect(invalid_rect) the final damage_rect |
273 // must contain invalid_rect. | 273 // must contain invalid_rect. |
274 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { | 274 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { |
275 public: | 275 public: |
276 LayerTreeHostTestSetNeedsRedrawRect() | 276 LayerTreeHostTestSetNeedsRedrawRect() |
277 : num_draws_(0), | 277 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
278 bounds_(50, 50), | |
279 invalid_rect_(10, 10, 20, 20), | |
280 root_layer_(ContentLayer::Create(&client_)) {} | |
281 | 278 |
282 virtual void BeginTest() OVERRIDE { | 279 virtual void BeginTest() OVERRIDE { |
280 if (layer_tree_host()->settings().impl_side_painting) | |
281 root_layer_ = FakePictureLayer::Create(&client_); | |
282 else | |
283 root_layer_ = ContentLayer::Create(&client_); | |
284 | |
283 root_layer_->SetIsDrawable(true); | 285 root_layer_->SetIsDrawable(true); |
284 root_layer_->SetBounds(bounds_); | 286 root_layer_->SetBounds(bounds_); |
285 layer_tree_host()->SetRootLayer(root_layer_); | 287 layer_tree_host()->SetRootLayer(root_layer_); |
286 layer_tree_host()->SetViewportSize(bounds_); | 288 layer_tree_host()->SetViewportSize(bounds_); |
287 PostSetNeedsCommitToMainThread(); | 289 PostSetNeedsCommitToMainThread(); |
288 } | 290 } |
289 | 291 |
290 virtual DrawResult PrepareToDrawOnThread( | 292 virtual DrawResult PrepareToDrawOnThread( |
291 LayerTreeHostImpl* host_impl, | 293 LayerTreeHostImpl* host_impl, |
292 LayerTreeHostImpl::FrameData* frame_data, | 294 LayerTreeHostImpl::FrameData* frame_data, |
(...skipping 24 matching lines...) Expand all Loading... | |
317 num_draws_++; | 319 num_draws_++; |
318 } | 320 } |
319 | 321 |
320 virtual void AfterTest() OVERRIDE { EXPECT_EQ(2, num_draws_); } | 322 virtual void AfterTest() OVERRIDE { EXPECT_EQ(2, num_draws_); } |
321 | 323 |
322 private: | 324 private: |
323 int num_draws_; | 325 int num_draws_; |
324 const gfx::Size bounds_; | 326 const gfx::Size bounds_; |
325 const gfx::Rect invalid_rect_; | 327 const gfx::Rect invalid_rect_; |
326 FakeContentLayerClient client_; | 328 FakeContentLayerClient client_; |
327 scoped_refptr<ContentLayer> root_layer_; | 329 scoped_refptr<Layer> root_layer_; |
328 }; | 330 }; |
329 | 331 |
330 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect); | 332 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect); |
331 | 333 |
332 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { | 334 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { |
333 public: | 335 public: |
334 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 336 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
335 settings->layer_transforms_should_scale_layer_contents = true; | 337 settings->layer_transforms_should_scale_layer_contents = true; |
336 } | 338 } |
337 | 339 |
338 virtual void SetupTree() OVERRIDE { | 340 virtual void SetupTree() OVERRIDE { |
339 root_layer_ = Layer::Create(); | 341 root_layer_ = Layer::Create(); |
340 root_layer_->SetBounds(gfx::Size(10, 20)); | 342 root_layer_->SetBounds(gfx::Size(10, 20)); |
341 | 343 |
342 scaled_layer_ = FakeContentLayer::Create(&client_); | 344 scaled_layer_ = FakeContentLayer::Create(&client_); |
danakj
2014/09/19 18:12:01
picture layer when impl side?
sohanjg
2014/09/22 09:31:18
Done.
| |
343 scaled_layer_->SetBounds(gfx::Size(1, 1)); | 345 scaled_layer_->SetBounds(gfx::Size(1, 1)); |
344 root_layer_->AddChild(scaled_layer_); | 346 root_layer_->AddChild(scaled_layer_); |
345 | 347 |
346 layer_tree_host()->SetRootLayer(root_layer_); | 348 layer_tree_host()->SetRootLayer(root_layer_); |
347 LayerTreeHostTest::SetupTree(); | 349 LayerTreeHostTest::SetupTree(); |
348 } | 350 } |
349 | 351 |
350 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 352 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
351 | 353 |
352 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 354 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
353 if (host_impl->active_tree()->source_frame_number() == 1) | 355 if (host_impl->active_tree()->source_frame_number() == 1) |
354 EndTest(); | 356 EndTest(); |
355 } | 357 } |
356 | 358 |
357 virtual void DidCommit() OVERRIDE { | 359 virtual void DidCommit() OVERRIDE { |
358 switch (layer_tree_host()->source_frame_number()) { | 360 switch (layer_tree_host()->source_frame_number()) { |
359 case 1: | 361 case 1: |
360 // Changing the device scale factor causes a commit. It also changes | 362 // Changing the device scale factor causes a commit. It also changes |
361 // the content bounds of |scaled_layer_|, which should not generate | 363 // the content bounds of |scaled_layer_|, which should not generate |
362 // a second commit as a result. | 364 // a second commit as a result. |
363 layer_tree_host()->SetDeviceScaleFactor(4.f); | 365 layer_tree_host()->SetDeviceScaleFactor(4.f); |
danakj
2014/09/19 18:12:00
can you change the layer's bounds instead of chang
sohanjg
2014/09/22 09:31:18
Done.
| |
364 break; | 366 break; |
365 default: | 367 default: |
366 // No extra commits. | 368 // No extra commits. |
367 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); | 369 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); |
368 } | 370 } |
369 } | 371 } |
370 | 372 |
371 virtual void AfterTest() OVERRIDE { | 373 virtual void AfterTest() OVERRIDE { |
372 EXPECT_EQ(gfx::Size(4, 4).ToString(), | 374 EXPECT_EQ(gfx::Size(4, 4).ToString(), |
373 scaled_layer_->content_bounds().ToString()); | 375 scaled_layer_->content_bounds().ToString()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 scoped_refptr<Layer> root_layer_; | 438 scoped_refptr<Layer> root_layer_; |
437 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; | 439 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; |
438 }; | 440 }; |
439 | 441 |
440 SINGLE_AND_MULTI_THREAD_TEST_F( | 442 SINGLE_AND_MULTI_THREAD_TEST_F( |
441 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); | 443 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); |
442 | 444 |
443 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { | 445 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { |
444 public: | 446 public: |
445 LayerTreeHostTestSetNextCommitForcesRedraw() | 447 LayerTreeHostTestSetNextCommitForcesRedraw() |
446 : num_draws_(0), | 448 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
447 bounds_(50, 50), | |
448 invalid_rect_(10, 10, 20, 20), | |
449 root_layer_(ContentLayer::Create(&client_)) {} | |
450 | 449 |
451 virtual void BeginTest() OVERRIDE { | 450 virtual void BeginTest() OVERRIDE { |
451 if (layer_tree_host()->settings().impl_side_painting) | |
452 root_layer_ = FakePictureLayer::Create(&client_); | |
453 else | |
454 root_layer_ = ContentLayer::Create(&client_); | |
455 | |
452 root_layer_->SetIsDrawable(true); | 456 root_layer_->SetIsDrawable(true); |
453 root_layer_->SetBounds(bounds_); | 457 root_layer_->SetBounds(bounds_); |
454 layer_tree_host()->SetRootLayer(root_layer_); | 458 layer_tree_host()->SetRootLayer(root_layer_); |
455 layer_tree_host()->SetViewportSize(bounds_); | 459 layer_tree_host()->SetViewportSize(bounds_); |
456 PostSetNeedsCommitToMainThread(); | 460 PostSetNeedsCommitToMainThread(); |
457 } | 461 } |
458 | 462 |
459 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 463 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
460 if (num_draws_ == 3 && host_impl->settings().impl_side_painting) | 464 if (num_draws_ == 3 && host_impl->settings().impl_side_painting) |
461 host_impl->SetNeedsRedrawRect(invalid_rect_); | 465 host_impl->SetNeedsRedrawRect(invalid_rect_); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
519 num_draws_++; | 523 num_draws_++; |
520 } | 524 } |
521 | 525 |
522 virtual void AfterTest() OVERRIDE { EXPECT_EQ(5, num_draws_); } | 526 virtual void AfterTest() OVERRIDE { EXPECT_EQ(5, num_draws_); } |
523 | 527 |
524 private: | 528 private: |
525 int num_draws_; | 529 int num_draws_; |
526 const gfx::Size bounds_; | 530 const gfx::Size bounds_; |
527 const gfx::Rect invalid_rect_; | 531 const gfx::Rect invalid_rect_; |
528 FakeContentLayerClient client_; | 532 FakeContentLayerClient client_; |
529 scoped_refptr<ContentLayer> root_layer_; | 533 scoped_refptr<Layer> root_layer_; |
530 }; | 534 }; |
531 | 535 |
532 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); | 536 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); |
533 | 537 |
534 // Tests that if a layer is not drawn because of some reason in the parent then | 538 // Tests that if a layer is not drawn because of some reason in the parent then |
535 // its damage is preserved until the next time it is drawn. | 539 // its damage is preserved until the next time it is drawn. |
536 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { | 540 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { |
537 public: | 541 public: |
538 LayerTreeHostTestUndrawnLayersDamageLater() | 542 LayerTreeHostTestUndrawnLayersDamageLater() {} |
539 : root_layer_(ContentLayer::Create(&client_)) {} | |
540 | 543 |
541 virtual void SetupTree() OVERRIDE { | 544 virtual void SetupTree() OVERRIDE { |
545 if (layer_tree_host()->settings().impl_side_painting) | |
546 root_layer_ = FakePictureLayer::Create(&client_); | |
547 else | |
548 root_layer_ = ContentLayer::Create(&client_); | |
549 | |
542 root_layer_->SetIsDrawable(true); | 550 root_layer_->SetIsDrawable(true); |
543 root_layer_->SetBounds(gfx::Size(50, 50)); | 551 root_layer_->SetBounds(gfx::Size(50, 50)); |
544 layer_tree_host()->SetRootLayer(root_layer_); | 552 layer_tree_host()->SetRootLayer(root_layer_); |
545 | 553 |
546 // The initially transparent layer has a larger child layer, which is | 554 // The initially transparent layer has a larger child layer, which is |
547 // not initially drawn because of the this (parent) layer. | 555 // not initially drawn because of the this (parent) layer. |
548 parent_layer_ = FakeContentLayer::Create(&client_); | 556 if (layer_tree_host()->settings().impl_side_painting) |
557 parent_layer_ = FakePictureLayer::Create(&client_); | |
558 else | |
559 parent_layer_ = FakeContentLayer::Create(&client_); | |
560 | |
549 parent_layer_->SetBounds(gfx::Size(15, 15)); | 561 parent_layer_->SetBounds(gfx::Size(15, 15)); |
550 parent_layer_->SetOpacity(0.0f); | 562 parent_layer_->SetOpacity(0.0f); |
551 root_layer_->AddChild(parent_layer_); | 563 root_layer_->AddChild(parent_layer_); |
552 | 564 |
553 child_layer_ = FakeContentLayer::Create(&client_); | 565 if (layer_tree_host()->settings().impl_side_painting) |
566 child_layer_ = FakePictureLayer::Create(&client_); | |
567 else | |
568 child_layer_ = FakeContentLayer::Create(&client_); | |
569 | |
554 child_layer_->SetBounds(gfx::Size(25, 25)); | 570 child_layer_->SetBounds(gfx::Size(25, 25)); |
555 parent_layer_->AddChild(child_layer_); | 571 parent_layer_->AddChild(child_layer_); |
556 | 572 |
557 LayerTreeHostTest::SetupTree(); | 573 LayerTreeHostTest::SetupTree(); |
558 } | 574 } |
559 | 575 |
560 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 576 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
561 | 577 |
562 virtual DrawResult PrepareToDrawOnThread( | 578 virtual DrawResult PrepareToDrawOnThread( |
563 LayerTreeHostImpl* host_impl, | 579 LayerTreeHostImpl* host_impl, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
609 break; | 625 break; |
610 default: | 626 default: |
611 NOTREACHED(); | 627 NOTREACHED(); |
612 } | 628 } |
613 } | 629 } |
614 | 630 |
615 virtual void AfterTest() OVERRIDE {} | 631 virtual void AfterTest() OVERRIDE {} |
616 | 632 |
617 private: | 633 private: |
618 FakeContentLayerClient client_; | 634 FakeContentLayerClient client_; |
619 scoped_refptr<ContentLayer> root_layer_; | 635 scoped_refptr<Layer> root_layer_; |
620 scoped_refptr<FakeContentLayer> parent_layer_; | 636 scoped_refptr<Layer> parent_layer_; |
621 scoped_refptr<FakeContentLayer> child_layer_; | 637 scoped_refptr<Layer> child_layer_; |
622 }; | 638 }; |
623 | 639 |
624 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater); | 640 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater); |
625 | 641 |
626 // Tests that if a layer is not drawn because of some reason in the parent, | 642 // Tests that if a layer is not drawn because of some reason in the parent, |
627 // causing its content bounds to not be computed, then when it is later drawn, | 643 // causing its content bounds to not be computed, then when it is later drawn, |
628 // its content bounds get pushed. | 644 // its content bounds get pushed. |
629 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater | 645 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater |
630 : public LayerTreeHostTest { | 646 : public LayerTreeHostTest { |
631 public: | 647 public: |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
984 | 1000 |
985 int paint_contents_count_; | 1001 int paint_contents_count_; |
986 }; | 1002 }; |
987 | 1003 |
988 // Layer opacity change during paint should not prevent compositor resources | 1004 // Layer opacity change during paint should not prevent compositor resources |
989 // from being updated during commit. | 1005 // from being updated during commit. |
990 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { | 1006 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { |
991 public: | 1007 public: |
992 LayerTreeHostTestOpacityChange() | 1008 LayerTreeHostTestOpacityChange() |
993 : test_opacity_change_delegate_(), | 1009 : test_opacity_change_delegate_(), |
994 update_check_layer_(ContentLayerWithUpdateTracking::Create( | 1010 update_check_layer_( |
995 &test_opacity_change_delegate_)) { | 1011 FakePictureLayer::Create(&test_opacity_change_delegate_)) { |
996 test_opacity_change_delegate_.SetTestLayer(update_check_layer_.get()); | 1012 test_opacity_change_delegate_.SetTestLayer(update_check_layer_.get()); |
997 } | 1013 } |
998 | 1014 |
999 virtual void BeginTest() OVERRIDE { | 1015 virtual void BeginTest() OVERRIDE { |
1000 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); | 1016 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); |
1001 layer_tree_host()->root_layer()->AddChild(update_check_layer_); | 1017 layer_tree_host()->root_layer()->AddChild(update_check_layer_); |
1002 | 1018 |
1003 PostSetNeedsCommitToMainThread(); | 1019 PostSetNeedsCommitToMainThread(); |
1004 } | 1020 } |
1005 | 1021 |
1006 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1022 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
1007 EndTest(); | 1023 EndTest(); |
1008 } | 1024 } |
1009 | 1025 |
1010 virtual void AfterTest() OVERRIDE { | 1026 virtual void AfterTest() OVERRIDE { |
1011 // Update() should have been called once. | 1027 // Update() should have been called once. |
1012 EXPECT_EQ(1, update_check_layer_->PaintContentsCount()); | 1028 EXPECT_EQ(1, (int)update_check_layer_->update_count()); |
1013 } | 1029 } |
1014 | 1030 |
1015 private: | 1031 private: |
1016 TestOpacityChangeLayerDelegate test_opacity_change_delegate_; | 1032 TestOpacityChangeLayerDelegate test_opacity_change_delegate_; |
1017 scoped_refptr<ContentLayerWithUpdateTracking> update_check_layer_; | 1033 scoped_refptr<FakePictureLayer> update_check_layer_; |
1018 }; | 1034 }; |
1019 | 1035 |
1020 MULTI_THREAD_TEST_F(LayerTreeHostTestOpacityChange); | 1036 TEST_F(LayerTreeHostTestOpacityChange, |
1037 RunMultiThread_DirectRenderer_ImplSidePaint) { | |
1038 RunTest(true, false, true); | |
1039 } | |
1040 TEST_F(LayerTreeHostTestOpacityChange, | |
1041 RunMultiThread_DelegatingRenderer_ImplSidePaint) { | |
1042 RunTest(true, true, true); | |
1043 } | |
1021 | 1044 |
1022 class NoScaleContentLayer : public ContentLayer { | 1045 class NoScalePictureLayer : public PictureLayer { |
1023 public: | 1046 public: |
1024 static scoped_refptr<NoScaleContentLayer> Create(ContentLayerClient* client) { | 1047 static scoped_refptr<NoScalePictureLayer> Create(ContentLayerClient* client) { |
1025 return make_scoped_refptr(new NoScaleContentLayer(client)); | 1048 return make_scoped_refptr(new NoScalePictureLayer(client)); |
1026 } | 1049 } |
1027 | 1050 |
1028 virtual void CalculateContentsScale(float ideal_contents_scale, | 1051 virtual void CalculateContentsScale(float ideal_contents_scale, |
1029 float* contents_scale_x, | 1052 float* contents_scale_x, |
1030 float* contents_scale_y, | 1053 float* contents_scale_y, |
1031 gfx::Size* contentBounds) OVERRIDE { | 1054 gfx::Size* contentBounds) OVERRIDE { |
1032 // Skip over the ContentLayer's method to the base Layer class. | 1055 // Skip over the ContentLayer's method to the base Layer class. |
1033 Layer::CalculateContentsScale(ideal_contents_scale, | 1056 Layer::CalculateContentsScale(ideal_contents_scale, |
1034 contents_scale_x, | 1057 contents_scale_x, |
1035 contents_scale_y, | 1058 contents_scale_y, |
1036 contentBounds); | 1059 contentBounds); |
1037 } | 1060 } |
1038 | 1061 |
1039 private: | 1062 private: |
1040 explicit NoScaleContentLayer(ContentLayerClient* client) | 1063 explicit NoScalePictureLayer(ContentLayerClient* client) |
1041 : ContentLayer(client) {} | 1064 : PictureLayer(client) {} |
1042 virtual ~NoScaleContentLayer() {} | 1065 virtual ~NoScalePictureLayer() {} |
1043 }; | 1066 }; |
1044 | 1067 |
1045 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers | 1068 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers |
1046 : public LayerTreeHostTest { | 1069 : public LayerTreeHostTest { |
1047 public: | 1070 public: |
1048 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() | 1071 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() |
1049 : root_layer_(NoScaleContentLayer::Create(&client_)), | 1072 : root_layer_(NoScalePictureLayer::Create(&client_)), |
1050 child_layer_(ContentLayer::Create(&client_)) {} | 1073 child_layer_(FakePictureLayer::Create(&client_)) {} |
1051 | 1074 |
1052 virtual void BeginTest() OVERRIDE { | 1075 virtual void BeginTest() OVERRIDE { |
1053 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); | 1076 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); |
1054 layer_tree_host()->SetDeviceScaleFactor(1.5); | 1077 layer_tree_host()->SetDeviceScaleFactor(1.5); |
1055 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); | 1078 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); |
1056 | 1079 |
1057 root_layer_->AddChild(child_layer_); | 1080 root_layer_->AddChild(child_layer_); |
1058 | 1081 |
1059 root_layer_->SetIsDrawable(true); | 1082 root_layer_->SetIsDrawable(true); |
1060 root_layer_->SetBounds(gfx::Size(30, 30)); | 1083 root_layer_->SetBounds(gfx::Size(30, 30)); |
(...skipping 12 matching lines...) Expand all Loading... | |
1073 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); | 1096 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); |
1074 // Device scale factor should come over to impl. | 1097 // Device scale factor should come over to impl. |
1075 EXPECT_NEAR(impl->device_scale_factor(), 1.5f, 0.00001f); | 1098 EXPECT_NEAR(impl->device_scale_factor(), 1.5f, 0.00001f); |
1076 | 1099 |
1077 // Both layers are on impl. | 1100 // Both layers are on impl. |
1078 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); | 1101 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); |
1079 | 1102 |
1080 // Device viewport is scaled. | 1103 // Device viewport is scaled. |
1081 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize()); | 1104 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize()); |
1082 | 1105 |
1083 LayerImpl* root = impl->active_tree()->root_layer(); | 1106 FakePictureLayerImpl* root = |
1084 LayerImpl* child = impl->active_tree()->root_layer()->children()[0]; | 1107 static_cast<FakePictureLayerImpl*>(impl->active_tree()->root_layer()); |
1108 FakePictureLayerImpl* child = static_cast<FakePictureLayerImpl*>( | |
1109 impl->active_tree()->root_layer()->children()[0]); | |
1085 | 1110 |
1086 // Positions remain in layout pixels. | 1111 // Positions remain in layout pixels. |
1087 EXPECT_EQ(gfx::Point(0, 0), root->position()); | 1112 EXPECT_EQ(gfx::Point(0, 0), root->position()); |
1088 EXPECT_EQ(gfx::Point(2, 2), child->position()); | 1113 EXPECT_EQ(gfx::Point(2, 2), child->position()); |
1089 | 1114 |
1090 // Compute all the layer transforms for the frame. | 1115 // Compute all the layer transforms for the frame. |
1091 LayerTreeHostImpl::FrameData frame_data; | 1116 LayerTreeHostImpl::FrameData frame_data; |
1092 impl->PrepareToDraw(&frame_data); | 1117 impl->PrepareToDraw(&frame_data); |
1093 impl->DidDrawAllLayers(frame_data); | 1118 impl->DidDrawAllLayers(frame_data); |
1094 | 1119 |
1095 const LayerImplList& render_surface_layer_list = | 1120 const LayerImplList& render_surface_layer_list = |
1096 *frame_data.render_surface_layer_list; | 1121 *frame_data.render_surface_layer_list; |
1097 | 1122 |
1098 // Both layers should be drawing into the root render surface. | 1123 // Both layers should be drawing into the root render surface. |
1099 ASSERT_EQ(1u, render_surface_layer_list.size()); | 1124 ASSERT_EQ(1u, render_surface_layer_list.size()); |
1100 ASSERT_EQ(root->render_surface(), | 1125 ASSERT_EQ(root->render_surface(), |
1101 render_surface_layer_list[0]->render_surface()); | 1126 render_surface_layer_list[0]->render_surface()); |
1102 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 1127 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
1103 | 1128 |
1104 // The root render surface is the size of the viewport. | 1129 // The root render surface is the size of the viewport. |
1105 EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60), | 1130 EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60), |
1106 root->render_surface()->content_rect()); | 1131 root->render_surface()->content_rect()); |
1107 | 1132 |
1108 // The content bounds of the child should be scaled. | 1133 // The max tiling scale of the child should be scaled. |
1109 gfx::Size child_bounds_scaled = | 1134 EXPECT_EQ(1.5, child->MaximumTilingContentsScale()); |
1110 gfx::ToCeiledSize(gfx::ScaleSize(child->bounds(), 1.5)); | |
1111 EXPECT_EQ(child_bounds_scaled, child->content_bounds()); | |
1112 | 1135 |
1113 gfx::Transform scale_transform; | 1136 gfx::Transform scale_transform; |
1114 scale_transform.Scale(impl->device_scale_factor(), | 1137 |
1115 impl->device_scale_factor()); | 1138 scale_transform.Scale(child->MaximumTilingContentsScale(), |
1139 child->MaximumTilingContentsScale()); | |
1116 | 1140 |
1117 // The root layer is scaled by 2x. | 1141 // The root layer is scaled by 2x. |
1118 gfx::Transform root_screen_space_transform = scale_transform; | 1142 gfx::Transform root_screen_space_transform = scale_transform; |
1119 gfx::Transform root_draw_transform = scale_transform; | 1143 gfx::Transform root_draw_transform = scale_transform; |
1120 | 1144 |
1121 EXPECT_EQ(root_draw_transform, root->draw_transform()); | 1145 EXPECT_EQ(root_draw_transform, root->draw_transform()); |
1122 EXPECT_EQ(root_screen_space_transform, root->screen_space_transform()); | 1146 EXPECT_EQ(root_screen_space_transform, root->screen_space_transform()); |
1123 | 1147 |
1124 // The child is at position 2,2, which is transformed to 3,3 after the scale | 1148 // The child is at position 2,2, which is transformed to 3,3 after the scale |
1125 gfx::Transform child_screen_space_transform; | 1149 gfx::Transform child_transform; |
1126 child_screen_space_transform.Translate(3.f, 3.f); | 1150 child_transform.Translate(3.f, 3.f); |
1127 gfx::Transform child_draw_transform = child_screen_space_transform; | |
1128 | 1151 |
1129 EXPECT_TRANSFORMATION_MATRIX_EQ(child_draw_transform, | 1152 child_transform.Scale(child->MaximumTilingContentsScale(), |
1130 child->draw_transform()); | 1153 child->MaximumTilingContentsScale()); |
1131 EXPECT_TRANSFORMATION_MATRIX_EQ(child_screen_space_transform, | 1154 |
1155 EXPECT_TRANSFORMATION_MATRIX_EQ(child_transform, child->draw_transform()); | |
1156 EXPECT_TRANSFORMATION_MATRIX_EQ(child_transform, | |
1132 child->screen_space_transform()); | 1157 child->screen_space_transform()); |
1133 | 1158 |
1134 EndTest(); | 1159 EndTest(); |
1135 } | 1160 } |
1136 | 1161 |
1137 virtual void AfterTest() OVERRIDE {} | 1162 virtual void AfterTest() OVERRIDE {} |
1138 | 1163 |
1139 private: | 1164 private: |
1140 FakeContentLayerClient client_; | 1165 FakeContentLayerClient client_; |
1141 scoped_refptr<NoScaleContentLayer> root_layer_; | 1166 scoped_refptr<NoScalePictureLayer> root_layer_; |
1142 scoped_refptr<ContentLayer> child_layer_; | 1167 scoped_refptr<FakePictureLayer> child_layer_; |
1143 }; | 1168 }; |
1144 | 1169 |
1145 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); | 1170 TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers, |
1171 RunMultiThread_DirectRenderer_ImplSidePaint) { | |
1172 RunTest(true, false, true); | |
1173 } | |
1174 TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers, | |
1175 RunMultiThread_DelegatingRenderer_ImplSidePaint) { | |
1176 RunTest(true, true, true); | |
1177 } | |
1178 | |
1179 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere. | |
1146 | 1180 |
danakj
2014/09/19 18:12:01
remove this blank line so the comment is attached
sohanjg
2014/09/22 09:31:18
Done.
| |
1147 // Verify atomicity of commits and reuse of textures. | 1181 // Verify atomicity of commits and reuse of textures. |
1148 class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest { | 1182 class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest { |
1149 public: | 1183 public: |
1150 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 1184 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
1151 settings->texture_id_allocation_chunk_size = 1; | 1185 settings->texture_id_allocation_chunk_size = 1; |
1152 // Make sure partial texture updates are turned off. | 1186 // Make sure partial texture updates are turned off. |
1153 settings->max_partial_texture_updates = 0; | 1187 settings->max_partial_texture_updates = 0; |
1154 // Linear fade animator prevents scrollbars from drawing immediately. | 1188 // Linear fade animator prevents scrollbars from drawing immediately. |
1155 settings->scrollbar_animator = LayerTreeSettings::NoAnimator; | 1189 settings->scrollbar_animator = LayerTreeSettings::NoAnimator; |
1156 } | 1190 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1245 protected: | 1279 protected: |
1246 FakeContentLayerClient client_; | 1280 FakeContentLayerClient client_; |
1247 scoped_refptr<FakeContentLayer> layer_; | 1281 scoped_refptr<FakeContentLayer> layer_; |
1248 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; | 1282 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; |
1249 int drew_frame_; | 1283 int drew_frame_; |
1250 }; | 1284 }; |
1251 | 1285 |
1252 MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( | 1286 MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( |
1253 LayerTreeHostTestDirectRendererAtomicCommit); | 1287 LayerTreeHostTestDirectRendererAtomicCommit); |
1254 | 1288 |
1289 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere. | |
1255 class LayerTreeHostTestDelegatingRendererAtomicCommit | 1290 class LayerTreeHostTestDelegatingRendererAtomicCommit |
1256 : public LayerTreeHostTestDirectRendererAtomicCommit { | 1291 : public LayerTreeHostTestDirectRendererAtomicCommit { |
1257 public: | 1292 public: |
1258 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1293 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
1259 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); | 1294 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); |
1260 | 1295 |
1261 TestWebGraphicsContext3D* context = TestContext(); | 1296 TestWebGraphicsContext3D* context = TestContext(); |
1262 | 1297 |
1263 switch (impl->active_tree()->source_frame_number()) { | 1298 switch (impl->active_tree()->source_frame_number()) { |
1264 case 0: | 1299 case 0: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1312 layer->RemoveAllChildren(); | 1347 layer->RemoveAllChildren(); |
1313 if (parent) | 1348 if (parent) |
1314 parent->AddChild(layer); | 1349 parent->AddChild(layer); |
1315 layer->SetTransform(transform); | 1350 layer->SetTransform(transform); |
1316 layer->SetTransformOrigin(transform_origin); | 1351 layer->SetTransformOrigin(transform_origin); |
1317 layer->SetPosition(position); | 1352 layer->SetPosition(position); |
1318 layer->SetBounds(bounds); | 1353 layer->SetBounds(bounds); |
1319 layer->SetContentsOpaque(opaque); | 1354 layer->SetContentsOpaque(opaque); |
1320 } | 1355 } |
1321 | 1356 |
1357 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere. | |
1322 class LayerTreeHostTestAtomicCommitWithPartialUpdate | 1358 class LayerTreeHostTestAtomicCommitWithPartialUpdate |
1323 : public LayerTreeHostTest { | 1359 : public LayerTreeHostTest { |
1324 public: | 1360 public: |
1325 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 1361 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
1326 settings->texture_id_allocation_chunk_size = 1; | 1362 settings->texture_id_allocation_chunk_size = 1; |
1327 // Allow one partial texture update. | 1363 // Allow one partial texture update. |
1328 settings->max_partial_texture_updates = 1; | 1364 settings->max_partial_texture_updates = 1; |
1329 // No partial updates when impl side painting is enabled. | 1365 // No partial updates when impl side painting is enabled. |
1330 settings->impl_side_painting = false; | 1366 settings->impl_side_painting = false; |
1331 } | 1367 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1485 private: | 1521 private: |
1486 FakeContentLayerClient client_; | 1522 FakeContentLayerClient client_; |
1487 scoped_refptr<FakeContentLayer> parent_; | 1523 scoped_refptr<FakeContentLayer> parent_; |
1488 scoped_refptr<FakeContentLayer> child_; | 1524 scoped_refptr<FakeContentLayer> child_; |
1489 }; | 1525 }; |
1490 | 1526 |
1491 // Partial updates are not possible with a delegating renderer. | 1527 // Partial updates are not possible with a delegating renderer. |
1492 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1528 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
1493 LayerTreeHostTestAtomicCommitWithPartialUpdate); | 1529 LayerTreeHostTestAtomicCommitWithPartialUpdate); |
1494 | 1530 |
1495 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit | 1531 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit |
sohanjg
2014/09/15 10:38:39
Do we change this for impl-side? i think this deal
danakj
2014/09/15 15:23:43
This deals with surface memory management, which i
sohanjg
2014/09/17 07:27:43
Yes, right.
But, to make sure that no surface is
danakj
2014/09/19 18:12:01
It's true, but that's a no-op when implside is on,
| |
1496 : public LayerTreeHostTest { | 1532 : public LayerTreeHostTest { |
1497 protected: | 1533 protected: |
1498 virtual void SetupTree() OVERRIDE { | 1534 virtual void SetupTree() OVERRIDE { |
1499 root_layer_ = FakeContentLayer::Create(&client_); | 1535 root_layer_ = FakeContentLayer::Create(&client_); |
1500 root_layer_->SetBounds(gfx::Size(100, 100)); | 1536 root_layer_->SetBounds(gfx::Size(100, 100)); |
1501 | 1537 |
1502 surface_layer1_ = FakeContentLayer::Create(&client_); | 1538 surface_layer1_ = FakeContentLayer::Create(&client_); |
1503 surface_layer1_->SetBounds(gfx::Size(100, 100)); | 1539 surface_layer1_->SetBounds(gfx::Size(100, 100)); |
1504 surface_layer1_->SetForceRenderSurface(true); | 1540 surface_layer1_->SetForceRenderSurface(true); |
1505 surface_layer1_->SetOpacity(0.5f); | 1541 surface_layer1_->SetOpacity(0.5f); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1544 EXPECT_TRUE( | 1580 EXPECT_TRUE( |
1545 renderer->HasAllocatedResourcesForTesting(surface2_render_pass_id)); | 1581 renderer->HasAllocatedResourcesForTesting(surface2_render_pass_id)); |
1546 | 1582 |
1547 // Reduce the memory limit to only fit the root layer and one render | 1583 // Reduce the memory limit to only fit the root layer and one render |
1548 // surface. This prevents any contents drawing into surfaces | 1584 // surface. This prevents any contents drawing into surfaces |
1549 // from being allocated. | 1585 // from being allocated. |
1550 host_impl->SetMemoryPolicy(ManagedMemoryPolicy(100 * 100 * 4 * 2)); | 1586 host_impl->SetMemoryPolicy(ManagedMemoryPolicy(100 * 100 * 4 * 2)); |
1551 break; | 1587 break; |
1552 case 1: | 1588 case 1: |
1553 EXPECT_FALSE( | 1589 EXPECT_FALSE( |
1554 renderer->HasAllocatedResourcesForTesting(surface1_render_pass_id)); | 1590 renderer->HasAllocatedResourcesForTesting(surface1_render_pass_id)); |
sohanjg
2014/09/22 09:31:18
If we test this for impl-side paint, this resource
danakj
2014/09/22 14:48:21
Change the layers to not draw solid color, you can
sohanjg
2014/09/23 11:46:45
Even if we draw non solid color, the passes are st
sohanjg
2014/10/13 09:09:19
Can you please give your feedback on this ?
danakj
2014/10/14 18:10:21
OK I'm pretty confused what is different here in n
| |
1555 EXPECT_FALSE( | 1591 EXPECT_FALSE( |
1556 renderer->HasAllocatedResourcesForTesting(surface2_render_pass_id)); | 1592 renderer->HasAllocatedResourcesForTesting(surface2_render_pass_id)); |
1557 | 1593 |
1558 EndTest(); | 1594 EndTest(); |
1559 break; | 1595 break; |
1560 } | 1596 } |
1561 } | 1597 } |
1562 | 1598 |
1563 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1599 virtual void DidCommitAndDrawFrame() OVERRIDE { |
1564 if (layer_tree_host()->source_frame_number() < 2) | 1600 if (layer_tree_host()->source_frame_number() < 2) |
1565 root_layer_->SetNeedsDisplay(); | 1601 root_layer_->SetNeedsDisplay(); |
1566 } | 1602 } |
1567 | 1603 |
1568 virtual void AfterTest() OVERRIDE { | 1604 virtual void AfterTest() OVERRIDE { |
1569 EXPECT_LE(2u, root_layer_->update_count()); | 1605 EXPECT_LE(2u, root_layer_->update_count()); |
sohanjg
2014/09/22 09:31:19
update_count() is only present in Fake layers. If
danakj
2014/09/22 14:48:21
I don't understand the question. FakePictureLayer
sohanjg
2014/09/22 14:54:36
Let me rephrase it, if we make root/surface/replic
danakj
2014/09/22 14:58:45
Oh, then have a FakeContentLayer and a FakePicture
sohanjg
2014/09/23 11:46:45
Yea, if we make FakePictureLayer and FakeContentLa
| |
1570 EXPECT_LE(2u, surface_layer1_->update_count()); | 1606 EXPECT_LE(2u, surface_layer1_->update_count()); |
1571 EXPECT_LE(2u, surface_layer2_->update_count()); | 1607 EXPECT_LE(2u, surface_layer2_->update_count()); |
1572 } | 1608 } |
1573 | 1609 |
1574 FakeContentLayerClient client_; | 1610 FakeContentLayerClient client_; |
1575 scoped_refptr<FakeContentLayer> root_layer_; | 1611 scoped_refptr<FakeContentLayer> root_layer_; |
1576 scoped_refptr<FakeContentLayer> surface_layer1_; | 1612 scoped_refptr<FakeContentLayer> surface_layer1_; |
1577 scoped_refptr<FakeContentLayer> replica_layer1_; | 1613 scoped_refptr<FakeContentLayer> replica_layer1_; |
1578 scoped_refptr<FakeContentLayer> surface_layer2_; | 1614 scoped_refptr<FakeContentLayer> surface_layer2_; |
1579 scoped_refptr<FakeContentLayer> replica_layer2_; | 1615 scoped_refptr<FakeContentLayer> replica_layer2_; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1808 | 1844 |
1809 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { | 1845 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { |
1810 public: | 1846 public: |
1811 LayerTreeHostTestContinuousInvalidate() | 1847 LayerTreeHostTestContinuousInvalidate() |
1812 : num_commit_complete_(0), num_draw_layers_(0) {} | 1848 : num_commit_complete_(0), num_draw_layers_(0) {} |
1813 | 1849 |
1814 virtual void BeginTest() OVERRIDE { | 1850 virtual void BeginTest() OVERRIDE { |
1815 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); | 1851 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); |
1816 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); | 1852 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); |
1817 | 1853 |
1818 content_layer_ = ContentLayer::Create(&client_); | 1854 picture_layer_ = FakePictureLayer::Create(&client_); |
1819 content_layer_->SetBounds(gfx::Size(10, 10)); | 1855 picture_layer_->SetBounds(gfx::Size(10, 10)); |
1820 content_layer_->SetPosition(gfx::PointF(0.f, 0.f)); | 1856 picture_layer_->SetPosition(gfx::PointF(0.f, 0.f)); |
1821 content_layer_->SetIsDrawable(true); | 1857 picture_layer_->SetIsDrawable(true); |
1822 layer_tree_host()->root_layer()->AddChild(content_layer_); | 1858 layer_tree_host()->root_layer()->AddChild(picture_layer_); |
1823 | 1859 |
1824 PostSetNeedsCommitToMainThread(); | 1860 PostSetNeedsCommitToMainThread(); |
1825 } | 1861 } |
1826 | 1862 |
1827 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1863 virtual void DidCommitAndDrawFrame() OVERRIDE { |
1828 if (num_draw_layers_ == 2) | 1864 if (num_draw_layers_ == 2) |
1829 return; | 1865 return; |
1830 content_layer_->SetNeedsDisplay(); | 1866 picture_layer_->SetNeedsDisplay(); |
1831 } | 1867 } |
1832 | 1868 |
1833 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1869 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
1834 if (num_draw_layers_ == 1) | 1870 if (num_draw_layers_ == 1) |
1835 num_commit_complete_++; | 1871 num_commit_complete_++; |
1836 } | 1872 } |
1837 | 1873 |
1838 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1874 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
1839 num_draw_layers_++; | 1875 num_draw_layers_++; |
1840 if (num_draw_layers_ == 2) | 1876 if (num_draw_layers_ == 2) |
1841 EndTest(); | 1877 EndTest(); |
1842 } | 1878 } |
1843 | 1879 |
1844 virtual void AfterTest() OVERRIDE { | 1880 virtual void AfterTest() OVERRIDE { |
1845 // Check that we didn't commit twice between first and second draw. | 1881 // Check that we didn't commit twice between first and second draw. |
1846 EXPECT_EQ(1, num_commit_complete_); | 1882 EXPECT_EQ(1, num_commit_complete_); |
1847 } | 1883 } |
1848 | 1884 |
1849 private: | 1885 private: |
1850 FakeContentLayerClient client_; | 1886 FakeContentLayerClient client_; |
1851 scoped_refptr<Layer> content_layer_; | 1887 scoped_refptr<Layer> picture_layer_; |
1852 int num_commit_complete_; | 1888 int num_commit_complete_; |
1853 int num_draw_layers_; | 1889 int num_draw_layers_; |
1854 }; | 1890 }; |
1855 | 1891 |
1856 MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostTestContinuousInvalidate); | 1892 TEST_F(LayerTreeHostTestContinuousInvalidate, |
danakj
2014/09/19 18:12:01
you can just use IMPL instead of NOIMPL in this ma
sohanjg
2014/09/22 09:31:18
Done.
| |
1893 RunMultiThread_DirectRenderer_ImplSidePaint) { | |
1894 RunTest(true, false, true); | |
1895 } | |
1896 TEST_F(LayerTreeHostTestContinuousInvalidate, | |
1897 RunMultiThread_DelegatingRenderer_ImplSidePaint) { | |
1898 RunTest(true, true, true); | |
1899 } | |
1857 | 1900 |
1858 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { | 1901 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { |
1859 public: | 1902 public: |
1860 LayerTreeHostTestDeferCommits() | 1903 LayerTreeHostTestDeferCommits() |
1861 : num_commits_deferred_(0), num_complete_commits_(0) {} | 1904 : num_commits_deferred_(0), num_complete_commits_(0) {} |
1862 | 1905 |
1863 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 1906 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
1864 | 1907 |
1865 virtual void DidDeferCommit() OVERRIDE { | 1908 virtual void DidDeferCommit() OVERRIDE { |
1866 num_commits_deferred_++; | 1909 num_commits_deferred_++; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2036 LayerTreeHost::CreateSingleThreaded(&client, | 2079 LayerTreeHost::CreateSingleThreaded(&client, |
2037 &client, | 2080 &client, |
2038 shared_bitmap_manager.get(), | 2081 shared_bitmap_manager.get(), |
2039 settings, | 2082 settings, |
2040 base::MessageLoopProxy::current()); | 2083 base::MessageLoopProxy::current()); |
2041 host->Composite(base::TimeTicks::Now()); | 2084 host->Composite(base::TimeTicks::Now()); |
2042 | 2085 |
2043 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2086 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2044 } | 2087 } |
2045 | 2088 |
2046 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted | 2089 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted |
sohanjg
2014/09/15 10:38:39
Same, Do we change this for impl-side?
danakj
2014/09/15 15:23:43
This one I agree doesn't make sense with impl-side
danakj
2014/09/19 18:12:01
TODO to remove it.
sohanjg
2014/09/22 09:31:19
Done.
| |
2047 : public LayerTreeHostTest { | 2090 : public LayerTreeHostTest { |
2048 public: | 2091 public: |
2049 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() | 2092 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() |
2050 : root_layer_(FakeContentLayer::Create(&client_)), | 2093 : root_layer_(FakeContentLayer::Create(&client_)), |
2051 child_layer1_(FakeContentLayer::Create(&client_)), | 2094 child_layer1_(FakeContentLayer::Create(&client_)), |
2052 child_layer2_(FakeContentLayer::Create(&client_)), | 2095 child_layer2_(FakeContentLayer::Create(&client_)), |
2053 num_commits_(0) {} | 2096 num_commits_(0) {} |
2054 | 2097 |
2055 virtual void BeginTest() OVERRIDE { | 2098 virtual void BeginTest() OVERRIDE { |
2056 layer_tree_host()->SetViewportSize(gfx::Size(100, 100)); | 2099 layer_tree_host()->SetViewportSize(gfx::Size(100, 100)); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2397 | 2440 |
2398 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 2441 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } |
2399 | 2442 |
2400 private: | 2443 private: |
2401 Layer* layer_; | 2444 Layer* layer_; |
2402 }; | 2445 }; |
2403 | 2446 |
2404 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} | 2447 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} |
2405 | 2448 |
2406 virtual void SetupTree() OVERRIDE { | 2449 virtual void SetupTree() OVERRIDE { |
2407 scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); | 2450 scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); |
danakj
2014/09/19 18:12:01
missed this?
| |
2408 root_layer->SetIsDrawable(true); | 2451 root_layer->SetIsDrawable(true); |
2409 root_layer->SetBounds(gfx::Size(1, 1)); | 2452 root_layer->SetBounds(gfx::Size(1, 1)); |
2410 | 2453 |
2411 layer_tree_host()->SetRootLayer(root_layer); | 2454 layer_tree_host()->SetRootLayer(root_layer); |
2412 client_.set_layer(root_layer.get()); | 2455 client_.set_layer(root_layer.get()); |
2413 | 2456 |
2414 LayerTreeHostTest::SetupTree(); | 2457 LayerTreeHostTest::SetupTree(); |
2415 } | 2458 } |
2416 | 2459 |
2417 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 2460 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4351 output_surface->SetMemoryPolicyToSetAtBind( | 4394 output_surface->SetMemoryPolicyToSetAtBind( |
4352 make_scoped_ptr(new ManagedMemoryPolicy( | 4395 make_scoped_ptr(new ManagedMemoryPolicy( |
4353 second_context_provider_.get() ? second_output_surface_memory_limit_ | 4396 second_context_provider_.get() ? second_output_surface_memory_limit_ |
4354 : first_output_surface_memory_limit_, | 4397 : first_output_surface_memory_limit_, |
4355 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | 4398 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, |
4356 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); | 4399 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); |
4357 return output_surface.Pass(); | 4400 return output_surface.Pass(); |
4358 } | 4401 } |
4359 | 4402 |
4360 virtual void SetupTree() OVERRIDE { | 4403 virtual void SetupTree() OVERRIDE { |
4361 root_ = FakeContentLayer::Create(&client_); | 4404 root_ = FakePictureLayer::Create(&client_); |
4362 root_->SetBounds(gfx::Size(20, 20)); | 4405 root_->SetBounds(gfx::Size(20, 20)); |
4363 layer_tree_host()->SetRootLayer(root_); | 4406 layer_tree_host()->SetRootLayer(root_); |
4364 LayerTreeHostTest::SetupTree(); | 4407 LayerTreeHostTest::SetupTree(); |
4365 } | 4408 } |
4366 | 4409 |
4367 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 4410 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
4368 | 4411 |
4369 virtual void DidCommitAndDrawFrame() OVERRIDE { | 4412 virtual void DidCommitAndDrawFrame() OVERRIDE { |
4370 // Lost context sometimes takes two frames to recreate. The third frame | 4413 // Lost context sometimes takes two frames to recreate. The third frame |
4371 // is sometimes aborted, so wait until the fourth frame to verify that | 4414 // is sometimes aborted, so wait until the fourth frame to verify that |
(...skipping 22 matching lines...) Expand all Loading... | |
4394 } | 4437 } |
4395 } | 4438 } |
4396 | 4439 |
4397 virtual void AfterTest() OVERRIDE {} | 4440 virtual void AfterTest() OVERRIDE {} |
4398 | 4441 |
4399 scoped_refptr<TestContextProvider> first_context_provider_; | 4442 scoped_refptr<TestContextProvider> first_context_provider_; |
4400 scoped_refptr<TestContextProvider> second_context_provider_; | 4443 scoped_refptr<TestContextProvider> second_context_provider_; |
4401 size_t first_output_surface_memory_limit_; | 4444 size_t first_output_surface_memory_limit_; |
4402 size_t second_output_surface_memory_limit_; | 4445 size_t second_output_surface_memory_limit_; |
4403 FakeContentLayerClient client_; | 4446 FakeContentLayerClient client_; |
4404 scoped_refptr<FakeContentLayer> root_; | 4447 scoped_refptr<FakePictureLayer> root_; |
4405 }; | 4448 }; |
4406 | 4449 |
4407 // No output to copy for delegated renderers. | 4450 // No output to copy for delegated renderers. |
danakj
2014/09/19 18:12:01
this comment looks out of date, can you remove it?
| |
4408 SINGLE_AND_MULTI_THREAD_TEST_F( | 4451 TEST_F(LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface, |
danakj
2014/09/19 18:12:01
just put IMPL in this macro. you're missing some c
sohanjg
2014/09/22 09:31:19
Done.
| |
4409 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface); | 4452 RunMultiThread_DirectRenderer_ImplSidePaint) { |
4453 RunTest(true, false, true); | |
4454 } | |
4455 TEST_F(LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface, | |
4456 RunMultiThread_DelegatingRenderer_ImplSidePaint) { | |
4457 RunTest(true, true, true); | |
4458 } | |
4410 | 4459 |
4411 struct TestSwapPromiseResult { | 4460 struct TestSwapPromiseResult { |
4412 TestSwapPromiseResult() | 4461 TestSwapPromiseResult() |
4413 : did_swap_called(false), | 4462 : did_swap_called(false), |
4414 did_not_swap_called(false), | 4463 did_not_swap_called(false), |
4415 dtor_called(false), | 4464 dtor_called(false), |
4416 reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {} | 4465 reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {} |
4417 | 4466 |
4418 bool did_swap_called; | 4467 bool did_swap_called; |
4419 bool did_not_swap_called; | 4468 bool did_not_swap_called; |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5034 const gfx::Size bounds_; | 5083 const gfx::Size bounds_; |
5035 FakeContentLayerClient client_; | 5084 FakeContentLayerClient client_; |
5036 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5085 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
5037 scoped_refptr<FakePictureLayer> picture_layer_; | 5086 scoped_refptr<FakePictureLayer> picture_layer_; |
5038 Layer* child_layer_; | 5087 Layer* child_layer_; |
5039 }; | 5088 }; |
5040 | 5089 |
5041 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5090 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
5042 | 5091 |
5043 } // namespace cc | 5092 } // namespace cc |
OLD | NEW |