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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 EndTest(); | 403 EndTest(); |
404 break; | 404 break; |
405 } | 405 } |
406 return draw_result; | 406 return draw_result; |
407 } | 407 } |
408 | 408 |
409 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { | 409 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { |
410 ++did_swaps_; | 410 ++did_swaps_; |
411 EXPECT_TRUE(result); | 411 EXPECT_TRUE(result); |
412 LayerImpl* root = host_impl->active_tree()->root_layer(); | 412 LayerImpl* root = host_impl->active_tree()->root_layer(); |
413 LayerImpl* scroll_clip_layer = root->children()[0]; | 413 LayerImpl* scroll_clip_layer = root->children()[0].get(); |
414 LayerImpl* scroll_layer = scroll_clip_layer->children()[0]; | 414 LayerImpl* scroll_layer = scroll_clip_layer->children()[0].get(); |
415 switch (did_swaps_) { | 415 switch (did_swaps_) { |
416 case 1: | 416 case 1: |
417 // Test that modifying the position of the content layer (not | 417 // Test that modifying the position of the content layer (not |
418 // scrolling) won't damage the scrollbar. | 418 // scrolling) won't damage the scrollbar. |
419 MainThreadTaskRunner()->PostTask( | 419 MainThreadTaskRunner()->PostTask( |
420 FROM_HERE, base::Bind(&LayerTreeHostDamageTestScrollbarDoesDamage:: | 420 FROM_HERE, base::Bind(&LayerTreeHostDamageTestScrollbarDoesDamage:: |
421 ModifyContentLayerPosition, | 421 ModifyContentLayerPosition, |
422 base::Unretained(this))); | 422 base::Unretained(this))); |
423 break; | 423 break; |
424 case 2: | 424 case 2: |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 NOTREACHED(); | 496 NOTREACHED(); |
497 break; | 497 break; |
498 } | 498 } |
499 return draw_result; | 499 return draw_result; |
500 } | 500 } |
501 | 501 |
502 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { | 502 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { |
503 ++did_swaps_; | 503 ++did_swaps_; |
504 EXPECT_TRUE(result); | 504 EXPECT_TRUE(result); |
505 LayerImpl* root = host_impl->active_tree()->root_layer(); | 505 LayerImpl* root = host_impl->active_tree()->root_layer(); |
506 LayerImpl* scroll_clip_layer = root->children()[0]; | 506 LayerImpl* scroll_clip_layer = root->children()[0].get(); |
507 LayerImpl* scroll_layer = scroll_clip_layer->children()[0]; | 507 LayerImpl* scroll_layer = scroll_clip_layer->children()[0].get(); |
508 switch (did_swaps_) { | 508 switch (did_swaps_) { |
509 case 1: | 509 case 1: |
510 // Scroll on the thread. This should damage the scrollbar for the | 510 // Scroll on the thread. This should damage the scrollbar for the |
511 // next draw on the thread. | 511 // next draw on the thread. |
512 scroll_layer->ScrollBy(gfx::Vector2dF(10.f, 10.f)); | 512 scroll_layer->ScrollBy(gfx::Vector2dF(10.f, 10.f)); |
513 host_impl->SetNeedsRedraw(); | 513 host_impl->SetNeedsRedraw(); |
514 break; | 514 break; |
515 case 2: | 515 case 2: |
516 // Forcibly send the scroll to the main thread. | 516 // Forcibly send the scroll to the main thread. |
517 PostSetNeedsCommitToMainThread(); | 517 PostSetNeedsCommitToMainThread(); |
(...skipping 10 matching lines...) Expand all Loading... |
528 | 528 |
529 void AfterTest() override { EXPECT_EQ(3, did_swaps_); } | 529 void AfterTest() override { EXPECT_EQ(3, did_swaps_); } |
530 | 530 |
531 int did_swaps_; | 531 int did_swaps_; |
532 }; | 532 }; |
533 | 533 |
534 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage); | 534 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage); |
535 | 535 |
536 } // namespace | 536 } // namespace |
537 } // namespace cc | 537 } // namespace cc |
OLD | NEW |