| 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 23 matching lines...) Expand all Loading... |
| 34 bool TestHooks::PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 34 bool TestHooks::PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 35 LayerTreeHostImpl::FrameData* frame_data, | 35 LayerTreeHostImpl::FrameData* frame_data, |
| 36 bool result) { | 36 bool result) { |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool TestHooks::CanActivatePendingTree(LayerTreeHostImpl* host_impl) { | 40 bool TestHooks::CanActivatePendingTree(LayerTreeHostImpl* host_impl) { |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool TestHooks::CanActivatePendingTreeIfNeeded(LayerTreeHostImpl* host_impl) { |
| 45 return true; |
| 46 } |
| 47 |
| 44 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 48 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| 45 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { | 49 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| 46 public: | 50 public: |
| 47 static scoped_ptr<LayerTreeHostImplForTesting> Create( | 51 static scoped_ptr<LayerTreeHostImplForTesting> Create( |
| 48 TestHooks* test_hooks, | 52 TestHooks* test_hooks, |
| 49 const LayerTreeSettings& settings, | 53 const LayerTreeSettings& settings, |
| 50 LayerTreeHostImplClient* host_impl_client, | 54 LayerTreeHostImplClient* host_impl_client, |
| 51 Proxy* proxy, | 55 Proxy* proxy, |
| 52 RenderingStatsInstrumentation* stats_instrumentation) { | 56 RenderingStatsInstrumentation* stats_instrumentation) { |
| 53 return make_scoped_ptr( | 57 return make_scoped_ptr( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 111 |
| 108 virtual void OnSwapBuffersComplete(const CompositorFrameAck* ack) OVERRIDE { | 112 virtual void OnSwapBuffersComplete(const CompositorFrameAck* ack) OVERRIDE { |
| 109 LayerTreeHostImpl::OnSwapBuffersComplete(ack); | 113 LayerTreeHostImpl::OnSwapBuffersComplete(ack); |
| 110 test_hooks_->SwapBuffersCompleteOnThread(this); | 114 test_hooks_->SwapBuffersCompleteOnThread(this); |
| 111 } | 115 } |
| 112 | 116 |
| 113 virtual void ActivatePendingTreeIfNeeded() OVERRIDE { | 117 virtual void ActivatePendingTreeIfNeeded() OVERRIDE { |
| 114 if (!pending_tree()) | 118 if (!pending_tree()) |
| 115 return; | 119 return; |
| 116 | 120 |
| 117 if (!test_hooks_->CanActivatePendingTree(this)) | 121 if (!test_hooks_->CanActivatePendingTreeIfNeeded(this)) |
| 118 return; | 122 return; |
| 119 | 123 |
| 120 LayerTreeHostImpl::ActivatePendingTreeIfNeeded(); | 124 LayerTreeHostImpl::ActivatePendingTreeIfNeeded(); |
| 121 } | 125 } |
| 122 | 126 |
| 123 virtual void ActivatePendingTree() OVERRIDE { | 127 virtual void ActivatePendingTree() OVERRIDE { |
| 124 if (!test_hooks_->CanActivatePendingTree(this)) | 128 if (!test_hooks_->CanActivatePendingTree(this)) |
| 125 return; | 129 return; |
| 126 | 130 |
| 127 test_hooks_->WillActivateTreeOnThread(this); | 131 test_hooks_->WillActivateTreeOnThread(this); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 625 |
| 622 scoped_refptr<cc::ContextProvider> LayerTreeTest:: | 626 scoped_refptr<cc::ContextProvider> LayerTreeTest:: |
| 623 OffscreenContextProviderForCompositorThread() { | 627 OffscreenContextProviderForCompositorThread() { |
| 624 if (!compositor_thread_contexts_.get() || | 628 if (!compositor_thread_contexts_.get() || |
| 625 compositor_thread_contexts_->DestroyedOnMainThread()) | 629 compositor_thread_contexts_->DestroyedOnMainThread()) |
| 626 compositor_thread_contexts_ = FakeContextProvider::Create(); | 630 compositor_thread_contexts_ = FakeContextProvider::Create(); |
| 627 return compositor_thread_contexts_; | 631 return compositor_thread_contexts_; |
| 628 } | 632 } |
| 629 | 633 |
| 630 } // namespace cc | 634 } // namespace cc |
| OLD | NEW |