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/single_thread_proxy.h" | 5 #include "cc/trees/single_thread_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return commit_requested_; | 282 return commit_requested_; |
283 } | 283 } |
284 | 284 |
285 void SingleThreadProxy::Stop() { | 285 void SingleThreadProxy::Stop() { |
286 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); | 286 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); |
287 DCHECK(task_runner_provider_->IsMainThread()); | 287 DCHECK(task_runner_provider_->IsMainThread()); |
288 { | 288 { |
289 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); | 289 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); |
290 DebugScopedSetImplThread impl(task_runner_provider_); | 290 DebugScopedSetImplThread impl(task_runner_provider_); |
291 | 291 |
| 292 // Prevent the scheduler from performing actions while we're in an |
| 293 // inconsistent state. |
| 294 if (scheduler_on_impl_thread_) |
| 295 scheduler_on_impl_thread_->Stop(); |
292 // Take away the CompositorFrameSink before destroying things so it doesn't | 296 // Take away the CompositorFrameSink before destroying things so it doesn't |
293 // try to call into its client mid-shutdown. | 297 // try to call into its client mid-shutdown. |
294 layer_tree_host_impl_->ReleaseCompositorFrameSink(); | 298 layer_tree_host_impl_->ReleaseCompositorFrameSink(); |
295 | |
296 BlockingTaskRunner::CapturePostTasks blocked( | |
297 task_runner_provider_->blocking_main_thread_task_runner()); | |
298 scheduler_on_impl_thread_ = nullptr; | 299 scheduler_on_impl_thread_ = nullptr; |
299 layer_tree_host_impl_ = nullptr; | 300 layer_tree_host_impl_ = nullptr; |
300 } | 301 } |
301 layer_tree_host_ = NULL; | 302 layer_tree_host_ = nullptr; |
302 } | 303 } |
303 | 304 |
304 void SingleThreadProxy::SetMutator(std::unique_ptr<LayerTreeMutator> mutator) { | 305 void SingleThreadProxy::SetMutator(std::unique_ptr<LayerTreeMutator> mutator) { |
305 DCHECK(task_runner_provider_->IsMainThread()); | 306 DCHECK(task_runner_provider_->IsMainThread()); |
306 DebugScopedSetImplThread impl(task_runner_provider_); | 307 DebugScopedSetImplThread impl(task_runner_provider_); |
307 layer_tree_host_impl_->SetLayerTreeMutator(std::move(mutator)); | 308 layer_tree_host_impl_->SetLayerTreeMutator(std::move(mutator)); |
308 } | 309 } |
309 | 310 |
310 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 311 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
311 TRACE_EVENT1("cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", | 312 TRACE_EVENT1("cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 void SingleThreadProxy::DidFinishImplFrame() { | 742 void SingleThreadProxy::DidFinishImplFrame() { |
742 layer_tree_host_impl_->DidFinishImplFrame(); | 743 layer_tree_host_impl_->DidFinishImplFrame(); |
743 #if DCHECK_IS_ON() | 744 #if DCHECK_IS_ON() |
744 DCHECK(inside_impl_frame_) | 745 DCHECK(inside_impl_frame_) |
745 << "DidFinishImplFrame called while not inside an impl frame!"; | 746 << "DidFinishImplFrame called while not inside an impl frame!"; |
746 inside_impl_frame_ = false; | 747 inside_impl_frame_ = false; |
747 #endif | 748 #endif |
748 } | 749 } |
749 | 750 |
750 } // namespace cc | 751 } // namespace cc |
OLD | NEW |