| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 StubLayerTreeHostSingleThreadClient single_thread_client; | 295 StubLayerTreeHostSingleThreadClient single_thread_client; |
| 296 FakeLayerTreeHostClient host_client1; | 296 FakeLayerTreeHostClient host_client1; |
| 297 FakeLayerTreeHostClient host_client2; | 297 FakeLayerTreeHostClient host_client2; |
| 298 TestTaskGraphRunner task_graph_runner; | 298 TestTaskGraphRunner task_graph_runner; |
| 299 | 299 |
| 300 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); | 300 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); |
| 301 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client); | 301 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client); |
| 302 | 302 |
| 303 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 303 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 304 | 304 |
| 305 LayerTreeHostInProcess::InitParams params; | 305 LayerTreeHost::InitParams params; |
| 306 params.client = &host_client1; | 306 params.client = &host_client1; |
| 307 params.settings = &settings; | 307 params.settings = &settings; |
| 308 params.task_graph_runner = &task_graph_runner; | 308 params.task_graph_runner = &task_graph_runner; |
| 309 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 309 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 310 params.mutator_host = animation_host.get(); | 310 params.mutator_host = animation_host.get(); |
| 311 std::unique_ptr<LayerTreeHost> host1 = | 311 std::unique_ptr<LayerTreeHost> host1 = |
| 312 LayerTreeHostInProcess::CreateSingleThreaded(&single_thread_client, | 312 LayerTreeHost::CreateSingleThreaded(&single_thread_client, ¶ms); |
| 313 ¶ms); | |
| 314 host1->SetVisible(true); | 313 host1->SetVisible(true); |
| 315 host_client1.SetLayerTreeHost(host1.get()); | 314 host_client1.SetLayerTreeHost(host1.get()); |
| 316 | 315 |
| 317 auto animation_host2 = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 316 auto animation_host2 = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 318 | 317 |
| 319 // TODO(sad): InitParams will be movable. | 318 // TODO(sad): InitParams will be movable. |
| 320 LayerTreeHostInProcess::InitParams params2; | 319 LayerTreeHost::InitParams params2; |
| 321 params2.client = &host_client1; | 320 params2.client = &host_client1; |
| 322 params2.settings = &settings; | 321 params2.settings = &settings; |
| 323 params2.task_graph_runner = &task_graph_runner; | 322 params2.task_graph_runner = &task_graph_runner; |
| 324 params2.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 323 params2.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 325 params2.client = &host_client2; | 324 params2.client = &host_client2; |
| 326 params2.mutator_host = animation_host2.get(); | 325 params2.mutator_host = animation_host2.get(); |
| 327 std::unique_ptr<LayerTreeHost> host2 = | 326 std::unique_ptr<LayerTreeHost> host2 = |
| 328 LayerTreeHostInProcess::CreateSingleThreaded(&single_thread_client, | 327 LayerTreeHost::CreateSingleThreaded(&single_thread_client, ¶ms2); |
| 329 ¶ms2); | |
| 330 host2->SetVisible(true); | 328 host2->SetVisible(true); |
| 331 host_client2.SetLayerTreeHost(host2.get()); | 329 host_client2.SetLayerTreeHost(host2.get()); |
| 332 | 330 |
| 333 // The PictureLayer is put in one LayerTreeHost. | 331 // The PictureLayer is put in one LayerTreeHost. |
| 334 host1->GetLayerTree()->SetRootLayer(layer); | 332 host1->GetLayerTree()->SetRootLayer(layer); |
| 335 // Do a main frame, record the picture layers. | 333 // Do a main frame, record the picture layers. |
| 336 EXPECT_EQ(0, layer->update_count()); | 334 EXPECT_EQ(0, layer->update_count()); |
| 337 layer->SetNeedsDisplay(); | 335 layer->SetNeedsDisplay(); |
| 338 host1->Composite(base::TimeTicks::Now()); | 336 host1->Composite(base::TimeTicks::Now()); |
| 339 EXPECT_EQ(1, layer->update_count()); | 337 EXPECT_EQ(1, layer->update_count()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 355 host2->Composite(base::TimeTicks::Now()); | 353 host2->Composite(base::TimeTicks::Now()); |
| 356 EXPECT_EQ(3, layer->update_count()); | 354 EXPECT_EQ(3, layer->update_count()); |
| 357 EXPECT_EQ(1, host2->SourceFrameNumber()); | 355 EXPECT_EQ(1, host2->SourceFrameNumber()); |
| 358 | 356 |
| 359 animation_host->SetMutatorHostClient(nullptr); | 357 animation_host->SetMutatorHostClient(nullptr); |
| 360 animation_host2->SetMutatorHostClient(nullptr); | 358 animation_host2->SetMutatorHostClient(nullptr); |
| 361 } | 359 } |
| 362 | 360 |
| 363 } // namespace | 361 } // namespace |
| 364 } // namespace cc | 362 } // namespace cc |
| OLD | NEW |