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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 192973002: Add a GPU rasterization hint to cc::PictureLayer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index f3953984c59eae0aa073ceb2d1f0c40cf722b63b..c3c2738bb4fe129a1cb70007ec9647c6ca005e79 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -5085,4 +5085,116 @@ class LayerTreeHostTestHighResRequiredAfterEvictingUIResources
MULTI_THREAD_TEST_F(LayerTreeHostTestHighResRequiredAfterEvictingUIResources);
+class LayerTreeHostTestHybridRasterizationSetting : public LayerTreeHostTest {
+ protected:
+ virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ settings->impl_side_painting = true;
+ settings->rasterization_site = LayerTreeSettings::HybridRasterization;
+ }
+
+ virtual void SetupTree() OVERRIDE {
+ LayerTreeHostTest::SetupTree();
+
+ scoped_refptr<PictureLayer> parent = PictureLayer::Create(&client_);
+ parent->SetBounds(gfx::Size(10, 10));
+ layer_tree_host()->root_layer()->AddChild(parent);
+
+ scoped_refptr<Layer> child = PictureLayer::Create(&client_);
+ child->SetBounds(gfx::Size(10, 10));
+ parent->AddChild(child);
+
+ parent->SetHasGpuRasterizationHint(true);
+ }
+
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+
+ virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ LayerImpl* root = host_impl->pending_tree()->root_layer();
+ PictureLayerImpl* parent =
+ static_cast<PictureLayerImpl*>(root->children()[0]);
+ PictureLayerImpl* child =
+ static_cast<PictureLayerImpl*>(parent->children()[0]);
+
+ // Only layers with a GPU rasterization hint should use GPU rasterization.
+ EXPECT_TRUE(parent->ShouldUseGpuRasterization());
+ EXPECT_FALSE(child->ShouldUseGpuRasterization());
+ }
+
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ LayerImpl* root = host_impl->active_tree()->root_layer();
+ PictureLayerImpl* parent =
+ static_cast<PictureLayerImpl*>(root->children()[0]);
+ PictureLayerImpl* child =
+ static_cast<PictureLayerImpl*>(parent->children()[0]);
+
+ // Only layers with a GPU rasterization hint should use GPU rasterization.
+ EXPECT_TRUE(parent->ShouldUseGpuRasterization());
+ EXPECT_FALSE(child->ShouldUseGpuRasterization());
+ EndTest();
+ }
+
+ virtual void AfterTest() OVERRIDE {}
+
+ FakeContentLayerClient client_;
+};
+
+MULTI_THREAD_TEST_F(LayerTreeHostTestHybridRasterizationSetting);
+
+class LayerTreeHostTestGpuRasterizationSetting : public LayerTreeHostTest {
+ protected:
+ virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ settings->impl_side_painting = true;
+ settings->rasterization_site = LayerTreeSettings::GpuRasterization;
+ }
+
+ virtual void SetupTree() OVERRIDE {
+ LayerTreeHostTest::SetupTree();
+
+ scoped_refptr<PictureLayer> parent = PictureLayer::Create(&client_);
+ parent->SetBounds(gfx::Size(10, 10));
+ layer_tree_host()->root_layer()->AddChild(parent);
+
+ scoped_refptr<Layer> child = PictureLayer::Create(&client_);
+ child->SetBounds(gfx::Size(10, 10));
+ parent->AddChild(child);
+
+ parent->SetHasGpuRasterizationHint(true);
+ }
+
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+
+ virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ LayerImpl* root = host_impl->pending_tree()->root_layer();
+ PictureLayerImpl* parent =
+ static_cast<PictureLayerImpl*>(root->children()[0]);
+ PictureLayerImpl* child =
+ static_cast<PictureLayerImpl*>(parent->children()[0]);
+
+ // All layers should use GPU rasterization, regardless of whether a GPU
+ // rasterization hint has been set.
+ EXPECT_TRUE(parent->ShouldUseGpuRasterization());
+ EXPECT_TRUE(child->ShouldUseGpuRasterization());
+ }
+
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ LayerImpl* root = host_impl->active_tree()->root_layer();
+ PictureLayerImpl* parent =
+ static_cast<PictureLayerImpl*>(root->children()[0]);
+ PictureLayerImpl* child =
+ static_cast<PictureLayerImpl*>(parent->children()[0]);
+
+ // All layers should use GPU rasterization, regardless of whether a GPU
+ // rasterization hint has been set.
+ EXPECT_TRUE(parent->ShouldUseGpuRasterization());
+ EXPECT_TRUE(child->ShouldUseGpuRasterization());
+ EndTest();
+ }
+
+ virtual void AfterTest() OVERRIDE {}
+
+ FakeContentLayerClient client_;
+};
+
+MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationSetting);
+
} // namespace cc
« no previous file with comments | « cc/test/hybrid_rasterization_settings.h ('k') | webkit/renderer/compositor_bindings/web_content_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698