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