| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/tiles/picture_layer_tiling_set.h" | 5 #include "cc/tiles/picture_layer_tiling_set.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "cc/resources/resource_provider.h" | 10 #include "cc/resources/resource_provider.h" |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 EXPECT_FALSE( | 977 EXPECT_FALSE( |
| 978 tiling_set->UpdateTilePriorities(viewport, 1.f, time, Occlusion(), true)); | 978 tiling_set->UpdateTilePriorities(viewport, 1.f, time, Occlusion(), true)); |
| 979 | 979 |
| 980 // This will invalidate tilings. | 980 // This will invalidate tilings. |
| 981 tiling_set->UpdateRasterSourceDueToLCDChange(raster_source, Region()); | 981 tiling_set->UpdateRasterSourceDueToLCDChange(raster_source, Region()); |
| 982 | 982 |
| 983 EXPECT_TRUE( | 983 EXPECT_TRUE( |
| 984 tiling_set->UpdateTilePriorities(viewport, 1.f, time, Occlusion(), true)); | 984 tiling_set->UpdateTilePriorities(viewport, 1.f, time, Occlusion(), true)); |
| 985 } | 985 } |
| 986 | 986 |
| 987 TEST(PictureLayerTilingTest, InvalidateAfterUpdateRasterSourceForCommit) { |
| 988 FakePictureLayerTilingClient pending_client; |
| 989 FakePictureLayerTilingClient active_client; |
| 990 std::unique_ptr<PictureLayerTilingSet> pending_set = |
| 991 PictureLayerTilingSet::Create(PENDING_TREE, &pending_client, 1000, 1.f, |
| 992 1000, 1000.f); |
| 993 std::unique_ptr<PictureLayerTilingSet> active_set = |
| 994 PictureLayerTilingSet::Create(ACTIVE_TREE, &active_client, 1000, 1.f, |
| 995 1000, 1000.f); |
| 996 |
| 997 gfx::Size layer_bounds(100, 100); |
| 998 scoped_refptr<FakeRasterSource> raster_source = |
| 999 FakeRasterSource::CreateFilled(layer_bounds); |
| 1000 |
| 1001 auto* pending_tiling = pending_set->AddTiling(1.f, raster_source); |
| 1002 pending_tiling->set_resolution(HIGH_RESOLUTION); |
| 1003 active_client.set_twin_tiling_set(pending_set.get()); |
| 1004 |
| 1005 double time = 1.; |
| 1006 gfx::Rect viewport(0, 0, 100, 100); |
| 1007 |
| 1008 // The first commit will update the raster source for pending tilings. |
| 1009 pending_set->UpdateTilingsToCurrentRasterSourceForCommit(raster_source, |
| 1010 Region(), 1.f, 1.f); |
| 1011 // UpdateTilePriorities for pending set gets called during UDP in commit. |
| 1012 EXPECT_TRUE(pending_set->UpdateTilePriorities(viewport, 1.f, time, |
| 1013 Occlusion(), true)); |
| 1014 // The active set doesn't have tilings yet. |
| 1015 EXPECT_FALSE( |
| 1016 active_set->UpdateTilePriorities(viewport, 1.f, time, Occlusion(), true)); |
| 1017 |
| 1018 // On activation tilings are copied from pending set to active set. |
| 1019 active_set->UpdateTilingsToCurrentRasterSourceForActivation( |
| 1020 raster_source, pending_set.get(), Region(), 1.f, 1.f); |
| 1021 // Pending set doesn't have any tilings now. |
| 1022 EXPECT_FALSE(pending_set->UpdateTilePriorities(viewport, 1.f, time, |
| 1023 Occlusion(), true)); |
| 1024 // UpdateTilePriorities for active set gets called during UDP in draw. |
| 1025 EXPECT_TRUE( |
| 1026 active_set->UpdateTilePriorities(viewport, 1.f, time, Occlusion(), true)); |
| 1027 |
| 1028 // Even though frame time and viewport haven't changed since last commit we |
| 1029 // update tile priorities because of potential invalidations. |
| 1030 pending_set->UpdateTilingsToCurrentRasterSourceForCommit(raster_source, |
| 1031 Region(), 1.f, 1.f); |
| 1032 // UpdateTilePriorities for pending set gets called during UDP in commit. |
| 1033 EXPECT_TRUE(pending_set->UpdateTilePriorities(viewport, 1.f, time, |
| 1034 Occlusion(), true)); |
| 1035 // No changes for active set until activation. |
| 1036 EXPECT_FALSE( |
| 1037 active_set->UpdateTilePriorities(viewport, 1.f, time, Occlusion(), true)); |
| 1038 } |
| 1039 |
| 987 } // namespace | 1040 } // namespace |
| 988 } // namespace cc | 1041 } // namespace cc |
| OLD | NEW |