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

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

Issue 137993013: cc: disable pre-painting when using gpu rasterization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
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 5017 matching lines...) Expand 10 before | Expand all | Expand 10 after
5028 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create())); 5028 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()));
5029 host_impl_->InitializeRenderer(output_surface.Pass()); 5029 host_impl_->InitializeRenderer(output_surface.Pass());
5030 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); 5030 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes());
5031 } 5031 }
5032 5032
5033 TEST_F(LayerTreeHostImplTest, MemoryPolicy) { 5033 TEST_F(LayerTreeHostImplTest, MemoryPolicy) {
5034 ManagedMemoryPolicy policy1( 5034 ManagedMemoryPolicy policy1(
5035 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000); 5035 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000);
5036 int everything_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( 5036 int everything_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
5037 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING); 5037 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING);
5038 int required_only_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
5039 gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY);
5038 int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( 5040 int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
5039 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); 5041 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING);
5040 5042
5043 // GPU rasterization should be disabled by default.
5044 EXPECT_EQ(host_impl_->settings().gpu_rasterization, false);
5045
5041 host_impl_->SetVisible(true); 5046 host_impl_->SetVisible(true);
5042 host_impl_->SetMemoryPolicy(policy1); 5047 host_impl_->SetMemoryPolicy(policy1);
5043 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5048 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5044 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); 5049 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_);
5045 5050
5046 host_impl_->SetVisible(false); 5051 host_impl_->SetVisible(false);
5047 EXPECT_EQ(0u, current_limit_bytes_); 5052 EXPECT_EQ(0u, current_limit_bytes_);
5048 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); 5053 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_);
5049 5054
5050 host_impl_->SetVisible(true); 5055 host_impl_->SetVisible(true);
5051 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5056 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5052 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); 5057 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_);
5058
5059 // Now enable GPU rasterization and test if we get required only cutoff,
5060 // when visible.
5061 LayerTreeSettings settings;
5062 settings.gpu_rasterization = true;
5063 host_impl_ = LayerTreeHostImpl::Create(
5064 settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
5065
5066 host_impl_->SetVisible(true);
5067 host_impl_->SetMemoryPolicy(policy1);
5068 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5069 EXPECT_EQ(required_only_cutoff_value, current_priority_cutoff_value_);
5070
5071 host_impl_->SetVisible(false);
5072 EXPECT_EQ(0u, current_limit_bytes_);
5073 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_);
5053 } 5074 }
5054 5075
5055 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest { 5076 class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest {
5056 public: 5077 public:
5057 virtual void SetUp() OVERRIDE { 5078 virtual void SetUp() OVERRIDE {
5058 LayerTreeSettings settings; 5079 LayerTreeSettings settings;
5059 settings.impl_side_painting = true; 5080 settings.impl_side_painting = true;
5060 5081
5061 fake_host_impl_ = new FakeLayerTreeHostImpl(settings, &proxy_); 5082 fake_host_impl_ = new FakeLayerTreeHostImpl(settings, &proxy_);
5062 host_impl_.reset(fake_host_impl_); 5083 host_impl_.reset(fake_host_impl_);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
5435 &set_needs_redraw_count)); 5456 &set_needs_redraw_count));
5436 // Empty damage rect won't signal the monitor. 5457 // Empty damage rect won't signal the monitor.
5437 host_impl_->SetNeedsRedrawRect(gfx::Rect()); 5458 host_impl_->SetNeedsRedrawRect(gfx::Rect());
5438 EXPECT_EQ(0, set_needs_commit_count); 5459 EXPECT_EQ(0, set_needs_commit_count);
5439 EXPECT_EQ(2, set_needs_redraw_count); 5460 EXPECT_EQ(2, set_needs_redraw_count);
5440 } 5461 }
5441 } 5462 }
5442 5463
5443 } // namespace 5464 } // namespace
5444 } // namespace cc 5465 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698