summaryrefslogtreecommitdiff
path: root/chromium/cc/resources/tile_manager_unittest.cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org>2014-02-11 01:56:37 +0000
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-06-13 17:09:37 +0200
commit66ec79d38fe3a0958ace8c131df64c1c9e0dc3ec (patch)
treeba8a6eb0ecef688ec0d2c99db4e38c77d7f0ad30 /chromium/cc/resources/tile_manager_unittest.cc
parenta95f019bf395b7fbd21299652d4aaf2f4d233dec (diff)
downloadqtwebengine-chromium-33.0.1750.149-based.tar.gz
[Backport] cc: Prevent usage of rasterize on-demand with delegating renderer.33.0.1750.149-based
PictureDrawQuads are not yet supported by the delegating renderer. Generating this type of quads for on-demand raster of tiles cause invalid IPC to be sent to the parent compositor and the renderer to be killed. This makes us activate with low-res or checkerboard tiles until PictureDrawQuads are properly supported by the delegating renderer. BUG=340695 TEST=cc_unittests --gtest_filter=*RasterizeOnDemand* Review URL: https://codereview.chromium.org/157743007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250273 0039d316-1c4b-4281-b951-d872f2087c98 Conflicts: cc/resources/tile_manager.cc Change-Id: I9a08cc770d97d297c71dec88f3fdb878208d21ac Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/cc/resources/tile_manager_unittest.cc')
-rw-r--r--chromium/cc/resources/tile_manager_unittest.cc57
1 files changed, 51 insertions, 6 deletions
diff --git a/chromium/cc/resources/tile_manager_unittest.cc b/chromium/cc/resources/tile_manager_unittest.cc
index 8339bd07b0a..224e0a6c620 100644
--- a/chromium/cc/resources/tile_manager_unittest.cc
+++ b/chromium/cc/resources/tile_manager_unittest.cc
@@ -8,27 +8,33 @@
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/fake_picture_pile_impl.h"
#include "cc/test/fake_tile_manager.h"
-#include "cc/test/fake_tile_manager_client.h"
#include "cc/test/test_tile_priorities.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cc {
namespace {
-class TileManagerTest : public testing::TestWithParam<bool> {
+class TileManagerTest : public testing::TestWithParam<bool>,
+ public TileManagerClient {
public:
typedef std::vector<scoped_refptr<Tile> > TileVector;
+ TileManagerTest()
+ : memory_limit_policy_(ALLOW_ANYTHING),
+ max_memory_tiles_(0),
+ ready_to_activate_(false) {}
+
void Initialize(int max_tiles,
TileMemoryLimitPolicy memory_limit_policy,
- TreePriority tree_priority) {
+ TreePriority tree_priority,
+ bool allow_on_demand_raster = true) {
output_surface_ = FakeOutputSurface::Create3d();
CHECK(output_surface_->BindToClient(&output_surface_client_));
resource_provider_ =
ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
- tile_manager_ = make_scoped_ptr(
- new FakeTileManager(&tile_manager_client_, resource_provider_.get()));
+ tile_manager_ = make_scoped_ptr(new FakeTileManager(
+ this, resource_provider_.get(), allow_on_demand_raster));
memory_limit_policy_ = memory_limit_policy;
max_memory_tiles_ = max_tiles;
@@ -73,6 +79,9 @@ class TileManagerTest : public testing::TestWithParam<bool> {
testing::Test::TearDown();
}
+ // TileManagerClient implementation.
+ virtual void NotifyReadyToActivate() OVERRIDE { ready_to_activate_ = true; }
+
TileVector CreateTilesWithSize(int count,
TilePriority active_priority,
TilePriority pending_priority,
@@ -129,11 +138,12 @@ class TileManagerTest : public testing::TestWithParam<bool> {
return has_lcd_count;
}
+ bool ready_to_activate() const { return ready_to_activate_; }
+
protected:
GlobalStateThatImpactsTilePriority global_state_;
private:
- FakeTileManagerClient tile_manager_client_;
LayerTreeSettings settings_;
scoped_ptr<FakeTileManager> tile_manager_;
scoped_refptr<FakePicturePileImpl> picture_pile_;
@@ -142,6 +152,7 @@ class TileManagerTest : public testing::TestWithParam<bool> {
scoped_ptr<ResourceProvider> resource_provider_;
TileMemoryLimitPolicy memory_limit_policy_;
int max_memory_tiles_;
+ bool ready_to_activate_;
};
TEST_P(TileManagerTest, EnoughMemoryAllowAnything) {
@@ -520,6 +531,40 @@ TEST_P(TileManagerTest, RespectMemoryLimit) {
EXPECT_LE(memory_allocated_bytes, global_state_.memory_limit_in_bytes);
}
+TEST_P(TileManagerTest, AllowRasterizeOnDemand) {
+ // Not enough memory to initialize tiles required for activation.
+ Initialize(0, ALLOW_ANYTHING, SAME_PRIORITY_FOR_BOTH_TREES);
+ TileVector tiles =
+ CreateTiles(2, TilePriority(), TilePriorityRequiredForActivation());
+
+ tile_manager()->AssignMemoryToTiles(global_state_);
+
+ // This should make required tiles ready to draw by marking them as
+ // required tiles for on-demand raster.
+ tile_manager()->DidFinishRunningTasksForTesting();
+
+ EXPECT_TRUE(ready_to_activate());
+ for (TileVector::iterator it = tiles.begin(); it != tiles.end(); ++it)
+ EXPECT_TRUE((*it)->IsReadyToDraw());
+}
+
+TEST_P(TileManagerTest, PreventRasterizeOnDemand) {
+ // Not enough memory to initialize tiles required for activation.
+ Initialize(0, ALLOW_ANYTHING, SAME_PRIORITY_FOR_BOTH_TREES, false);
+ TileVector tiles =
+ CreateTiles(2, TilePriority(), TilePriorityRequiredForActivation());
+
+ tile_manager()->AssignMemoryToTiles(global_state_);
+
+ // This should make required tiles ready to draw by marking them as
+ // required tiles for on-demand raster.
+ tile_manager()->DidFinishRunningTasksForTesting();
+
+ EXPECT_TRUE(ready_to_activate());
+ for (TileVector::iterator it = tiles.begin(); it != tiles.end(); ++it)
+ EXPECT_FALSE((*it)->IsReadyToDraw());
+}
+
// If true, the max tile limit should be applied as bytes; if false,
// as num_resources_limit.
INSTANTIATE_TEST_CASE_P(TileManagerTests,