| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 base::Unretained(layer_to_receive_animation), | 402 base::Unretained(layer_to_receive_animation), |
| 403 1.0)); | 403 1.0)); |
| 404 } | 404 } |
| 405 | 405 |
| 406 void LayerTreeTest::PostSetNeedsCommitToMainThread() { | 406 void LayerTreeTest::PostSetNeedsCommitToMainThread() { |
| 407 main_task_runner_->PostTask(FROM_HERE, | 407 main_task_runner_->PostTask(FROM_HERE, |
| 408 base::Bind(&LayerTreeTest::DispatchSetNeedsCommit, | 408 base::Bind(&LayerTreeTest::DispatchSetNeedsCommit, |
| 409 main_thread_weak_ptr_)); | 409 main_thread_weak_ptr_)); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void LayerTreeTest::PostSetNeedsUpdateLayersToMainThread() { |
| 413 main_task_runner_->PostTask( |
| 414 FROM_HERE, |
| 415 base::Bind(&LayerTreeTest::DispatchSetNeedsUpdateLayers, |
| 416 main_thread_weak_ptr_)); |
| 417 } |
| 418 |
| 412 void LayerTreeTest::PostReadbackToMainThread() { | 419 void LayerTreeTest::PostReadbackToMainThread() { |
| 413 main_task_runner_->PostTask( | 420 main_task_runner_->PostTask( |
| 414 FROM_HERE, | 421 FROM_HERE, |
| 415 base::Bind(&LayerTreeTest::DispatchReadback, main_thread_weak_ptr_)); | 422 base::Bind(&LayerTreeTest::DispatchReadback, main_thread_weak_ptr_)); |
| 416 } | 423 } |
| 417 | 424 |
| 418 void LayerTreeTest::PostAcquireLayerTextures() { | 425 void LayerTreeTest::PostAcquireLayerTextures() { |
| 419 main_task_runner_->PostTask( | 426 main_task_runner_->PostTask( |
| 420 FROM_HERE, | 427 FROM_HERE, |
| 421 base::Bind(&LayerTreeTest::DispatchAcquireLayerTextures, | 428 base::Bind(&LayerTreeTest::DispatchAcquireLayerTextures, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 538 } |
| 532 } | 539 } |
| 533 | 540 |
| 534 void LayerTreeTest::DispatchSetNeedsCommit() { | 541 void LayerTreeTest::DispatchSetNeedsCommit() { |
| 535 DCHECK(!proxy() || proxy()->IsMainThread()); | 542 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 536 | 543 |
| 537 if (layer_tree_host_) | 544 if (layer_tree_host_) |
| 538 layer_tree_host_->SetNeedsCommit(); | 545 layer_tree_host_->SetNeedsCommit(); |
| 539 } | 546 } |
| 540 | 547 |
| 548 void LayerTreeTest::DispatchSetNeedsUpdateLayers() { |
| 549 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 550 |
| 551 if (layer_tree_host_) |
| 552 layer_tree_host_->SetNeedsUpdateLayers(); |
| 553 } |
| 554 |
| 541 void LayerTreeTest::DispatchReadback() { | 555 void LayerTreeTest::DispatchReadback() { |
| 542 DCHECK(!proxy() || proxy()->IsMainThread()); | 556 DCHECK(!proxy() || proxy()->IsMainThread()); |
| 543 | 557 |
| 544 if (layer_tree_host_) { | 558 if (layer_tree_host_) { |
| 545 char pixels[4]; | 559 char pixels[4]; |
| 546 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); | 560 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); |
| 547 } | 561 } |
| 548 } | 562 } |
| 549 | 563 |
| 550 void LayerTreeTest::DispatchAcquireLayerTextures() { | 564 void LayerTreeTest::DispatchAcquireLayerTextures() { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 } | 686 } |
| 673 | 687 |
| 674 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { | 688 scoped_refptr<ContextProvider> LayerTreeTest::OffscreenContextProvider() { |
| 675 if (!compositor_contexts_.get() || | 689 if (!compositor_contexts_.get() || |
| 676 compositor_contexts_->DestroyedOnMainThread()) | 690 compositor_contexts_->DestroyedOnMainThread()) |
| 677 compositor_contexts_ = TestContextProvider::Create(); | 691 compositor_contexts_ = TestContextProvider::Create(); |
| 678 return compositor_contexts_; | 692 return compositor_contexts_; |
| 679 } | 693 } |
| 680 | 694 |
| 681 } // namespace cc | 695 } // namespace cc |
| OLD | NEW |