OLD | NEW |
---|---|
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { | 175 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { |
176 TRACE_EVENT1("cc", | 176 TRACE_EVENT1("cc", |
177 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted", | 177 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted", |
178 "success", | 178 "success", |
179 success); | 179 success); |
180 | 180 |
181 DCHECK(output_surface_lost_); | 181 DCHECK(output_surface_lost_); |
182 if (success) { | 182 if (success) { |
183 output_surface_lost_ = false; | 183 output_surface_lost_ = false; |
184 | 184 |
185 // Update settings_ based on partial update capability. | |
186 size_t max_partial_texture_updates = 0; | |
187 if (proxy_->GetRendererCapabilities().allow_partial_texture_updates && | |
188 !settings_.impl_side_painting) { | |
189 max_partial_texture_updates = std::min( | |
190 settings_.max_partial_texture_updates, | |
191 proxy_->MaxPartialTextureUpdates()); | |
192 } | |
193 settings_.max_partial_texture_updates = max_partial_texture_updates; | |
194 | |
195 if (!contents_texture_manager_ && | 185 if (!contents_texture_manager_ && |
196 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) { | 186 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) { |
197 contents_texture_manager_ = | 187 contents_texture_manager_ = |
198 PrioritizedResourceManager::Create(proxy_.get()); | 188 PrioritizedResourceManager::Create(proxy_.get()); |
199 surface_memory_placeholder_ = | 189 surface_memory_placeholder_ = |
200 contents_texture_manager_->CreateTexture(gfx::Size(), GL_RGBA); | 190 contents_texture_manager_->CreateTexture(gfx::Size(), GL_RGBA); |
201 } | 191 } |
202 | 192 |
203 client_->DidInitializeOutputSurface(true); | 193 client_->DidInitializeOutputSurface(true); |
204 return CreateSucceeded; | 194 return CreateSucceeded; |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1078 } | 1068 } |
1079 | 1069 |
1080 void LayerTreeHost::RateLimit() { | 1070 void LayerTreeHost::RateLimit() { |
1081 // Force a no-op command on the compositor context, so that any ratelimiting | 1071 // Force a no-op command on the compositor context, so that any ratelimiting |
1082 // commands will wait for the compositing context, and therefore for the | 1072 // commands will wait for the compositing context, and therefore for the |
1083 // SwapBuffers. | 1073 // SwapBuffers. |
1084 proxy_->ForceSerializeOnSwapBuffers(); | 1074 proxy_->ForceSerializeOnSwapBuffers(); |
1085 } | 1075 } |
1086 | 1076 |
1087 bool LayerTreeHost::RequestPartialTextureUpdate() { | 1077 bool LayerTreeHost::RequestPartialTextureUpdate() { |
1088 if (partial_texture_update_requests_ >= settings_.max_partial_texture_updates) | 1078 size_t max_partial_texture_updates = settings_.max_partial_texture_updates; |
1079 if (proxy_->GetRendererCapabilities().allow_partial_texture_updates && | |
1080 !settings_.impl_side_painting) { | |
danakj
2013/09/17 21:11:19
indenting is off, run "git cl format" before you u
| |
1081 max_partial_texture_updates = std::min( | |
1082 max_partial_texture_updates, | |
1083 proxy_->MaxPartialTextureUpdates()); | |
1084 } | |
1085 | |
1086 if (partial_texture_update_requests_ >= max_partial_texture_updates) | |
1089 return false; | 1087 return false; |
1090 | 1088 |
1091 partial_texture_update_requests_++; | 1089 partial_texture_update_requests_++; |
1092 return true; | 1090 return true; |
1093 } | 1091 } |
1094 | 1092 |
1095 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { | 1093 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { |
1096 if (device_scale_factor == device_scale_factor_) | 1094 if (device_scale_factor == device_scale_factor_) |
1097 return; | 1095 return; |
1098 device_scale_factor_ = device_scale_factor; | 1096 device_scale_factor_ = device_scale_factor; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1182 request.type = UIResourceRequest::UIResourceCreate; | 1180 request.type = UIResourceRequest::UIResourceCreate; |
1183 request.id = uid; | 1181 request.id = uid; |
1184 bool resource_lost = true; | 1182 bool resource_lost = true; |
1185 request.bitmap = iter->second->GetBitmap(uid, resource_lost); | 1183 request.bitmap = iter->second->GetBitmap(uid, resource_lost); |
1186 DCHECK(request.bitmap.get()); | 1184 DCHECK(request.bitmap.get()); |
1187 ui_resource_request_queue_.push_back(request); | 1185 ui_resource_request_queue_.push_back(request); |
1188 } | 1186 } |
1189 } | 1187 } |
1190 | 1188 |
1191 } // namespace cc | 1189 } // namespace cc |
OLD | NEW |