Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: cc/tiles/picture_layer_tiling_unittest.cc

Issue 1841083004: cc: Indicate that we've updated a tiling if we invalidated it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 1777
1778 EXPECT_TRUE(active_tiling->TileAt(0, 0)); 1778 EXPECT_TRUE(active_tiling->TileAt(0, 0));
1779 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); 1779 EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
1780 1780
1781 // Reset the active tiling. The recycle tiles should be released too. 1781 // Reset the active tiling. The recycle tiles should be released too.
1782 active_tiling->Reset(); 1782 active_tiling->Reset();
1783 EXPECT_FALSE(active_tiling->TileAt(0, 0)); 1783 EXPECT_FALSE(active_tiling->TileAt(0, 0));
1784 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); 1784 EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
1785 } 1785 }
1786 1786
1787 TEST(PictureLayerTilingTest, InvalidateAfterComputeTilePriorityRects) {
1788 FakePictureLayerTilingClient pending_client;
1789 pending_client.SetTileSize(gfx::Size(100, 100));
1790
1791 scoped_refptr<FakeRasterSource> raster_source =
1792 FakeRasterSource::CreateFilled(gfx::Size(100, 100));
1793 scoped_ptr<TestablePictureLayerTiling> pending_tiling =
1794 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source,
1795 &pending_client, LayerTreeSettings());
1796 pending_tiling->set_resolution(HIGH_RESOLUTION);
1797
1798 // Ensure that we can compute tile priority rects, invalidate, and compute the
1799 // rects again. It is important that the second compute tile priority rects
1800 // return true, indicating that things have changed (since invalidation has
1801 // changed things). This causes PrepareTiles to be properly scheduled. If the
1802 // second ComputeTilePriorityRects returns false, then we assume that
1803 // PrepareTiles isn't needed and we signal that we're ready to draw
1804 // immediately, which can cause visual glitches.
1805 //
1806 // This can happen we if we process an impl frame deadline before processing a
1807 // commit. That is, when we draw we ComputeTilePriorityRects. If we process
1808 // the commit afterwards, it would use the same timestamp and sometimes would
1809 // use the same viewport to compute tile priority rects again.
1810 double time = 1.;
1811 gfx::Rect viewport(0, 0, 100, 100);
1812 EXPECT_TRUE(pending_tiling->ComputeTilePriorityRects(viewport, 1.0f, time,
1813 Occlusion()));
1814 pending_tiling->Invalidate(viewport);
1815 EXPECT_TRUE(pending_tiling->ComputeTilePriorityRects(viewport, 1.0f, time,
1816 Occlusion()));
1817 }
1818
1787 TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) { 1819 TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) {
1788 // The tiling has four rows and three columns. 1820 // The tiling has four rows and three columns.
1789 Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150)); 1821 Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150));
1790 tiling_->CreateAllTilesForTesting(); 1822 tiling_->CreateAllTilesForTesting();
1791 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width()); 1823 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width());
1792 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height()); 1824 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height());
1793 EXPECT_EQ(4u, tiling_->AllTilesForTesting().size()); 1825 EXPECT_EQ(4u, tiling_->AllTilesForTesting().size());
1794 1826
1795 client_.SetTileSize(gfx::Size(250, 200)); 1827 client_.SetTileSize(gfx::Size(250, 200));
1796 1828
(...skipping 24 matching lines...) Expand all
1821 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale, 1853 tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale,
1822 raster_source, &client_, 1854 raster_source, &client_,
1823 LayerTreeSettings()); 1855 LayerTreeSettings());
1824 1856
1825 gfx::Rect content_rect(25554432, 25554432, 950, 860); 1857 gfx::Rect content_rect(25554432, 25554432, 950, 860);
1826 VerifyTilesExactlyCoverRect(contents_scale, content_rect); 1858 VerifyTilesExactlyCoverRect(contents_scale, content_rect);
1827 } 1859 }
1828 1860
1829 } // namespace 1861 } // namespace
1830 } // namespace cc 1862 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698