| 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/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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 base::Bind(&LayerTreeTest::DispatchSetNeedsUpdateLayers, | 422 base::Bind(&LayerTreeTest::DispatchSetNeedsUpdateLayers, |
| 423 main_thread_weak_ptr_)); | 423 main_thread_weak_ptr_)); |
| 424 } | 424 } |
| 425 | 425 |
| 426 void LayerTreeTest::PostReadbackToMainThread() { | 426 void LayerTreeTest::PostReadbackToMainThread() { |
| 427 main_task_runner_->PostTask( | 427 main_task_runner_->PostTask( |
| 428 FROM_HERE, | 428 FROM_HERE, |
| 429 base::Bind(&LayerTreeTest::DispatchReadback, main_thread_weak_ptr_)); | 429 base::Bind(&LayerTreeTest::DispatchReadback, main_thread_weak_ptr_)); |
| 430 } | 430 } |
| 431 | 431 |
| 432 void LayerTreeTest::PostAcquireLayerTextures() { | |
| 433 main_task_runner_->PostTask( | |
| 434 FROM_HERE, | |
| 435 base::Bind(&LayerTreeTest::DispatchAcquireLayerTextures, | |
| 436 main_thread_weak_ptr_)); | |
| 437 } | |
| 438 | |
| 439 void LayerTreeTest::PostSetNeedsRedrawToMainThread() { | 432 void LayerTreeTest::PostSetNeedsRedrawToMainThread() { |
| 440 main_task_runner_->PostTask(FROM_HERE, | 433 main_task_runner_->PostTask(FROM_HERE, |
| 441 base::Bind(&LayerTreeTest::DispatchSetNeedsRedraw, | 434 base::Bind(&LayerTreeTest::DispatchSetNeedsRedraw, |
| 442 main_thread_weak_ptr_)); | 435 main_thread_weak_ptr_)); |
| 443 } | 436 } |
| 444 | 437 |
| 445 void LayerTreeTest::PostSetNeedsRedrawRectToMainThread( | 438 void LayerTreeTest::PostSetNeedsRedrawRectToMainThread( |
| 446 const gfx::Rect& damage_rect) { | 439 const gfx::Rect& damage_rect) { |
| 447 main_task_runner_->PostTask( | 440 main_task_runner_->PostTask( |
| 448 FROM_HERE, | 441 FROM_HERE, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 | 556 |
| 564 void LayerTreeTest::DispatchReadback() { | 557 void LayerTreeTest::DispatchReadback() { |
| 565 DCHECK(!proxy() || proxy()->IsMainThread()); | 558 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 566 | 559 |
| 567 if (layer_tree_host_) { | 560 if (layer_tree_host_) { |
| 568 char pixels[4]; | 561 char pixels[4]; |
| 569 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); | 562 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); |
| 570 } | 563 } |
| 571 } | 564 } |
| 572 | 565 |
| 573 void LayerTreeTest::DispatchAcquireLayerTextures() { | |
| 574 DCHECK(!proxy() || proxy()->IsMainThread()); | |
| 575 | |
| 576 if (layer_tree_host_) | |
| 577 layer_tree_host_->AcquireLayerTextures(); | |
| 578 } | |
| 579 | |
| 580 void LayerTreeTest::DispatchSetNeedsRedraw() { | 566 void LayerTreeTest::DispatchSetNeedsRedraw() { |
| 581 DCHECK(!proxy() || proxy()->IsMainThread()); | 567 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 582 | 568 |
| 583 if (layer_tree_host_) | 569 if (layer_tree_host_) |
| 584 layer_tree_host_->SetNeedsRedraw(); | 570 layer_tree_host_->SetNeedsRedraw(); |
| 585 } | 571 } |
| 586 | 572 |
| 587 void LayerTreeTest::DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 573 void LayerTreeTest::DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
| 588 DCHECK(!proxy() || proxy()->IsMainThread()); | 574 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 589 | 575 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 return -1; | 705 return -1; |
| 720 } | 706 } |
| 721 | 707 |
| 722 void LayerTreeTest::DestroyLayerTreeHost() { | 708 void LayerTreeTest::DestroyLayerTreeHost() { |
| 723 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 709 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 724 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 710 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 725 layer_tree_host_.reset(); | 711 layer_tree_host_.reset(); |
| 726 } | 712 } |
| 727 | 713 |
| 728 } // namespace cc | 714 } // namespace cc |
| OLD | NEW |