Chromium Code Reviews| Index: cc/test/layer_tree_test.cc |
| diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc |
| index e3dc1e1045c4e68fe2a4e0bee6283990f1a8569f..ed5cc0536924e8bac1a94d8c0d37b836d58aa9dd 100644 |
| --- a/cc/test/layer_tree_test.cc |
| +++ b/cc/test/layer_tree_test.cc |
| @@ -93,10 +93,12 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| LayerTreeHostImplClient* host_impl_client, |
| TaskRunnerProvider* task_runner_provider, |
| TaskGraphRunner* task_graph_runner, |
| - RenderingStatsInstrumentation* stats_instrumentation) { |
| + RenderingStatsInstrumentation* stats_instrumentation, |
| + scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner) { |
| return base::WrapUnique(new LayerTreeHostImplForTesting( |
| test_hooks, settings, host_impl_client, task_runner_provider, |
| - task_graph_runner, stats_instrumentation)); |
| + task_graph_runner, stats_instrumentation, |
| + std::move(image_worker_task_runner))); |
| } |
| protected: |
| @@ -106,7 +108,8 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| LayerTreeHostImplClient* host_impl_client, |
| TaskRunnerProvider* task_runner_provider, |
| TaskGraphRunner* task_graph_runner, |
| - RenderingStatsInstrumentation* stats_instrumentation) |
| + RenderingStatsInstrumentation* stats_instrumentation, |
| + scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner) |
| : LayerTreeHostImpl(settings, |
| host_impl_client, |
| task_runner_provider, |
| @@ -114,7 +117,7 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| task_graph_runner, |
| AnimationHost::CreateForTesting(ThreadInstance::IMPL), |
| 0, |
| - nullptr), |
| + std::move(image_worker_task_runner)), |
| test_hooks_(test_hooks), |
| block_notify_ready_to_activate_for_testing_(false), |
| notify_ready_to_activate_was_blocked_(false) {} |
| @@ -136,6 +139,11 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| test_hooks_->DidFinishImplFrameOnThread(this); |
| } |
| + void DidSendBeginMainFrameForTesting() override { |
| + LayerTreeHostImpl::DidSendBeginMainFrameForTesting(); |
| + test_hooks_->DidSendBeginMainFrameOnThread(this); |
| + } |
| + |
| void BeginMainFrameAborted( |
| CommitEarlyOutReason reason, |
| std::vector<std::unique_ptr<SwapPromise>> swap_promises) override { |
| @@ -208,6 +216,13 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| } |
| } |
| + void BlockImplSideInvalidationRequestsForTesting(bool block) override { |
| + block_impl_side_invalidation_ = block; |
| + if (!block_impl_side_invalidation_ && impl_side_invalidation_was_blocked_) { |
| + RequestImplSideInvalidation(); |
| + } |
| + } |
| + |
| void ActivateSyncTree() override { |
| test_hooks_->WillActivateTreeOnThread(this); |
| LayerTreeHostImpl::ActivateSyncTree(); |
| @@ -250,6 +265,22 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| test_hooks_->NotifyTileStateChangedOnThread(this, tile); |
| } |
| + void InvalidateContentOnImplSide() override { |
| + LayerTreeHostImpl::InvalidateContentOnImplSide(); |
| + test_hooks_->DidInvalidateContentOnImplSide(this); |
| + } |
| + |
| + void RequestImplSideInvalidation() override { |
| + if (block_impl_side_invalidation_) { |
| + impl_side_invalidation_was_blocked_ = true; |
| + return; |
| + } |
| + |
| + impl_side_invalidation_was_blocked_ = false; |
| + LayerTreeHostImpl::RequestImplSideInvalidation(); |
| + test_hooks_->DidRequestImplSideInvalidation(this); |
| + } |
| + |
| AnimationHost* animation_host() const { |
| return static_cast<AnimationHost*>(mutator_host()); |
| } |
| @@ -258,6 +289,9 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| TestHooks* test_hooks_; |
| bool block_notify_ready_to_activate_for_testing_; |
|
vmpstr
2017/02/27 21:16:57
while here, can you also initialize the rest of th
Khushal
2017/02/28 00:39:49
Done.
|
| bool notify_ready_to_activate_was_blocked_; |
| + |
| + bool block_impl_side_invalidation_ = false; |
| + bool impl_side_invalidation_was_blocked_ = false; |
| }; |
| // Implementation of LayerTreeHost callback interface. |
| @@ -342,12 +376,14 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
| const LayerTreeSettings& settings, |
| scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| + scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner, |
| MutatorHost* mutator_host) { |
| LayerTreeHost::InitParams params; |
| params.client = client; |
| params.task_graph_runner = task_graph_runner; |
| params.settings = &settings; |
| params.mutator_host = mutator_host; |
| + params.image_worker_task_runner = std::move(image_worker_task_runner); |
| std::unique_ptr<LayerTreeHostForTesting> layer_tree_host( |
| new LayerTreeHostForTesting(test_hooks, ¶ms, mode)); |
| @@ -377,7 +413,7 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
| LayerTreeHostImplForTesting::Create( |
| test_hooks_, GetSettings(), host_impl_client, |
| GetTaskRunnerProvider(), task_graph_runner(), |
| - rendering_stats_instrumentation()); |
| + rendering_stats_instrumentation(), image_worker_task_runner_); |
| input_handler_weak_ptr_ = host_impl->AsWeakPtr(); |
| return host_impl; |
| } |
| @@ -595,7 +631,8 @@ void LayerTreeTest::DoBeginTest() { |
| layer_tree_host_ = LayerTreeHostForTesting::Create( |
| this, mode_, client_.get(), client_.get(), task_graph_runner_.get(), |
| - settings_, main_task_runner, impl_task_runner, animation_host_.get()); |
| + settings_, main_task_runner, impl_task_runner, |
| + image_worker_->task_runner(), animation_host_.get()); |
| ASSERT_TRUE(layer_tree_host_); |
| main_task_runner_ = |
| @@ -741,6 +778,9 @@ void LayerTreeTest::RunTest(CompositorMode mode) { |
| ASSERT_TRUE(impl_thread_->Start()); |
| } |
| + image_worker_ = base::MakeUnique<base::Thread>("ImageWorker"); |
| + ASSERT_TRUE(image_worker_->Start()); |
| + |
| shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
| gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
| task_graph_runner_.reset(new TestTaskGraphRunner); |