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

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

Issue 189883009: Define a --force-gpu-rasterization flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 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 5517 matching lines...) Expand 10 before | Expand all | Expand 10 after
5528 ManagedMemoryPolicy policy1( 5528 ManagedMemoryPolicy policy1(
5529 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000); 5529 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000);
5530 int everything_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( 5530 int everything_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
5531 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING); 5531 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING);
5532 int required_only_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( 5532 int required_only_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
5533 gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY); 5533 gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY);
5534 int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( 5534 int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
5535 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); 5535 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING);
5536 5536
5537 // GPU rasterization should be disabled by default. 5537 // GPU rasterization should be disabled by default.
5538 EXPECT_EQ(host_impl_->settings().gpu_rasterization, false); 5538 EXPECT_EQ(LayerTreeSettings::GpuRasterizationDisabled,
5539 host_impl_->settings().gpu_rasterization_state);
5539 5540
5540 host_impl_->SetVisible(true); 5541 host_impl_->SetVisible(true);
5541 host_impl_->SetMemoryPolicy(policy1); 5542 host_impl_->SetMemoryPolicy(policy1);
5542 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5543 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5543 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); 5544 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_);
5544 5545
5545 host_impl_->SetVisible(false); 5546 host_impl_->SetVisible(false);
5546 EXPECT_EQ(0u, current_limit_bytes_); 5547 EXPECT_EQ(0u, current_limit_bytes_);
5547 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); 5548 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_);
5548 5549
5549 host_impl_->SetVisible(true); 5550 host_impl_->SetVisible(true);
5550 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5551 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5551 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); 5552 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_);
5552 5553
5553 // Now enable GPU rasterization and test if we get required only cutoff, 5554 // Now enable GPU rasterization and test if we get required only cutoff,
5554 // when visible. 5555 // when visible.
5555 LayerTreeSettings settings; 5556 LayerTreeSettings settings;
5556 settings.gpu_rasterization = true; 5557 settings.gpu_rasterization_state = LayerTreeSettings::GpuRasterizationForced;
5557 host_impl_ = LayerTreeHostImpl::Create( 5558 host_impl_ = LayerTreeHostImpl::Create(
5558 settings, this, &proxy_, &stats_instrumentation_, NULL, 0); 5559 settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
5559 5560
5560 host_impl_->SetVisible(true); 5561 host_impl_->SetVisible(true);
5561 host_impl_->SetMemoryPolicy(policy1); 5562 host_impl_->SetMemoryPolicy(policy1);
5562 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5563 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5563 EXPECT_EQ(required_only_cutoff_value, current_priority_cutoff_value_); 5564 EXPECT_EQ(required_only_cutoff_value, current_priority_cutoff_value_);
5564 5565
5565 host_impl_->SetVisible(false); 5566 host_impl_->SetVisible(false);
5566 EXPECT_EQ(0u, current_limit_bytes_); 5567 EXPECT_EQ(0u, current_limit_bytes_);
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
6121 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, 6122 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes,
6122 300u * 1024u * 1024u); 6123 300u * 1024u * 1024u);
6123 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, 6124 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes,
6124 150u * 1024u * 1024u); 6125 150u * 1024u * 1024u);
6125 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, 6126 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes,
6126 75u * 1024u * 1024u); 6127 75u * 1024u * 1024u);
6127 } 6128 }
6128 6129
6129 } // namespace 6130 } // namespace
6130 } // namespace cc 6131 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698