| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/proxy_impl.h" | 5 #include "cc/trees/proxy_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly() | 83 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly() |
| 84 : layer_tree_host(nullptr) {} | 84 : layer_tree_host(nullptr) {} |
| 85 | 85 |
| 86 ProxyImpl::BlockedMainCommitOnly::~BlockedMainCommitOnly() {} | 86 ProxyImpl::BlockedMainCommitOnly::~BlockedMainCommitOnly() {} |
| 87 | 87 |
| 88 ProxyImpl::~ProxyImpl() { | 88 ProxyImpl::~ProxyImpl() { |
| 89 TRACE_EVENT0("cc", "ProxyImpl::~ProxyImpl"); | 89 TRACE_EVENT0("cc", "ProxyImpl::~ProxyImpl"); |
| 90 DCHECK(IsImplThread()); | 90 DCHECK(IsImplThread()); |
| 91 DCHECK(IsMainThreadBlocked()); | 91 DCHECK(IsMainThreadBlocked()); |
| 92 | 92 |
| 93 // Prevent the scheduler from performing actions while we're in an |
| 94 // inconsistent state. |
| 95 scheduler_->Stop(); |
| 93 // Take away the CompositorFrameSink before destroying things so it doesn't | 96 // Take away the CompositorFrameSink before destroying things so it doesn't |
| 94 // try to call into its client mid-shutdown. | 97 // try to call into its client mid-shutdown. |
| 95 scheduler_->DidLoseCompositorFrameSink(); | |
| 96 layer_tree_host_impl_->ReleaseCompositorFrameSink(); | 98 layer_tree_host_impl_->ReleaseCompositorFrameSink(); |
| 97 | |
| 98 scheduler_ = nullptr; | 99 scheduler_ = nullptr; |
| 99 layer_tree_host_impl_ = nullptr; | 100 layer_tree_host_impl_ = nullptr; |
| 100 // We need to explicitly shutdown the notifier to destroy any weakptrs it is | 101 // We need to explicitly shutdown the notifier to destroy any weakptrs it is |
| 101 // holding while still on the compositor thread. This also ensures any | 102 // holding while still on the compositor thread. This also ensures any |
| 102 // callbacks holding a ProxyImpl pointer are cancelled. | 103 // callbacks holding a ProxyImpl pointer are cancelled. |
| 103 smoothness_priority_expiration_notifier_.Shutdown(); | 104 smoothness_priority_expiration_notifier_.Shutdown(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 void ProxyImpl::InitializeMutatorOnImpl( | 107 void ProxyImpl::InitializeMutatorOnImpl( |
| 107 std::unique_ptr<LayerTreeMutator> mutator) { | 108 std::unique_ptr<LayerTreeMutator> mutator) { |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 bool ProxyImpl::IsMainThreadBlocked() const { | 604 bool ProxyImpl::IsMainThreadBlocked() const { |
| 604 return task_runner_provider_->IsMainThreadBlocked(); | 605 return task_runner_provider_->IsMainThreadBlocked(); |
| 605 } | 606 } |
| 606 | 607 |
| 607 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 608 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 608 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 609 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 609 return main_thread_blocked_commit_vars_unsafe_; | 610 return main_thread_blocked_commit_vars_unsafe_; |
| 610 } | 611 } |
| 611 | 612 |
| 612 } // namespace cc | 613 } // namespace cc |
| OLD | NEW |