summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authoradam.treat@samsung.com <adam.treat@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-05 00:27:01 +0000
committeradam.treat@samsung.com <adam.treat@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-05 00:27:01 +0000
commit9bc838a058f5e7e92dd8d7b6ad991dd888bb1853 (patch)
tree5d89ce8af1f63641df6db62ab0a0ff8f5555b8cc /cc
parent22eedd374ac1ad856679dc731ab3b894d618e78c (diff)
downloadchromium_src-9bc838a058f5e7e92dd8d7b6ad991dd888bb1853.zip
chromium_src-9bc838a058f5e7e92dd8d7b6ad991dd888bb1853.tar.gz
chromium_src-9bc838a058f5e7e92dd8d7b6ad991dd888bb1853.tar.bz2
LayerTreeHost should not modify the LayerTreeSettings object.
Instead it should use a temporary variable wherever needed and leave the settings object const. This patch removes the last instance of this behavior and makes the settings object const. BUG=234233 Review URL: https://codereview.chromium.org/23463042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/trees/layer_tree_host.cc23
-rw-r--r--cc/trees/layer_tree_host.h3
-rw-r--r--cc/trees/layer_tree_host_unittest.cc10
3 files changed, 19 insertions, 17 deletions
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 34f4d2f..7bece08 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -205,16 +205,6 @@ LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) {
if (success) {
output_surface_lost_ = false;
- // Update settings_ based on partial update capability.
- size_t max_partial_texture_updates = 0;
- if (proxy_->GetRendererCapabilities().allow_partial_texture_updates &&
- !settings_.impl_side_painting) {
- max_partial_texture_updates = std::min(
- settings_.max_partial_texture_updates,
- proxy_->MaxPartialTextureUpdates());
- }
- settings_.max_partial_texture_updates = max_partial_texture_updates;
-
if (!contents_texture_manager_ &&
(!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) {
contents_texture_manager_ =
@@ -1124,8 +1114,19 @@ bool LayerTreeHost::AlwaysUsePartialTextureUpdates() {
return !proxy_->HasImplThread();
}
+size_t LayerTreeHost::MaxPartialTextureUpdates() const {
+ size_t max_partial_texture_updates = 0;
+ if (proxy_->GetRendererCapabilities().allow_partial_texture_updates &&
+ !settings_.impl_side_painting) {
+ max_partial_texture_updates =
+ std::min(settings_.max_partial_texture_updates,
+ proxy_->MaxPartialTextureUpdates());
+ }
+ return max_partial_texture_updates;
+}
+
bool LayerTreeHost::RequestPartialTextureUpdate() {
- if (partial_texture_update_requests_ >= settings_.max_partial_texture_updates)
+ if (partial_texture_update_requests_ >= MaxPartialTextureUpdates())
return false;
partial_texture_update_requests_++;
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index f34215f..d92200f 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -273,6 +273,7 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
virtual void RateLimit() OVERRIDE;
bool AlwaysUsePartialTextureUpdates();
+ size_t MaxPartialTextureUpdates() const;
bool RequestPartialTextureUpdate();
void SetDeviceScaleFactor(float device_scale_factor);
@@ -386,7 +387,7 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
base::WeakPtr<InputHandler> input_handler_weak_ptr_;
base::WeakPtr<TopControlsManager> top_controls_manager_weak_ptr_;
- LayerTreeSettings settings_;
+ const LayerTreeSettings settings_;
LayerTreeDebugState debug_state_;
gfx::Size device_viewport_size_;
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 904b37e..aef9f35 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2116,7 +2116,7 @@ TEST(LayerTreeHostTest, LimitPartialUpdates) {
LayerTreeHostWithProxy host(&client, settings, proxy.Pass());
EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded());
- EXPECT_EQ(0u, host.settings().max_partial_texture_updates);
+ EXPECT_EQ(0u, host.MaxPartialTextureUpdates());
}
// When partial updates are allowed,
@@ -2134,7 +2134,7 @@ TEST(LayerTreeHostTest, LimitPartialUpdates) {
LayerTreeHostWithProxy host(&client, settings, proxy.Pass());
EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded());
- EXPECT_EQ(5u, host.settings().max_partial_texture_updates);
+ EXPECT_EQ(5u, host.MaxPartialTextureUpdates());
}
// When partial updates are allowed,
@@ -2152,7 +2152,7 @@ TEST(LayerTreeHostTest, LimitPartialUpdates) {
LayerTreeHostWithProxy host(&client, settings, proxy.Pass());
EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded());
- EXPECT_EQ(10u, host.settings().max_partial_texture_updates);
+ EXPECT_EQ(10u, host.MaxPartialTextureUpdates());
}
}
@@ -2189,7 +2189,7 @@ TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) {
scoped_ptr<LayerTreeHost> host =
LayerTreeHost::Create(&client, settings, NULL);
EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
- EXPECT_EQ(0u, host->settings().max_partial_texture_updates);
+ EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
}
TEST(LayerTreeHostTest,
@@ -2202,7 +2202,7 @@ TEST(LayerTreeHostTest,
scoped_ptr<LayerTreeHost> host =
LayerTreeHost::Create(&client, settings, NULL);
EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded());
- EXPECT_EQ(0u, host->settings().max_partial_texture_updates);
+ EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
}
class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted