| 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } // namespace | 132 } // namespace |
| 133 | 133 |
| 134 LayerTreeHostImpl::FrameData::FrameData() | 134 LayerTreeHostImpl::FrameData::FrameData() |
| 135 : render_surface_layer_list(nullptr), has_no_damage(false) {} | 135 : render_surface_layer_list(nullptr), has_no_damage(false) {} |
| 136 | 136 |
| 137 LayerTreeHostImpl::FrameData::~FrameData() {} | 137 LayerTreeHostImpl::FrameData::~FrameData() {} |
| 138 | 138 |
| 139 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 139 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
| 140 const LayerTreeSettings& settings, | 140 const LayerTreeSettings& settings, |
| 141 LayerTreeHostImplClient* client, | 141 LayerTreeHostImplClient* client, |
| 142 Proxy* proxy, | 142 TaskRunnerProvider* task_runner_provider, |
| 143 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 143 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 144 SharedBitmapManager* shared_bitmap_manager, | 144 SharedBitmapManager* shared_bitmap_manager, |
| 145 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 145 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 146 TaskGraphRunner* task_graph_runner, | 146 TaskGraphRunner* task_graph_runner, |
| 147 int id) { | 147 int id) { |
| 148 return make_scoped_ptr(new LayerTreeHostImpl( | 148 return make_scoped_ptr(new LayerTreeHostImpl( |
| 149 settings, client, proxy, rendering_stats_instrumentation, | 149 settings, client, task_runner_provider, rendering_stats_instrumentation, |
| 150 shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner, id)); | 150 shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner, id)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 LayerTreeHostImpl::LayerTreeHostImpl( | 153 LayerTreeHostImpl::LayerTreeHostImpl( |
| 154 const LayerTreeSettings& settings, | 154 const LayerTreeSettings& settings, |
| 155 LayerTreeHostImplClient* client, | 155 LayerTreeHostImplClient* client, |
| 156 Proxy* proxy, | 156 TaskRunnerProvider* task_runner_provider, |
| 157 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 157 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 158 SharedBitmapManager* shared_bitmap_manager, | 158 SharedBitmapManager* shared_bitmap_manager, |
| 159 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 159 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 160 TaskGraphRunner* task_graph_runner, | 160 TaskGraphRunner* task_graph_runner, |
| 161 int id) | 161 int id) |
| 162 : client_(client), | 162 : client_(client), |
| 163 proxy_(proxy), | 163 task_runner_provider_(task_runner_provider), |
| 164 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), | 164 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), |
| 165 output_surface_(nullptr), | 165 output_surface_(nullptr), |
| 166 content_is_suitable_for_gpu_rasterization_(true), | 166 content_is_suitable_for_gpu_rasterization_(true), |
| 167 has_gpu_rasterization_trigger_(false), | 167 has_gpu_rasterization_trigger_(false), |
| 168 use_gpu_rasterization_(false), | 168 use_gpu_rasterization_(false), |
| 169 use_msaa_(false), | 169 use_msaa_(false), |
| 170 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), | 170 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), |
| 171 tree_resources_for_gpu_rasterization_dirty_(false), | 171 tree_resources_for_gpu_rasterization_dirty_(false), |
| 172 input_handler_client_(NULL), | 172 input_handler_client_(NULL), |
| 173 did_lock_scrolling_layer_(false), | 173 did_lock_scrolling_layer_(false), |
| 174 wheel_scrolling_(false), | 174 wheel_scrolling_(false), |
| 175 scroll_affects_scroll_handler_(false), | 175 scroll_affects_scroll_handler_(false), |
| 176 scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID), | 176 scroll_layer_id_when_mouse_over_scrollbar_(Layer::INVALID_ID), |
| 177 tile_priorities_dirty_(false), | 177 tile_priorities_dirty_(false), |
| 178 settings_(settings), | 178 settings_(settings), |
| 179 visible_(false), | 179 visible_(false), |
| 180 cached_managed_memory_policy_(settings.memory_policy_), | 180 cached_managed_memory_policy_(settings.memory_policy_), |
| 181 is_synchronous_single_threaded_(!proxy->HasImplThread() && | 181 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && |
| 182 !settings.single_thread_proxy_scheduler), | 182 !settings.single_thread_proxy_scheduler), |
| 183 // Must be initialized after is_synchronous_single_threaded_ and proxy_. | 183 // Must be initialized after is_synchronous_single_threaded_ and |
| 184 // task_runner_provider_. |
| 184 tile_manager_( | 185 tile_manager_( |
| 185 TileManager::Create(this, | 186 TileManager::Create(this, |
| 186 GetTaskRunner(), | 187 GetTaskRunner(), |
| 187 is_synchronous_single_threaded_ | 188 is_synchronous_single_threaded_ |
| 188 ? std::numeric_limits<size_t>::max() | 189 ? std::numeric_limits<size_t>::max() |
| 189 : settings.scheduled_raster_task_limit, | 190 : settings.scheduled_raster_task_limit, |
| 190 settings.use_partial_raster)), | 191 settings.use_partial_raster)), |
| 191 pinch_gesture_active_(false), | 192 pinch_gesture_active_(false), |
| 192 pinch_gesture_end_should_clear_scrolling_layer_(false), | 193 pinch_gesture_end_should_clear_scrolling_layer_(false), |
| 193 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())), | 194 fps_counter_( |
| 195 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), |
| 194 memory_history_(MemoryHistory::Create()), | 196 memory_history_(MemoryHistory::Create()), |
| 195 debug_rect_history_(DebugRectHistory::Create()), | 197 debug_rect_history_(DebugRectHistory::Create()), |
| 196 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), | 198 texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), |
| 197 max_memory_needed_bytes_(0), | 199 max_memory_needed_bytes_(0), |
| 198 resourceless_software_draw_(false), | 200 resourceless_software_draw_(false), |
| 199 animation_registrar_(), | 201 animation_registrar_(), |
| 200 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 202 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| 201 micro_benchmark_controller_(this), | 203 micro_benchmark_controller_(this), |
| 202 shared_bitmap_manager_(shared_bitmap_manager), | 204 shared_bitmap_manager_(shared_bitmap_manager), |
| 203 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 205 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
| 204 task_graph_runner_(task_graph_runner), | 206 task_graph_runner_(task_graph_runner), |
| 205 id_(id), | 207 id_(id), |
| 206 requires_high_res_to_draw_(false), | 208 requires_high_res_to_draw_(false), |
| 207 is_likely_to_require_a_draw_(false), | 209 is_likely_to_require_a_draw_(false), |
| 208 frame_timing_tracker_(FrameTimingTracker::Create(this)) { | 210 frame_timing_tracker_(FrameTimingTracker::Create(this)) { |
| 209 if (settings.use_compositor_animation_timelines) { | 211 if (settings.use_compositor_animation_timelines) { |
| 210 if (settings.accelerated_animation_enabled) { | 212 if (settings.accelerated_animation_enabled) { |
| 211 animation_host_ = AnimationHost::Create(ThreadInstance::IMPL); | 213 animation_host_ = AnimationHost::Create(ThreadInstance::IMPL); |
| 212 animation_host_->SetMutatorHostClient(this); | 214 animation_host_->SetMutatorHostClient(this); |
| 213 animation_host_->SetSupportsScrollAnimations( | 215 animation_host_->SetSupportsScrollAnimations(SupportsImplScrolling()); |
| 214 proxy_->SupportsImplScrolling()); | |
| 215 } | 216 } |
| 216 } else { | 217 } else { |
| 217 animation_registrar_ = AnimationRegistrar::Create(); | 218 animation_registrar_ = AnimationRegistrar::Create(); |
| 218 animation_registrar_->set_supports_scroll_animations( | 219 animation_registrar_->set_supports_scroll_animations( |
| 219 proxy_->SupportsImplScrolling()); | 220 SupportsImplScrolling()); |
| 220 } | 221 } |
| 221 | 222 |
| 222 DCHECK(proxy_->IsImplThread()); | 223 DCHECK(task_runner_provider_->IsImplThread()); |
| 223 DidVisibilityChange(this, visible_); | 224 DidVisibilityChange(this, visible_); |
| 224 | 225 |
| 225 SetDebugState(settings.initial_debug_state); | 226 SetDebugState(settings.initial_debug_state); |
| 226 | 227 |
| 227 // LTHI always has an active tree. | 228 // LTHI always has an active tree. |
| 228 active_tree_ = | 229 active_tree_ = |
| 229 LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), | 230 LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), |
| 230 new SyncedTopControls, new SyncedElasticOverscroll); | 231 new SyncedTopControls, new SyncedElasticOverscroll); |
| 231 | 232 |
| 232 viewport_ = Viewport::Create(this); | 233 viewport_ = Viewport::Create(this); |
| 233 | 234 |
| 234 TRACE_EVENT_OBJECT_CREATED_WITH_ID( | 235 TRACE_EVENT_OBJECT_CREATED_WITH_ID( |
| 235 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 236 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
| 236 | 237 |
| 237 top_controls_manager_ = | 238 top_controls_manager_ = |
| 238 TopControlsManager::Create(this, | 239 TopControlsManager::Create(this, |
| 239 settings.top_controls_show_threshold, | 240 settings.top_controls_show_threshold, |
| 240 settings.top_controls_hide_threshold); | 241 settings.top_controls_hide_threshold); |
| 241 } | 242 } |
| 242 | 243 |
| 243 LayerTreeHostImpl::~LayerTreeHostImpl() { | 244 LayerTreeHostImpl::~LayerTreeHostImpl() { |
| 244 DCHECK(proxy_->IsImplThread()); | 245 DCHECK(task_runner_provider_->IsImplThread()); |
| 245 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 246 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
| 246 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 247 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 247 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 248 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
| 248 | 249 |
| 249 if (input_handler_client_) { | 250 if (input_handler_client_) { |
| 250 input_handler_client_->WillShutdown(); | 251 input_handler_client_->WillShutdown(); |
| 251 input_handler_client_ = NULL; | 252 input_handler_client_ = NULL; |
| 252 } | 253 } |
| 253 if (scroll_elasticity_helper_) | 254 if (scroll_elasticity_helper_) |
| 254 scroll_elasticity_helper_.reset(); | 255 scroll_elasticity_helper_.reset(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 294 |
| 294 // Ensure all textures are returned so partial texture updates can happen | 295 // Ensure all textures are returned so partial texture updates can happen |
| 295 // during the commit. | 296 // during the commit. |
| 296 // TODO(ericrk): We should not need to ForceReclaimResources when using | 297 // TODO(ericrk): We should not need to ForceReclaimResources when using |
| 297 // Impl-side-painting as it doesn't upload during commits. However, | 298 // Impl-side-painting as it doesn't upload during commits. However, |
| 298 // Display::Draw currently relies on resource being reclaimed to block drawing | 299 // Display::Draw currently relies on resource being reclaimed to block drawing |
| 299 // between BeginCommit / Swap. See crbug.com/489515. | 300 // between BeginCommit / Swap. See crbug.com/489515. |
| 300 if (output_surface_) | 301 if (output_surface_) |
| 301 output_surface_->ForceReclaimResources(); | 302 output_surface_->ForceReclaimResources(); |
| 302 | 303 |
| 303 if (!proxy_->CommitToActiveTree()) | 304 if (!CommitToActiveTree()) |
| 304 CreatePendingTree(); | 305 CreatePendingTree(); |
| 305 } | 306 } |
| 306 | 307 |
| 307 void LayerTreeHostImpl::CommitComplete() { | 308 void LayerTreeHostImpl::CommitComplete() { |
| 308 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 309 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
| 309 | 310 |
| 310 if (proxy_->CommitToActiveTree()) { | 311 if (CommitToActiveTree()) { |
| 311 // We have to activate animations here or "IsActive()" is true on the layers | 312 // We have to activate animations here or "IsActive()" is true on the layers |
| 312 // but the animations aren't activated yet so they get ignored by | 313 // but the animations aren't activated yet so they get ignored by |
| 313 // UpdateDrawProperties. | 314 // UpdateDrawProperties. |
| 314 ActivateAnimations(); | 315 ActivateAnimations(); |
| 315 } | 316 } |
| 316 | 317 |
| 317 // Start animations before UpdateDrawProperties and PrepareTiles, as they can | 318 // Start animations before UpdateDrawProperties and PrepareTiles, as they can |
| 318 // change the results. When doing commit to the active tree, this must happen | 319 // change the results. When doing commit to the active tree, this must happen |
| 319 // after ActivateAnimations() in order for this ticking to be propogated to | 320 // after ActivateAnimations() in order for this ticking to be propogated to |
| 320 // layers on the active tree. | 321 // layers on the active tree. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 335 // TODO(vmpstr): Investigate always having PrepareTiles issue | 336 // TODO(vmpstr): Investigate always having PrepareTiles issue |
| 336 // NotifyReadyToActivate, instead of handling it here. | 337 // NotifyReadyToActivate, instead of handling it here. |
| 337 bool did_prepare_tiles = PrepareTiles(); | 338 bool did_prepare_tiles = PrepareTiles(); |
| 338 if (!did_prepare_tiles) { | 339 if (!did_prepare_tiles) { |
| 339 NotifyReadyToActivate(); | 340 NotifyReadyToActivate(); |
| 340 | 341 |
| 341 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This | 342 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This |
| 342 // is important for SingleThreadProxy and impl-side painting case. For | 343 // is important for SingleThreadProxy and impl-side painting case. For |
| 343 // STP, we commit to active tree and RequiresHighResToDraw, and set | 344 // STP, we commit to active tree and RequiresHighResToDraw, and set |
| 344 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard. | 345 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard. |
| 345 if (proxy_->CommitToActiveTree()) | 346 if (CommitToActiveTree()) |
| 346 NotifyReadyToDraw(); | 347 NotifyReadyToDraw(); |
| 347 } | 348 } |
| 348 | 349 |
| 349 micro_benchmark_controller_.DidCompleteCommit(); | 350 micro_benchmark_controller_.DidCompleteCommit(); |
| 350 } | 351 } |
| 351 | 352 |
| 352 bool LayerTreeHostImpl::CanDraw() const { | 353 bool LayerTreeHostImpl::CanDraw() const { |
| 353 // Note: If you are changing this function or any other function that might | 354 // Note: If you are changing this function or any other function that might |
| 354 // affect the result of CanDraw, make sure to call | 355 // affect the result of CanDraw, make sure to call |
| 355 // client_->OnCanDrawStateChanged in the proper places and update the | 356 // client_->OnCanDrawStateChanged in the proper places and update the |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 if (EvictedUIResourcesExist()) { | 390 if (EvictedUIResourcesExist()) { |
| 390 TRACE_EVENT_INSTANT0( | 391 TRACE_EVENT_INSTANT0( |
| 391 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", | 392 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", |
| 392 TRACE_EVENT_SCOPE_THREAD); | 393 TRACE_EVENT_SCOPE_THREAD); |
| 393 return false; | 394 return false; |
| 394 } | 395 } |
| 395 return true; | 396 return true; |
| 396 } | 397 } |
| 397 | 398 |
| 398 void LayerTreeHostImpl::Animate() { | 399 void LayerTreeHostImpl::Animate() { |
| 399 DCHECK(proxy_->IsImplThread()); | 400 DCHECK(task_runner_provider_->IsImplThread()); |
| 400 base::TimeTicks monotonic_time = CurrentBeginFrameArgs().frame_time; | 401 base::TimeTicks monotonic_time = CurrentBeginFrameArgs().frame_time; |
| 401 | 402 |
| 402 // mithro(TODO): Enable these checks. | 403 // mithro(TODO): Enable these checks. |
| 403 // DCHECK(!current_begin_frame_tracker_.HasFinished()); | 404 // DCHECK(!current_begin_frame_tracker_.HasFinished()); |
| 404 // DCHECK(monotonic_time == current_begin_frame_tracker_.Current().frame_time) | 405 // DCHECK(monotonic_time == current_begin_frame_tracker_.Current().frame_time) |
| 405 // << "Called animate with unknown frame time!?"; | 406 // << "Called animate with unknown frame time!?"; |
| 406 | 407 |
| 407 if (input_handler_client_) { | 408 if (input_handler_client_) { |
| 408 // This animates fling scrolls. But on Android WebView root flings are | 409 // This animates fling scrolls. But on Android WebView root flings are |
| 409 // controlled by the application, so the compositor does not animate them. | 410 // controlled by the application, so the compositor does not animate them. |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 // destroyed. | 1349 // destroyed. |
| 1349 NotifyAllTileTasksCompleted(); | 1350 NotifyAllTileTasksCompleted(); |
| 1350 | 1351 |
| 1351 CreateTileManagerResources(); | 1352 CreateTileManagerResources(); |
| 1352 RecreateTreeResources(); | 1353 RecreateTreeResources(); |
| 1353 } | 1354 } |
| 1354 } | 1355 } |
| 1355 | 1356 |
| 1356 void LayerTreeHostImpl::SetTreeActivationCallback( | 1357 void LayerTreeHostImpl::SetTreeActivationCallback( |
| 1357 const base::Closure& callback) { | 1358 const base::Closure& callback) { |
| 1358 DCHECK(proxy_->IsImplThread()); | 1359 DCHECK(task_runner_provider_->IsImplThread()); |
| 1359 tree_activation_callback_ = callback; | 1360 tree_activation_callback_ = callback; |
| 1360 } | 1361 } |
| 1361 | 1362 |
| 1362 void LayerTreeHostImpl::SetManagedMemoryPolicy( | 1363 void LayerTreeHostImpl::SetManagedMemoryPolicy( |
| 1363 const ManagedMemoryPolicy& policy) { | 1364 const ManagedMemoryPolicy& policy) { |
| 1364 if (cached_managed_memory_policy_ == policy) | 1365 if (cached_managed_memory_policy_ == policy) |
| 1365 return; | 1366 return; |
| 1366 | 1367 |
| 1367 ManagedMemoryPolicy old_policy = ActualManagedMemoryPolicy(); | 1368 ManagedMemoryPolicy old_policy = ActualManagedMemoryPolicy(); |
| 1368 | 1369 |
| 1369 cached_managed_memory_policy_ = policy; | 1370 cached_managed_memory_policy_ = policy; |
| 1370 ManagedMemoryPolicy actual_policy = ActualManagedMemoryPolicy(); | 1371 ManagedMemoryPolicy actual_policy = ActualManagedMemoryPolicy(); |
| 1371 | 1372 |
| 1372 if (old_policy == actual_policy) | 1373 if (old_policy == actual_policy) |
| 1373 return; | 1374 return; |
| 1374 | 1375 |
| 1375 if (!proxy_->HasImplThread()) { | 1376 if (!task_runner_provider_->HasImplThread()) { |
| 1376 // In single-thread mode, this can be called on the main thread by | 1377 // In single-thread mode, this can be called on the main thread by |
| 1377 // GLRenderer::OnMemoryAllocationChanged. | 1378 // GLRenderer::OnMemoryAllocationChanged. |
| 1378 DebugScopedSetImplThread impl_thread(proxy_); | 1379 DebugScopedSetImplThread impl_thread(task_runner_provider_); |
| 1379 UpdateTileManagerMemoryPolicy(actual_policy); | 1380 UpdateTileManagerMemoryPolicy(actual_policy); |
| 1380 } else { | 1381 } else { |
| 1381 DCHECK(proxy_->IsImplThread()); | 1382 DCHECK(task_runner_provider_->IsImplThread()); |
| 1382 UpdateTileManagerMemoryPolicy(actual_policy); | 1383 UpdateTileManagerMemoryPolicy(actual_policy); |
| 1383 } | 1384 } |
| 1384 | 1385 |
| 1385 // If there is already enough memory to draw everything imaginable and the | 1386 // If there is already enough memory to draw everything imaginable and the |
| 1386 // new memory limit does not change this, then do not re-commit. Don't bother | 1387 // new memory limit does not change this, then do not re-commit. Don't bother |
| 1387 // skipping commits if this is not visible (commits don't happen when not | 1388 // skipping commits if this is not visible (commits don't happen when not |
| 1388 // visible, there will almost always be a commit when this becomes visible). | 1389 // visible, there will almost always be a commit when this becomes visible). |
| 1389 bool needs_commit = true; | 1390 bool needs_commit = true; |
| 1390 if (visible() && | 1391 if (visible() && |
| 1391 actual_policy.bytes_limit_when_visible >= max_memory_needed_bytes_ && | 1392 actual_policy.bytes_limit_when_visible >= max_memory_needed_bytes_ && |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 pending_page_scale_animation->use_anchor, | 1980 pending_page_scale_animation->use_anchor, |
| 1980 pending_page_scale_animation->scale, | 1981 pending_page_scale_animation->scale, |
| 1981 pending_page_scale_animation->duration); | 1982 pending_page_scale_animation->duration); |
| 1982 } | 1983 } |
| 1983 // Activation can change the root scroll offset, so inform the synchronous | 1984 // Activation can change the root scroll offset, so inform the synchronous |
| 1984 // input handler. | 1985 // input handler. |
| 1985 UpdateRootLayerStateForSynchronousInputHandler(); | 1986 UpdateRootLayerStateForSynchronousInputHandler(); |
| 1986 } | 1987 } |
| 1987 | 1988 |
| 1988 void LayerTreeHostImpl::SetVisible(bool visible) { | 1989 void LayerTreeHostImpl::SetVisible(bool visible) { |
| 1989 DCHECK(proxy_->IsImplThread()); | 1990 DCHECK(task_runner_provider_->IsImplThread()); |
| 1990 | 1991 |
| 1991 if (visible_ == visible) | 1992 if (visible_ == visible) |
| 1992 return; | 1993 return; |
| 1993 visible_ = visible; | 1994 visible_ = visible; |
| 1994 DidVisibilityChange(this, visible_); | 1995 DidVisibilityChange(this, visible_); |
| 1995 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); | 1996 UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); |
| 1996 | 1997 |
| 1997 // If we just became visible, we have to ensure that we draw high res tiles, | 1998 // If we just became visible, we have to ensure that we draw high res tiles, |
| 1998 // to prevent checkerboard/low res flashes. | 1999 // to prevent checkerboard/low res flashes. |
| 1999 if (visible_) | 2000 if (visible_) |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2231 if (!output_surface->BindToClient(this)) { | 2232 if (!output_surface->BindToClient(this)) { |
| 2232 // Avoid recreating tree resources because we might not have enough | 2233 // Avoid recreating tree resources because we might not have enough |
| 2233 // information to do this yet (eg. we don't have a TileManager at this | 2234 // information to do this yet (eg. we don't have a TileManager at this |
| 2234 // point). | 2235 // point). |
| 2235 return false; | 2236 return false; |
| 2236 } | 2237 } |
| 2237 | 2238 |
| 2238 output_surface_ = output_surface; | 2239 output_surface_ = output_surface; |
| 2239 resource_provider_ = ResourceProvider::Create( | 2240 resource_provider_ = ResourceProvider::Create( |
| 2240 output_surface_, shared_bitmap_manager_, gpu_memory_buffer_manager_, | 2241 output_surface_, shared_bitmap_manager_, gpu_memory_buffer_manager_, |
| 2241 proxy_->blocking_main_thread_task_runner(), | 2242 task_runner_provider_->blocking_main_thread_task_runner(), |
| 2242 settings_.renderer_settings.highp_threshold_min, | 2243 settings_.renderer_settings.highp_threshold_min, |
| 2243 settings_.renderer_settings.texture_id_allocation_chunk_size, | 2244 settings_.renderer_settings.texture_id_allocation_chunk_size, |
| 2244 settings_.use_image_texture_targets); | 2245 settings_.use_image_texture_targets); |
| 2245 | 2246 |
| 2246 CreateAndSetRenderer(); | 2247 CreateAndSetRenderer(); |
| 2247 | 2248 |
| 2248 // Since the new renderer may be capable of MSAA, update status here. | 2249 // Since the new renderer may be capable of MSAA, update status here. |
| 2249 UpdateGpuRasterizationStatus(); | 2250 UpdateGpuRasterizationStatus(); |
| 2250 | 2251 |
| 2251 CreateTileManagerResources(); | 2252 CreateTileManagerResources(); |
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3637 int layer_id) const { | 3638 int layer_id) const { |
| 3638 if (active_tree()) { | 3639 if (active_tree()) { |
| 3639 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3640 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
| 3640 if (layer) | 3641 if (layer) |
| 3641 return layer->ScrollOffsetForAnimation(); | 3642 return layer->ScrollOffsetForAnimation(); |
| 3642 } | 3643 } |
| 3643 | 3644 |
| 3644 return gfx::ScrollOffset(); | 3645 return gfx::ScrollOffset(); |
| 3645 } | 3646 } |
| 3646 | 3647 |
| 3648 bool LayerTreeHostImpl::SupportsImplScrolling() const { |
| 3649 // Supported in threaded mode. |
| 3650 return task_runner_provider_->HasImplThread(); |
| 3651 } |
| 3652 |
| 3653 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3654 // In single threaded mode we skip the pending tree and commit directly to the |
| 3655 // active tree. |
| 3656 return !task_runner_provider_->HasImplThread(); |
| 3657 } |
| 3658 |
| 3647 } // namespace cc | 3659 } // namespace cc |
| OLD | NEW |