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

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

Issue 23463042: LayerTreeHost should not modify the LayerTreeSettings object. Instead it should use a temporary va… (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Fix the case for the method name Created 7 years, 2 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
« no previous file with comments | « cc/trees/layer_tree_host.h ('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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { 198 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) {
199 TRACE_EVENT1("cc", 199 TRACE_EVENT1("cc",
200 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted", 200 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted",
201 "success", 201 "success",
202 success); 202 success);
203 203
204 DCHECK(output_surface_lost_); 204 DCHECK(output_surface_lost_);
205 if (success) { 205 if (success) {
206 output_surface_lost_ = false; 206 output_surface_lost_ = false;
207 207
208 // Update settings_ based on partial update capability.
209 size_t max_partial_texture_updates = 0;
210 if (proxy_->GetRendererCapabilities().allow_partial_texture_updates &&
211 !settings_.impl_side_painting) {
212 max_partial_texture_updates = std::min(
213 settings_.max_partial_texture_updates,
214 proxy_->MaxPartialTextureUpdates());
215 }
216 settings_.max_partial_texture_updates = max_partial_texture_updates;
217
218 if (!contents_texture_manager_ && 208 if (!contents_texture_manager_ &&
219 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) { 209 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) {
220 contents_texture_manager_ = 210 contents_texture_manager_ =
221 PrioritizedResourceManager::Create(proxy_.get()); 211 PrioritizedResourceManager::Create(proxy_.get());
222 surface_memory_placeholder_ = 212 surface_memory_placeholder_ =
223 contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888); 213 contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888);
224 } 214 }
225 215
226 client_->DidInitializeOutputSurface(true); 216 client_->DidInitializeOutputSurface(true);
227 return CreateSucceeded; 217 return CreateSucceeded;
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 // SwapBuffers. 1107 // SwapBuffers.
1118 proxy_->ForceSerializeOnSwapBuffers(); 1108 proxy_->ForceSerializeOnSwapBuffers();
1119 } 1109 }
1120 1110
1121 bool LayerTreeHost::AlwaysUsePartialTextureUpdates() { 1111 bool LayerTreeHost::AlwaysUsePartialTextureUpdates() {
1122 if (!proxy_->GetRendererCapabilities().allow_partial_texture_updates) 1112 if (!proxy_->GetRendererCapabilities().allow_partial_texture_updates)
1123 return false; 1113 return false;
1124 return !proxy_->HasImplThread(); 1114 return !proxy_->HasImplThread();
1125 } 1115 }
1126 1116
1117 size_t LayerTreeHost::MaxPartialTextureUpdates() const {
1118 size_t max_partial_texture_updates = 0;
1119 if (proxy_->GetRendererCapabilities().allow_partial_texture_updates &&
1120 !settings_.impl_side_painting) {
1121 max_partial_texture_updates =
1122 std::min(settings_.max_partial_texture_updates,
1123 proxy_->MaxPartialTextureUpdates());
1124 }
1125 return max_partial_texture_updates;
1126 }
1127
1127 bool LayerTreeHost::RequestPartialTextureUpdate() { 1128 bool LayerTreeHost::RequestPartialTextureUpdate() {
1128 if (partial_texture_update_requests_ >= settings_.max_partial_texture_updates) 1129 if (partial_texture_update_requests_ >= MaxPartialTextureUpdates())
1129 return false; 1130 return false;
1130 1131
1131 partial_texture_update_requests_++; 1132 partial_texture_update_requests_++;
1132 return true; 1133 return true;
1133 } 1134 }
1134 1135
1135 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { 1136 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) {
1136 if (device_scale_factor == device_scale_factor_) 1137 if (device_scale_factor == device_scale_factor_)
1137 return; 1138 return;
1138 device_scale_factor_ = device_scale_factor; 1139 device_scale_factor_ = device_scale_factor;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 void LayerTreeHost::RegisterViewportLayers( 1243 void LayerTreeHost::RegisterViewportLayers(
1243 scoped_refptr<Layer> page_scale_layer, 1244 scoped_refptr<Layer> page_scale_layer,
1244 scoped_refptr<Layer> inner_viewport_scroll_layer, 1245 scoped_refptr<Layer> inner_viewport_scroll_layer,
1245 scoped_refptr<Layer> outer_viewport_scroll_layer) { 1246 scoped_refptr<Layer> outer_viewport_scroll_layer) {
1246 page_scale_layer_ = page_scale_layer; 1247 page_scale_layer_ = page_scale_layer;
1247 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; 1248 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer;
1248 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; 1249 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer;
1249 } 1250 }
1250 1251
1251 } // namespace cc 1252 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698