| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 settings.top_controls_show_threshold, | 268 settings.top_controls_show_threshold, |
| 269 settings.top_controls_hide_threshold); | 269 settings.top_controls_hide_threshold); |
| 270 } | 270 } |
| 271 | 271 |
| 272 LayerTreeHostImpl::~LayerTreeHostImpl() { | 272 LayerTreeHostImpl::~LayerTreeHostImpl() { |
| 273 DCHECK(task_runner_provider_->IsImplThread()); | 273 DCHECK(task_runner_provider_->IsImplThread()); |
| 274 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 274 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
| 275 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 275 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 276 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 276 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
| 277 | 277 |
| 278 // It is released before shutdown. |
| 279 DCHECK(!output_surface_); |
| 280 |
| 278 if (input_handler_client_) { | 281 if (input_handler_client_) { |
| 279 input_handler_client_->WillShutdown(); | 282 input_handler_client_->WillShutdown(); |
| 280 input_handler_client_ = NULL; | 283 input_handler_client_ = NULL; |
| 281 } | 284 } |
| 282 if (scroll_elasticity_helper_) | 285 if (scroll_elasticity_helper_) |
| 283 scroll_elasticity_helper_.reset(); | 286 scroll_elasticity_helper_.reset(); |
| 284 | 287 |
| 285 // The layer trees must be destroyed before the layer tree host. We've | 288 // The layer trees must be destroyed before the layer tree host. We've |
| 286 // made a contract with our animation controllers that the animation_host | 289 // made a contract with our animation controllers that the animation_host |
| 287 // will outlive them, and we must make good. | 290 // will outlive them, and we must make good. |
| 288 if (recycle_tree_) | 291 if (recycle_tree_) |
| 289 recycle_tree_->Shutdown(); | 292 recycle_tree_->Shutdown(); |
| 290 if (pending_tree_) | 293 if (pending_tree_) |
| 291 pending_tree_->Shutdown(); | 294 pending_tree_->Shutdown(); |
| 292 active_tree_->Shutdown(); | 295 active_tree_->Shutdown(); |
| 293 recycle_tree_ = nullptr; | 296 recycle_tree_ = nullptr; |
| 294 pending_tree_ = nullptr; | 297 pending_tree_ = nullptr; |
| 295 active_tree_ = nullptr; | 298 active_tree_ = nullptr; |
| 296 | 299 |
| 297 animation_host_->ClearTimelines(); | 300 animation_host_->ClearTimelines(); |
| 298 animation_host_->SetMutatorHostClient(nullptr); | 301 animation_host_->SetMutatorHostClient(nullptr); |
| 299 | 302 |
| 300 CleanUpTileManagerAndUIResources(); | 303 CleanUpTileManagerAndUIResources(); |
| 301 renderer_ = nullptr; | 304 renderer_ = nullptr; |
| 302 resource_provider_ = nullptr; | 305 resource_provider_ = nullptr; |
| 303 | |
| 304 if (output_surface_) { | |
| 305 output_surface_->DetachFromClient(); | |
| 306 output_surface_ = nullptr; | |
| 307 } | |
| 308 } | 306 } |
| 309 | 307 |
| 310 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { | 308 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { |
| 311 // If the begin frame data was handled, then scroll and scale set was applied | 309 // If the begin frame data was handled, then scroll and scale set was applied |
| 312 // by the main thread, so the active tree needs to be updated as if these sent | 310 // by the main thread, so the active tree needs to be updated as if these sent |
| 313 // values were applied and committed. | 311 // values were applied and committed. |
| 314 if (CommitEarlyOutHandledCommit(reason)) | 312 if (CommitEarlyOutHandledCommit(reason)) |
| 315 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); | 313 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); |
| 316 } | 314 } |
| 317 | 315 |
| (...skipping 3692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4010 return task_runner_provider_->HasImplThread(); | 4008 return task_runner_provider_->HasImplThread(); |
| 4011 } | 4009 } |
| 4012 | 4010 |
| 4013 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4011 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4014 // In single threaded mode we skip the pending tree and commit directly to the | 4012 // In single threaded mode we skip the pending tree and commit directly to the |
| 4015 // active tree. | 4013 // active tree. |
| 4016 return !task_runner_provider_->HasImplThread(); | 4014 return !task_runner_provider_->HasImplThread(); |
| 4017 } | 4015 } |
| 4018 | 4016 |
| 4019 } // namespace cc | 4017 } // namespace cc |
| OLD | NEW |