Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: cc/trees/layer_tree_host_unittest_damage.cc

Issue 1801853002: Transfer LayerImpl ownership to LayerTreeImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more asan. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 EndTest(); 404 EndTest();
405 break; 405 break;
406 } 406 }
407 return draw_result; 407 return draw_result;
408 } 408 }
409 409
410 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { 410 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override {
411 ++did_swaps_; 411 ++did_swaps_;
412 EXPECT_TRUE(result); 412 EXPECT_TRUE(result);
413 LayerImpl* root = host_impl->active_tree()->root_layer(); 413 LayerImpl* root = host_impl->active_tree()->root_layer();
414 LayerImpl* scroll_clip_layer = root->children()[0].get(); 414 LayerImpl* scroll_clip_layer = root->children()[0];
415 LayerImpl* scroll_layer = scroll_clip_layer->children()[0].get(); 415 LayerImpl* scroll_layer = scroll_clip_layer->children()[0];
416 switch (did_swaps_) { 416 switch (did_swaps_) {
417 case 1: 417 case 1:
418 // Test that modifying the position of the content layer (not 418 // Test that modifying the position of the content layer (not
419 // scrolling) won't damage the scrollbar. 419 // scrolling) won't damage the scrollbar.
420 MainThreadTaskRunner()->PostTask( 420 MainThreadTaskRunner()->PostTask(
421 FROM_HERE, base::Bind(&LayerTreeHostDamageTestScrollbarDoesDamage:: 421 FROM_HERE, base::Bind(&LayerTreeHostDamageTestScrollbarDoesDamage::
422 ModifyContentLayerPosition, 422 ModifyContentLayerPosition,
423 base::Unretained(this))); 423 base::Unretained(this)));
424 break; 424 break;
425 case 2: 425 case 2:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 NOTREACHED(); 497 NOTREACHED();
498 break; 498 break;
499 } 499 }
500 return draw_result; 500 return draw_result;
501 } 501 }
502 502
503 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { 503 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override {
504 ++did_swaps_; 504 ++did_swaps_;
505 EXPECT_TRUE(result); 505 EXPECT_TRUE(result);
506 LayerImpl* root = host_impl->active_tree()->root_layer(); 506 LayerImpl* root = host_impl->active_tree()->root_layer();
507 LayerImpl* scroll_clip_layer = root->children()[0].get(); 507 LayerImpl* scroll_clip_layer = root->children()[0];
508 LayerImpl* scroll_layer = scroll_clip_layer->children()[0].get(); 508 LayerImpl* scroll_layer = scroll_clip_layer->children()[0];
509 switch (did_swaps_) { 509 switch (did_swaps_) {
510 case 1: 510 case 1:
511 // Scroll on the thread. This should damage the scrollbar for the 511 // Scroll on the thread. This should damage the scrollbar for the
512 // next draw on the thread. 512 // next draw on the thread.
513 scroll_layer->ScrollBy(gfx::Vector2dF(10.f, 10.f)); 513 scroll_layer->ScrollBy(gfx::Vector2dF(10.f, 10.f));
514 host_impl->SetNeedsRedraw(); 514 host_impl->SetNeedsRedraw();
515 break; 515 break;
516 case 2: 516 case 2:
517 // Forcibly send the scroll to the main thread. 517 // Forcibly send the scroll to the main thread.
518 PostSetNeedsCommitToMainThread(); 518 PostSetNeedsCommitToMainThread();
(...skipping 10 matching lines...) Expand all
529 529
530 void AfterTest() override { EXPECT_EQ(3, did_swaps_); } 530 void AfterTest() override { EXPECT_EQ(3, did_swaps_); }
531 531
532 int did_swaps_; 532 int did_swaps_;
533 }; 533 };
534 534
535 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage); 535 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage);
536 536
537 } // namespace 537 } // namespace
538 } // namespace cc 538 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_copyrequest.cc ('k') | cc/trees/layer_tree_host_unittest_occlusion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698