| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } | 62 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } |
| 63 | 63 |
| 64 void set_nearest_neighbor(bool nearest_neighbor) { | 64 void set_nearest_neighbor(bool nearest_neighbor) { |
| 65 picture_layer_inputs_.nearest_neighbor = nearest_neighbor; | 65 picture_layer_inputs_.nearest_neighbor = nearest_neighbor; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ValidateSerialization( | 68 void ValidateSerialization( |
| 69 ImageSerializationProcessor* image_serialization_processor, | 69 ImageSerializationProcessor* image_serialization_processor, |
| 70 LayerTreeHost* host) { | 70 LayerTreeHostInProcess* host) { |
| 71 std::vector<uint32_t> engine_picture_ids = GetPictureIds(); | 71 std::vector<uint32_t> engine_picture_ids = GetPictureIds(); |
| 72 proto::LayerProperties proto; | 72 proto::LayerProperties proto; |
| 73 LayerSpecificPropertiesToProto(&proto); | 73 LayerSpecificPropertiesToProto(&proto); |
| 74 | 74 |
| 75 FakeEnginePictureCache* engine_picture_cache = | 75 FakeEnginePictureCache* engine_picture_cache = |
| 76 static_cast<FakeEnginePictureCache*>(host->engine_picture_cache()); | 76 static_cast<FakeEnginePictureCache*>(host->engine_picture_cache()); |
| 77 EXPECT_THAT(engine_picture_ids, | 77 EXPECT_THAT(engine_picture_ids, |
| 78 testing::UnorderedElementsAreArray( | 78 testing::UnorderedElementsAreArray( |
| 79 engine_picture_cache->GetAllUsedPictureIds())); | 79 engine_picture_cache->GetAllUsedPictureIds())); |
| 80 | 80 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 490 |
| 491 StubLayerTreeHostSingleThreadClient single_thread_client; | 491 StubLayerTreeHostSingleThreadClient single_thread_client; |
| 492 FakeLayerTreeHostClient host_client1; | 492 FakeLayerTreeHostClient host_client1; |
| 493 FakeLayerTreeHostClient host_client2; | 493 FakeLayerTreeHostClient host_client2; |
| 494 TestSharedBitmapManager shared_bitmap_manager; | 494 TestSharedBitmapManager shared_bitmap_manager; |
| 495 TestTaskGraphRunner task_graph_runner; | 495 TestTaskGraphRunner task_graph_runner; |
| 496 | 496 |
| 497 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); | 497 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); |
| 498 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client); | 498 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client); |
| 499 | 499 |
| 500 LayerTreeHost::InitParams params; | 500 LayerTreeHostInProcess::InitParams params; |
| 501 params.client = &host_client1; | 501 params.client = &host_client1; |
| 502 params.shared_bitmap_manager = &shared_bitmap_manager; | 502 params.shared_bitmap_manager = &shared_bitmap_manager; |
| 503 params.settings = &settings; | 503 params.settings = &settings; |
| 504 params.task_graph_runner = &task_graph_runner; | 504 params.task_graph_runner = &task_graph_runner; |
| 505 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 505 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 506 params.animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 506 params.animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 507 std::unique_ptr<LayerTreeHost> host1 = | 507 std::unique_ptr<LayerTreeHost> host1 = |
| 508 LayerTreeHost::CreateSingleThreaded(&single_thread_client, ¶ms); | 508 LayerTreeHostInProcess::CreateSingleThreaded(&single_thread_client, |
| 509 ¶ms); |
| 509 host1->SetVisible(true); | 510 host1->SetVisible(true); |
| 510 host_client1.SetLayerTreeHost(host1.get()); | 511 host_client1.SetLayerTreeHost(host1.get()); |
| 511 | 512 |
| 512 // TODO(sad): InitParams will be movable. | 513 // TODO(sad): InitParams will be movable. |
| 513 LayerTreeHost::InitParams params2; | 514 LayerTreeHostInProcess::InitParams params2; |
| 514 params2.client = &host_client1; | 515 params2.client = &host_client1; |
| 515 params2.shared_bitmap_manager = &shared_bitmap_manager; | 516 params2.shared_bitmap_manager = &shared_bitmap_manager; |
| 516 params2.settings = &settings; | 517 params2.settings = &settings; |
| 517 params2.task_graph_runner = &task_graph_runner; | 518 params2.task_graph_runner = &task_graph_runner; |
| 518 params2.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 519 params2.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 519 params2.client = &host_client2; | 520 params2.client = &host_client2; |
| 520 params2.animation_host = | 521 params2.animation_host = |
| 521 AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 522 AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 522 std::unique_ptr<LayerTreeHost> host2 = | 523 std::unique_ptr<LayerTreeHost> host2 = |
| 523 LayerTreeHost::CreateSingleThreaded(&single_thread_client, ¶ms2); | 524 LayerTreeHostInProcess::CreateSingleThreaded(&single_thread_client, |
| 525 ¶ms2); |
| 524 host2->SetVisible(true); | 526 host2->SetVisible(true); |
| 525 host_client2.SetLayerTreeHost(host2.get()); | 527 host_client2.SetLayerTreeHost(host2.get()); |
| 526 | 528 |
| 527 // The PictureLayer is put in one LayerTreeHost. | 529 // The PictureLayer is put in one LayerTreeHost. |
| 528 host1->GetLayerTree()->SetRootLayer(layer); | 530 host1->GetLayerTree()->SetRootLayer(layer); |
| 529 // Do a main frame, record the picture layers. | 531 // Do a main frame, record the picture layers. |
| 530 EXPECT_EQ(0, layer->update_count()); | 532 EXPECT_EQ(0, layer->update_count()); |
| 531 layer->SetNeedsDisplay(); | 533 layer->SetNeedsDisplay(); |
| 532 host1->Composite(base::TimeTicks::Now()); | 534 host1->Composite(base::TimeTicks::Now()); |
| 533 EXPECT_EQ(1, layer->update_count()); | 535 EXPECT_EQ(1, layer->update_count()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 546 // Do a main frame, record the picture layers. The frame number has changed | 548 // Do a main frame, record the picture layers. The frame number has changed |
| 547 // non-monotonically. | 549 // non-monotonically. |
| 548 layer->SetNeedsDisplay(); | 550 layer->SetNeedsDisplay(); |
| 549 host2->Composite(base::TimeTicks::Now()); | 551 host2->Composite(base::TimeTicks::Now()); |
| 550 EXPECT_EQ(3, layer->update_count()); | 552 EXPECT_EQ(3, layer->update_count()); |
| 551 EXPECT_EQ(1, host2->SourceFrameNumber()); | 553 EXPECT_EQ(1, host2->SourceFrameNumber()); |
| 552 } | 554 } |
| 553 | 555 |
| 554 } // namespace | 556 } // namespace |
| 555 } // namespace cc | 557 } // namespace cc |
| OLD | NEW |