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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 290573007: cc: Move gpu rasterization flag from tree-impl to tree-host-impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 5713 matching lines...) Expand 10 before | Expand all | Expand 10 after
5724 host_impl_->SetVisible(true); 5724 host_impl_->SetVisible(true);
5725 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5725 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5726 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); 5726 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_);
5727 5727
5728 // Now enable GPU rasterization and test if we get nice to have cutoff, 5728 // Now enable GPU rasterization and test if we get nice to have cutoff,
5729 // when visible. 5729 // when visible.
5730 LayerTreeSettings settings; 5730 LayerTreeSettings settings;
5731 settings.gpu_rasterization_enabled = true; 5731 settings.gpu_rasterization_enabled = true;
5732 host_impl_ = LayerTreeHostImpl::Create( 5732 host_impl_ = LayerTreeHostImpl::Create(
5733 settings, this, &proxy_, &stats_instrumentation_, NULL, 0); 5733 settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
5734 host_impl_->active_tree()->SetUseGpuRasterization(true); 5734 host_impl_->SetUseGpuRasterization(true);
5735 host_impl_->SetVisible(true); 5735 host_impl_->SetVisible(true);
5736 host_impl_->SetMemoryPolicy(policy1); 5736 host_impl_->SetMemoryPolicy(policy1);
5737 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5737 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5738 EXPECT_EQ(allow_nice_to_have_cutoff_value, current_priority_cutoff_value_); 5738 EXPECT_EQ(allow_nice_to_have_cutoff_value, current_priority_cutoff_value_);
5739 5739
5740 host_impl_->SetVisible(false); 5740 host_impl_->SetVisible(false);
5741 EXPECT_EQ(0u, current_limit_bytes_); 5741 EXPECT_EQ(0u, current_limit_bytes_);
5742 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); 5742 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_);
5743 } 5743 }
5744 5744
5745 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { 5745 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) {
5746 ASSERT_TRUE(host_impl_->active_tree()); 5746 ASSERT_TRUE(host_impl_->active_tree());
5747 5747
5748 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); 5748 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
5749 host_impl_->SetVisible(false); 5749 host_impl_->SetVisible(false);
5750 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); 5750 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
5751 host_impl_->SetVisible(true); 5751 host_impl_->SetVisible(true);
5752 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); 5752 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
5753 host_impl_->SetVisible(false); 5753 host_impl_->SetVisible(false);
5754 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); 5754 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
5755 5755
5756 host_impl_->CreatePendingTree(); 5756 host_impl_->CreatePendingTree();
5757 host_impl_->ActivatePendingTree(); 5757 host_impl_->ActivatePendingTree();
5758 5758
5759 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); 5759 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
5760 host_impl_->SetVisible(true); 5760 host_impl_->SetVisible(true);
5761 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); 5761 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
5762 } 5762 }
5763 5763
5764 TEST_F(LayerTreeHostImplTest, RequireHighResAfterGpuRasterizationToggles) {
5765 ASSERT_TRUE(host_impl_->active_tree());
5766 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
5767
5768 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
5769 host_impl_->SetUseGpuRasterization(false);
5770 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
5771 host_impl_->SetUseGpuRasterization(true);
5772 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
5773 host_impl_->SetUseGpuRasterization(false);
5774 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
5775
5776 host_impl_->CreatePendingTree();
5777 host_impl_->ActivatePendingTree();
5778
5779 EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
5780 host_impl_->SetUseGpuRasterization(true);
5781 EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
5782 }
5783
5764 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest { 5784 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest {
5765 public: 5785 public:
5766 virtual void SetUp() OVERRIDE { 5786 virtual void SetUp() OVERRIDE {
5767 LayerTreeSettings settings; 5787 LayerTreeSettings settings;
5768 settings.impl_side_painting = true; 5788 settings.impl_side_painting = true;
5769 5789
5770 fake_host_impl_ = new FakeLayerTreeHostImpl( 5790 fake_host_impl_ = new FakeLayerTreeHostImpl(
5771 settings, &proxy_, shared_bitmap_manager_.get()); 5791 settings, &proxy_, shared_bitmap_manager_.get());
5772 host_impl_.reset(fake_host_impl_); 5792 host_impl_.reset(fake_host_impl_);
5773 host_impl_->InitializeRenderer(CreateOutputSurface()); 5793 host_impl_->InitializeRenderer(CreateOutputSurface());
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
6588 FakePictureLayerImpl* active_mask_content = 6608 FakePictureLayerImpl* active_mask_content =
6589 static_cast<FakePictureLayerImpl*>( 6609 static_cast<FakePictureLayerImpl*>(
6590 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer()); 6610 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer());
6591 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority(); 6611 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority();
6592 6612
6593 ASSERT_TRUE(!r2.IsEmpty()); 6613 ASSERT_TRUE(!r2.IsEmpty());
6594 } 6614 }
6595 6615
6596 } // namespace 6616 } // namespace
6597 } // namespace cc 6617 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698