| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 last_updated_invalidation_ = invalidation; | 54 last_updated_invalidation_ = invalidation; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void set_update_source_frame_number(int number) { | 57 void set_update_source_frame_number(int number) { |
| 58 update_source_frame_number_ = number; | 58 update_source_frame_number_ = number; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } | 61 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } |
| 62 | 62 |
| 63 void set_nearest_neighbor(bool nearest_neighbor) { | 63 void set_nearest_neighbor(bool nearest_neighbor) { |
| 64 nearest_neighbor_ = nearest_neighbor; | 64 inputs_.nearest_neighbor = nearest_neighbor; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void ValidateSerialization( | 67 void ValidateSerialization( |
| 68 ImageSerializationProcessor* image_serialization_processor, | 68 ImageSerializationProcessor* image_serialization_processor, |
| 69 LayerTreeHost* host) { | 69 LayerTreeHost* host) { |
| 70 std::vector<uint32_t> engine_picture_ids = GetPictureIds(); | 70 std::vector<uint32_t> engine_picture_ids = GetPictureIds(); |
| 71 proto::LayerProperties proto; | 71 proto::LayerProperties proto; |
| 72 LayerSpecificPropertiesToProto(&proto); | 72 LayerSpecificPropertiesToProto(&proto); |
| 73 | 73 |
| 74 FakeEnginePictureCache* engine_picture_cache = | 74 FakeEnginePictureCache* engine_picture_cache = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 86 FakeClientPictureCache* client_picture_cache = | 86 FakeClientPictureCache* client_picture_cache = |
| 87 static_cast<FakeClientPictureCache*>(host->client_picture_cache()); | 87 static_cast<FakeClientPictureCache*>(host->client_picture_cache()); |
| 88 EXPECT_THAT(engine_picture_ids, | 88 EXPECT_THAT(engine_picture_ids, |
| 89 testing::UnorderedElementsAreArray( | 89 testing::UnorderedElementsAreArray( |
| 90 client_picture_cache->GetAllUsedPictureIds())); | 90 client_picture_cache->GetAllUsedPictureIds())); |
| 91 | 91 |
| 92 // Validate that the PictureLayer specific fields are properly set. | 92 // Validate that the PictureLayer specific fields are properly set. |
| 93 EXPECT_TRUE(recording_source()->EqualsTo(*layer->recording_source())); | 93 EXPECT_TRUE(recording_source()->EqualsTo(*layer->recording_source())); |
| 94 EXPECT_EQ(update_source_frame_number_, layer->update_source_frame_number_); | 94 EXPECT_EQ(update_source_frame_number_, layer->update_source_frame_number_); |
| 95 EXPECT_EQ(is_mask_, layer->is_mask_); | 95 EXPECT_EQ(is_mask_, layer->is_mask_); |
| 96 EXPECT_EQ(nearest_neighbor_, layer->nearest_neighbor_); | 96 EXPECT_EQ(inputs_.nearest_neighbor, layer->inputs_.nearest_neighbor); |
| 97 } | 97 } |
| 98 | 98 |
| 99 std::vector<uint32_t> GetPictureIds() { | 99 std::vector<uint32_t> GetPictureIds() { |
| 100 std::vector<uint32_t> ids; | 100 std::vector<uint32_t> ids; |
| 101 const DisplayItemList* display_list = | 101 const DisplayItemList* display_list = |
| 102 recording_source()->GetDisplayItemList(); | 102 recording_source()->GetDisplayItemList(); |
| 103 if (!display_list) | 103 if (!display_list) |
| 104 return ids; | 104 return ids; |
| 105 | 105 |
| 106 for (auto it = display_list->begin(); it != display_list->end(); ++it) { | 106 for (auto it = display_list->begin(); it != display_list->end(); ++it) { |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 // Do a main frame, record the picture layers. The frame number has changed | 521 // Do a main frame, record the picture layers. The frame number has changed |
| 522 // non-monotonically. | 522 // non-monotonically. |
| 523 layer->SetNeedsDisplay(); | 523 layer->SetNeedsDisplay(); |
| 524 host2->Composite(base::TimeTicks::Now()); | 524 host2->Composite(base::TimeTicks::Now()); |
| 525 EXPECT_EQ(3, layer->update_count()); | 525 EXPECT_EQ(3, layer->update_count()); |
| 526 EXPECT_EQ(1, host2->source_frame_number()); | 526 EXPECT_EQ(1, host2->source_frame_number()); |
| 527 } | 527 } |
| 528 | 528 |
| 529 } // namespace | 529 } // namespace |
| 530 } // namespace cc | 530 } // namespace cc |
| OLD | NEW |