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

Side by Side Diff: cc/test/layer_tree_test.cc

Issue 73343002: De-activate LayerAnimationControllers when all animations are WaitingForDeletion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TickAnimationWhileBackgrounded flake Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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/test/layer_tree_test.h" 5 #include "cc/test/layer_tree_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "cc/animation/animation.h" 8 #include "cc/animation/animation.h"
9 #include "cc/animation/animation_registrar.h" 9 #include "cc/animation/animation_registrar.h"
10 #include "cc/animation/layer_animation_controller.h" 10 #include "cc/animation/layer_animation_controller.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 main_task_runner_->PostTask( 368 main_task_runner_->PostTask(
369 FROM_HERE, base::Bind(&LayerTreeTest::EndTest, main_thread_weak_ptr_)); 369 FROM_HERE, base::Bind(&LayerTreeTest::EndTest, main_thread_weak_ptr_));
370 } 370 }
371 371
372 void LayerTreeTest::PostAddAnimationToMainThread( 372 void LayerTreeTest::PostAddAnimationToMainThread(
373 Layer* layer_to_receive_animation) { 373 Layer* layer_to_receive_animation) {
374 main_task_runner_->PostTask( 374 main_task_runner_->PostTask(
375 FROM_HERE, 375 FROM_HERE,
376 base::Bind(&LayerTreeTest::DispatchAddAnimation, 376 base::Bind(&LayerTreeTest::DispatchAddAnimation,
377 main_thread_weak_ptr_, 377 main_thread_weak_ptr_,
378 base::Unretained(layer_to_receive_animation))); 378 base::Unretained(layer_to_receive_animation),
379 0.000001));
379 } 380 }
380 381
381 void LayerTreeTest::PostAddInstantAnimationToMainThread( 382 void LayerTreeTest::PostAddInstantAnimationToMainThread(
382 Layer* layer_to_receive_animation) { 383 Layer* layer_to_receive_animation) {
383 main_task_runner_->PostTask( 384 main_task_runner_->PostTask(
384 FROM_HERE, 385 FROM_HERE,
385 base::Bind(&LayerTreeTest::DispatchAddInstantAnimation, 386 base::Bind(&LayerTreeTest::DispatchAddAnimation,
386 main_thread_weak_ptr_, 387 main_thread_weak_ptr_,
387 base::Unretained(layer_to_receive_animation))); 388 base::Unretained(layer_to_receive_animation),
389 0.0));
390 }
391
392 void LayerTreeTest::PostAddLongAnimationToMainThread(
393 Layer* layer_to_receive_animation) {
394 main_task_runner_->PostTask(
395 FROM_HERE,
396 base::Bind(&LayerTreeTest::DispatchAddAnimation,
397 main_thread_weak_ptr_,
398 base::Unretained(layer_to_receive_animation),
399 1.0));
388 } 400 }
389 401
390 void LayerTreeTest::PostSetNeedsCommitToMainThread() { 402 void LayerTreeTest::PostSetNeedsCommitToMainThread() {
391 main_task_runner_->PostTask(FROM_HERE, 403 main_task_runner_->PostTask(FROM_HERE,
392 base::Bind(&LayerTreeTest::DispatchSetNeedsCommit, 404 base::Bind(&LayerTreeTest::DispatchSetNeedsCommit,
393 main_thread_weak_ptr_)); 405 main_thread_weak_ptr_));
394 } 406 }
395 407
396 void LayerTreeTest::PostReadbackToMainThread() { 408 void LayerTreeTest::PostReadbackToMainThread() {
397 main_task_runner_->PostTask( 409 main_task_runner_->PostTask(
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (layer_tree_host_ && proxy()->CommitPendingForTesting()) { 507 if (layer_tree_host_ && proxy()->CommitPendingForTesting()) {
496 main_task_runner_->PostTask( 508 main_task_runner_->PostTask(
497 FROM_HERE, 509 FROM_HERE,
498 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); 510 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_));
499 return; 511 return;
500 } 512 }
501 513
502 base::MessageLoop::current()->Quit(); 514 base::MessageLoop::current()->Quit();
503 } 515 }
504 516
505 void LayerTreeTest::DispatchAddInstantAnimation( 517 void LayerTreeTest::DispatchAddAnimation(Layer* layer_to_receive_animation,
506 Layer* layer_to_receive_animation) { 518 double animation_duration) {
507 DCHECK(!proxy() || proxy()->IsMainThread()); 519 DCHECK(!proxy() || proxy()->IsMainThread());
508 520
509 if (layer_to_receive_animation) { 521 if (layer_to_receive_animation) {
510 AddOpacityTransitionToLayer(layer_to_receive_animation, 522 AddOpacityTransitionToLayer(layer_to_receive_animation,
511 0, 523 animation_duration,
512 0,
513 0.5,
514 false);
515 }
516 }
517
518 void LayerTreeTest::DispatchAddAnimation(Layer* layer_to_receive_animation) {
519 DCHECK(!proxy() || proxy()->IsMainThread());
520
521 if (layer_to_receive_animation) {
522 AddOpacityTransitionToLayer(layer_to_receive_animation,
523 0.000001,
524 0, 524 0,
525 0.5, 525 0.5,
526 true); 526 true);
527 } 527 }
528 } 528 }
529 529
530 void LayerTreeTest::DispatchSetNeedsCommit() { 530 void LayerTreeTest::DispatchSetNeedsCommit() {
531 DCHECK(!proxy() || proxy()->IsMainThread()); 531 DCHECK(!proxy() || proxy()->IsMainThread());
532 532
533 if (layer_tree_host_) 533 if (layer_tree_host_)
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 } 668 }
669 669
670 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { 670 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() {
671 if (!compositor_contexts_.get() || 671 if (!compositor_contexts_.get() ||
672 compositor_contexts_->DestroyedOnMainThread()) 672 compositor_contexts_->DestroyedOnMainThread())
673 compositor_contexts_ = TestContextProvider::Create(); 673 compositor_contexts_ = TestContextProvider::Create();
674 return compositor_contexts_; 674 return compositor_contexts_;
675 } 675 }
676 676
677 } // namespace cc 677 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698