| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 virtual ~ThreadProxyForTest() {} | 63 virtual ~ThreadProxyForTest() {} |
| 64 | 64 |
| 65 void test() { | 65 void test() { |
| 66 test_hooks_->Layout(); | 66 test_hooks_->Layout(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 TestHooks* test_hooks_; | 70 TestHooks* test_hooks_; |
| 71 | 71 |
| 72 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE { | |
| 73 ThreadProxy::ScheduledActionBeginOutputSurfaceCreation(); | |
| 74 test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); | |
| 75 } | |
| 76 | |
| 77 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE { | 72 virtual void ScheduledActionSendBeginMainFrame() OVERRIDE { |
| 78 test_hooks_->ScheduledActionWillSendBeginMainFrame(); | 73 test_hooks_->ScheduledActionWillSendBeginMainFrame(); |
| 79 ThreadProxy::ScheduledActionSendBeginMainFrame(); | 74 ThreadProxy::ScheduledActionSendBeginMainFrame(); |
| 80 test_hooks_->ScheduledActionSendBeginMainFrame(); | 75 test_hooks_->ScheduledActionSendBeginMainFrame(); |
| 81 } | 76 } |
| 82 | 77 |
| 83 virtual void ScheduledActionCommit() OVERRIDE { | |
| 84 ThreadProxy::ScheduledActionCommit(); | |
| 85 test_hooks_->ScheduledActionCommit(); | |
| 86 } | |
| 87 | |
| 88 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() OVERRIDE { | 78 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() OVERRIDE { |
| 89 DrawResult result = ThreadProxy::ScheduledActionDrawAndSwapIfPossible(); | 79 DrawResult result = ThreadProxy::ScheduledActionDrawAndSwapIfPossible(); |
| 90 test_hooks_->ScheduledActionDrawAndSwapIfPossible(); | 80 test_hooks_->ScheduledActionDrawAndSwapIfPossible(); |
| 91 return result; | 81 return result; |
| 92 } | 82 } |
| 93 | 83 |
| 84 virtual void ScheduledActionAnimate() OVERRIDE { |
| 85 ThreadProxy::ScheduledActionAnimate(); |
| 86 test_hooks_->ScheduledActionAnimate(); |
| 87 } |
| 88 |
| 89 virtual void ScheduledActionCommit() OVERRIDE { |
| 90 ThreadProxy::ScheduledActionCommit(); |
| 91 test_hooks_->ScheduledActionCommit(); |
| 92 } |
| 93 |
| 94 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE { |
| 95 ThreadProxy::ScheduledActionBeginOutputSurfaceCreation(); |
| 96 test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); |
| 97 } |
| 98 |
| 94 ThreadProxyForTest( | 99 ThreadProxyForTest( |
| 95 TestHooks* test_hooks, | 100 TestHooks* test_hooks, |
| 96 LayerTreeHost* host, | 101 LayerTreeHost* host, |
| 97 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | 102 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
| 98 : ThreadProxy(host, impl_task_runner), | 103 : ThreadProxy(host, impl_task_runner), |
| 99 test_hooks_(test_hooks) { | 104 test_hooks_(test_hooks) { |
| 100 } | 105 } |
| 101 }; | 106 }; |
| 102 | 107 |
| 103 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 108 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 return -1; | 742 return -1; |
| 738 } | 743 } |
| 739 | 744 |
| 740 void LayerTreeTest::DestroyLayerTreeHost() { | 745 void LayerTreeTest::DestroyLayerTreeHost() { |
| 741 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 746 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 742 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 747 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 743 layer_tree_host_.reset(); | 748 layer_tree_host_.reset(); |
| 744 } | 749 } |
| 745 | 750 |
| 746 } // namespace cc | 751 } // namespace cc |
| OLD | NEW |