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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 overdraw_bottom_height_(0.f), | 123 overdraw_bottom_height_(0.f), |
124 device_scale_factor_(1.f), | 124 device_scale_factor_(1.f), |
125 visible_(true), | 125 visible_(true), |
126 page_scale_factor_(1.f), | 126 page_scale_factor_(1.f), |
127 min_page_scale_factor_(1.f), | 127 min_page_scale_factor_(1.f), |
128 max_page_scale_factor_(1.f), | 128 max_page_scale_factor_(1.f), |
129 trigger_idle_updates_(true), | 129 trigger_idle_updates_(true), |
130 background_color_(SK_ColorWHITE), | 130 background_color_(SK_ColorWHITE), |
131 has_transparent_background_(false), | 131 has_transparent_background_(false), |
132 partial_texture_update_requests_(0), | 132 partial_texture_update_requests_(0), |
133 max_partial_texture_updates_(settings_.max_partial_texture_updates), | |
danakj
2013/10/03 17:42:26
Can we initialize this to 0?
| |
133 in_paint_layer_contents_(false), | 134 in_paint_layer_contents_(false), |
134 total_frames_used_for_lcd_text_metrics_(0), | 135 total_frames_used_for_lcd_text_metrics_(0), |
135 tree_id_(s_next_tree_id++) { | 136 tree_id_(s_next_tree_id++) { |
136 if (settings_.accelerated_animation_enabled) | 137 if (settings_.accelerated_animation_enabled) |
137 animation_registrar_ = AnimationRegistrar::Create(); | 138 animation_registrar_ = AnimationRegistrar::Create(); |
138 s_num_layer_tree_instances++; | 139 s_num_layer_tree_instances++; |
139 rendering_stats_instrumentation_->set_record_rendering_stats( | 140 rendering_stats_instrumentation_->set_record_rendering_stats( |
140 debug_state_.RecordRenderingStats()); | 141 debug_state_.RecordRenderingStats()); |
141 } | 142 } |
142 | 143 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { | 199 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) { |
199 TRACE_EVENT1("cc", | 200 TRACE_EVENT1("cc", |
200 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted", | 201 "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted", |
201 "success", | 202 "success", |
202 success); | 203 success); |
203 | 204 |
204 DCHECK(output_surface_lost_); | 205 DCHECK(output_surface_lost_); |
205 if (success) { | 206 if (success) { |
206 output_surface_lost_ = false; | 207 output_surface_lost_ = false; |
207 | 208 |
208 // Update settings_ based on partial update capability. | 209 // Update max_partial_texture_updates_ based on partial update capability. |
209 size_t max_partial_texture_updates = 0; | 210 size_t max_partial_texture_updates = 0; |
210 if (proxy_->GetRendererCapabilities().allow_partial_texture_updates && | 211 if (proxy_->GetRendererCapabilities().allow_partial_texture_updates && |
211 !settings_.impl_side_painting) { | 212 !settings_.impl_side_painting) { |
212 max_partial_texture_updates = std::min( | 213 max_partial_texture_updates = std::min( |
213 settings_.max_partial_texture_updates, | 214 settings_.max_partial_texture_updates, |
214 proxy_->MaxPartialTextureUpdates()); | 215 proxy_->MaxPartialTextureUpdates()); |
215 } | 216 } |
216 settings_.max_partial_texture_updates = max_partial_texture_updates; | 217 max_partial_texture_updates_ = max_partial_texture_updates; |
217 | 218 |
218 if (!contents_texture_manager_ && | 219 if (!contents_texture_manager_ && |
219 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) { | 220 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) { |
220 contents_texture_manager_ = | 221 contents_texture_manager_ = |
221 PrioritizedResourceManager::Create(proxy_.get()); | 222 PrioritizedResourceManager::Create(proxy_.get()); |
222 surface_memory_placeholder_ = | 223 surface_memory_placeholder_ = |
223 contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888); | 224 contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888); |
224 } | 225 } |
225 | 226 |
226 client_->DidInitializeOutputSurface(true); | 227 client_->DidInitializeOutputSurface(true); |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1112 } | 1113 } |
1113 | 1114 |
1114 void LayerTreeHost::RateLimit() { | 1115 void LayerTreeHost::RateLimit() { |
1115 // Force a no-op command on the compositor context, so that any ratelimiting | 1116 // Force a no-op command on the compositor context, so that any ratelimiting |
1116 // commands will wait for the compositing context, and therefore for the | 1117 // commands will wait for the compositing context, and therefore for the |
1117 // SwapBuffers. | 1118 // SwapBuffers. |
1118 proxy_->ForceSerializeOnSwapBuffers(); | 1119 proxy_->ForceSerializeOnSwapBuffers(); |
1119 } | 1120 } |
1120 | 1121 |
1121 bool LayerTreeHost::RequestPartialTextureUpdate() { | 1122 bool LayerTreeHost::RequestPartialTextureUpdate() { |
1122 if (partial_texture_update_requests_ >= settings_.max_partial_texture_updates) | 1123 if (partial_texture_update_requests_ >= MaxPartialTextureUpdates()) |
1123 return false; | 1124 return false; |
1124 | 1125 |
1125 partial_texture_update_requests_++; | 1126 partial_texture_update_requests_++; |
1126 return true; | 1127 return true; |
1127 } | 1128 } |
1128 | 1129 |
1129 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { | 1130 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { |
1130 if (device_scale_factor == device_scale_factor_) | 1131 if (device_scale_factor == device_scale_factor_) |
1131 return; | 1132 return; |
1132 device_scale_factor_ = device_scale_factor; | 1133 device_scale_factor_ = device_scale_factor; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1236 void LayerTreeHost::RegisterViewportLayers( | 1237 void LayerTreeHost::RegisterViewportLayers( |
1237 scoped_refptr<Layer> page_scale_layer, | 1238 scoped_refptr<Layer> page_scale_layer, |
1238 scoped_refptr<Layer> inner_viewport_scroll_layer, | 1239 scoped_refptr<Layer> inner_viewport_scroll_layer, |
1239 scoped_refptr<Layer> outer_viewport_scroll_layer) { | 1240 scoped_refptr<Layer> outer_viewport_scroll_layer) { |
1240 page_scale_layer_ = page_scale_layer; | 1241 page_scale_layer_ = page_scale_layer; |
1241 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; | 1242 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; |
1242 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; | 1243 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; |
1243 } | 1244 } |
1244 | 1245 |
1245 } // namespace cc | 1246 } // namespace cc |
OLD | NEW |