| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/picture_layer.h" | 5 #include "cc/layers/picture_layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 // The important two lines are the following: | 96 // The important two lines are the following: |
| 97 layer->SetNeedsDisplayRect(invalidation_bounds); | 97 layer->SetNeedsDisplayRect(invalidation_bounds); |
| 98 layer->Update(); | 98 layer->Update(); |
| 99 | 99 |
| 100 host->CommitComplete(); | 100 host->CommitComplete(); |
| 101 FakeImplTaskRunnerProvider impl_task_runner_provider; | 101 FakeImplTaskRunnerProvider impl_task_runner_provider; |
| 102 std::unique_ptr<CompositorFrameSink> compositor_frame_sink( | 102 std::unique_ptr<CompositorFrameSink> compositor_frame_sink( |
| 103 FakeCompositorFrameSink::Create3d()); | 103 FakeCompositorFrameSink::Create3d()); |
| 104 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); | 104 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); |
| 105 layer_tree_settings.image_decode_tasks_enabled = true; | |
| 106 FakeLayerTreeHostImpl host_impl( | 105 FakeLayerTreeHostImpl host_impl( |
| 107 layer_tree_settings, &impl_task_runner_provider, &task_graph_runner); | 106 layer_tree_settings, &impl_task_runner_provider, &task_graph_runner); |
| 108 host_impl.SetVisible(true); | 107 host_impl.SetVisible(true); |
| 109 host_impl.InitializeRenderer(compositor_frame_sink.get()); | 108 host_impl.InitializeRenderer(compositor_frame_sink.get()); |
| 110 host_impl.CreatePendingTree(); | 109 host_impl.CreatePendingTree(); |
| 111 host_impl.pending_tree()->SetRootLayerForTesting( | 110 host_impl.pending_tree()->SetRootLayerForTesting( |
| 112 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); | 111 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); |
| 113 host_impl.pending_tree()->BuildLayerListForTesting(); | 112 host_impl.pending_tree()->BuildLayerListForTesting(); |
| 114 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( | 113 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( |
| 115 host_impl.pending_tree()->root_layer_for_testing()); | 114 host_impl.pending_tree()->root_layer_for_testing()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 138 gfx::Rect invalidation_bounds(layer_size); | 137 gfx::Rect invalidation_bounds(layer_size); |
| 139 | 138 |
| 140 // The important line is the following (note that we do not call Update): | 139 // The important line is the following (note that we do not call Update): |
| 141 layer->SetNeedsDisplayRect(invalidation_bounds); | 140 layer->SetNeedsDisplayRect(invalidation_bounds); |
| 142 | 141 |
| 143 host->CommitComplete(); | 142 host->CommitComplete(); |
| 144 FakeImplTaskRunnerProvider impl_task_runner_provider; | 143 FakeImplTaskRunnerProvider impl_task_runner_provider; |
| 145 std::unique_ptr<CompositorFrameSink> compositor_frame_sink( | 144 std::unique_ptr<CompositorFrameSink> compositor_frame_sink( |
| 146 FakeCompositorFrameSink::Create3d()); | 145 FakeCompositorFrameSink::Create3d()); |
| 147 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); | 146 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); |
| 148 layer_tree_settings.image_decode_tasks_enabled = true; | |
| 149 FakeLayerTreeHostImpl host_impl( | 147 FakeLayerTreeHostImpl host_impl( |
| 150 layer_tree_settings, &impl_task_runner_provider, &task_graph_runner); | 148 layer_tree_settings, &impl_task_runner_provider, &task_graph_runner); |
| 151 host_impl.SetVisible(true); | 149 host_impl.SetVisible(true); |
| 152 host_impl.InitializeRenderer(compositor_frame_sink.get()); | 150 host_impl.InitializeRenderer(compositor_frame_sink.get()); |
| 153 host_impl.CreatePendingTree(); | 151 host_impl.CreatePendingTree(); |
| 154 host_impl.pending_tree()->SetRootLayerForTesting( | 152 host_impl.pending_tree()->SetRootLayerForTesting( |
| 155 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); | 153 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); |
| 156 host_impl.pending_tree()->BuildLayerListForTesting(); | 154 host_impl.pending_tree()->BuildLayerListForTesting(); |
| 157 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( | 155 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( |
| 158 host_impl.pending_tree()->root_layer_for_testing()); | 156 host_impl.pending_tree()->root_layer_for_testing()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 185 EXPECT_EQ(1, host->SourceFrameNumber()); | 183 EXPECT_EQ(1, host->SourceFrameNumber()); |
| 186 | 184 |
| 187 layer->SavePaintProperties(); | 185 layer->SavePaintProperties(); |
| 188 layer->Update(); | 186 layer->Update(); |
| 189 | 187 |
| 190 FakeImplTaskRunnerProvider impl_task_runner_provider; | 188 FakeImplTaskRunnerProvider impl_task_runner_provider; |
| 191 | 189 |
| 192 std::unique_ptr<CompositorFrameSink> compositor_frame_sink( | 190 std::unique_ptr<CompositorFrameSink> compositor_frame_sink( |
| 193 FakeCompositorFrameSink::Create3d()); | 191 FakeCompositorFrameSink::Create3d()); |
| 194 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); | 192 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); |
| 195 layer_tree_settings.image_decode_tasks_enabled = true; | |
| 196 FakeLayerTreeHostImpl host_impl( | 193 FakeLayerTreeHostImpl host_impl( |
| 197 layer_tree_settings, &impl_task_runner_provider, &task_graph_runner); | 194 layer_tree_settings, &impl_task_runner_provider, &task_graph_runner); |
| 198 host_impl.SetVisible(true); | 195 host_impl.SetVisible(true); |
| 199 EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); | 196 EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); |
| 200 | 197 |
| 201 host_impl.CreatePendingTree(); | 198 host_impl.CreatePendingTree(); |
| 202 host_impl.pending_tree()->SetRootLayerForTesting( | 199 host_impl.pending_tree()->SetRootLayerForTesting( |
| 203 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); | 200 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); |
| 204 host_impl.pending_tree()->BuildLayerListForTesting(); | 201 host_impl.pending_tree()->BuildLayerListForTesting(); |
| 205 | 202 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 host2->Composite(base::TimeTicks::Now()); | 352 host2->Composite(base::TimeTicks::Now()); |
| 356 EXPECT_EQ(3, layer->update_count()); | 353 EXPECT_EQ(3, layer->update_count()); |
| 357 EXPECT_EQ(1, host2->SourceFrameNumber()); | 354 EXPECT_EQ(1, host2->SourceFrameNumber()); |
| 358 | 355 |
| 359 animation_host->SetMutatorHostClient(nullptr); | 356 animation_host->SetMutatorHostClient(nullptr); |
| 360 animation_host2->SetMutatorHostClient(nullptr); | 357 animation_host2->SetMutatorHostClient(nullptr); |
| 361 } | 358 } |
| 362 | 359 |
| 363 } // namespace | 360 } // namespace |
| 364 } // namespace cc | 361 } // namespace cc |
| OLD | NEW |