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

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

Issue 181063022: cc: Trigger GPU rasterization based on a per-layer hint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a single switch with string values 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 5513 matching lines...) Expand 10 before | Expand all | Expand 10 after
5524 ManagedMemoryPolicy policy1( 5524 ManagedMemoryPolicy policy1(
5525 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000); 5525 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000);
5526 int everything_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( 5526 int everything_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
5527 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING); 5527 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING);
5528 int required_only_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( 5528 int required_only_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
5529 gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY); 5529 gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY);
5530 int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( 5530 int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue(
5531 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); 5531 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING);
5532 5532
5533 // GPU rasterization should be disabled by default. 5533 // GPU rasterization should be disabled by default.
5534 EXPECT_EQ(host_impl_->settings().gpu_rasterization, false); 5534 EXPECT_EQ(LayerTreeSettings::CpuRasterization,
5535 host_impl_->settings().rasterization_site);
5535 5536
5536 host_impl_->SetVisible(true); 5537 host_impl_->SetVisible(true);
5537 host_impl_->SetMemoryPolicy(policy1); 5538 host_impl_->SetMemoryPolicy(policy1);
5538 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5539 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5539 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); 5540 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_);
5540 5541
5541 host_impl_->SetVisible(false); 5542 host_impl_->SetVisible(false);
5542 EXPECT_EQ(0u, current_limit_bytes_); 5543 EXPECT_EQ(0u, current_limit_bytes_);
5543 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); 5544 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_);
5544 5545
5545 host_impl_->SetVisible(true); 5546 host_impl_->SetVisible(true);
5546 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5547 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5547 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); 5548 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_);
5548 5549
5549 // Now enable GPU rasterization and test if we get required only cutoff, 5550 // Now enable GPU rasterization and test if we get required only cutoff,
5550 // when visible. 5551 // when visible.
5551 LayerTreeSettings settings; 5552 LayerTreeSettings settings;
5552 settings.gpu_rasterization = true; 5553 settings.rasterization_site = LayerTreeSettings::GpuRasterization;
5553 host_impl_ = LayerTreeHostImpl::Create( 5554 host_impl_ = LayerTreeHostImpl::Create(
5554 settings, this, &proxy_, &stats_instrumentation_, NULL, 0); 5555 settings, this, &proxy_, &stats_instrumentation_, NULL, 0);
5555 5556
5556 host_impl_->SetVisible(true); 5557 host_impl_->SetVisible(true);
5557 host_impl_->SetMemoryPolicy(policy1); 5558 host_impl_->SetMemoryPolicy(policy1);
5558 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); 5559 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_);
5559 EXPECT_EQ(required_only_cutoff_value, current_priority_cutoff_value_); 5560 EXPECT_EQ(required_only_cutoff_value, current_priority_cutoff_value_);
5560 5561
5561 host_impl_->SetVisible(false); 5562 host_impl_->SetVisible(false);
5562 EXPECT_EQ(0u, current_limit_bytes_); 5563 EXPECT_EQ(0u, current_limit_bytes_);
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
6117 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, 6118 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes,
6118 300u * 1024u * 1024u); 6119 300u * 1024u * 1024u);
6119 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, 6120 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes,
6120 150u * 1024u * 1024u); 6121 150u * 1024u * 1024u);
6121 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, 6122 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes,
6122 75u * 1024u * 1024u); 6123 75u * 1024u * 1024u);
6123 } 6124 }
6124 6125
6125 } // namespace 6126 } // namespace
6126 } // namespace cc 6127 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698