| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 SchedulerSettings scheduler_settings( | 71 SchedulerSettings scheduler_settings( |
| 72 layer_tree_host->settings().ToSchedulerSettings()); | 72 layer_tree_host->settings().ToSchedulerSettings()); |
| 73 | 73 |
| 74 std::unique_ptr<CompositorTimingHistory> compositor_timing_history( | 74 std::unique_ptr<CompositorTimingHistory> compositor_timing_history( |
| 75 new CompositorTimingHistory( | 75 new CompositorTimingHistory( |
| 76 scheduler_settings.using_synchronous_renderer_compositor, | 76 scheduler_settings.using_synchronous_renderer_compositor, |
| 77 CompositorTimingHistory::RENDERER_UMA, | 77 CompositorTimingHistory::RENDERER_UMA, |
| 78 rendering_stats_instrumentation_)); | 78 rendering_stats_instrumentation_)); |
| 79 | 79 |
| 80 BeginFrameSource* frame_source = external_begin_frame_source_.get(); | 80 // BFS must either be external or come from the output surface. If |
| 81 if (!scheduler_settings.throttle_frame_production) { | 81 // external, it must be provided. If from the output surface, it must |
| 82 // Unthrottled source takes precedence over external sources. | 82 // not be provided. |
| 83 unthrottled_begin_frame_source_.reset( | 83 // TODO(enne): make all BFS come from the output surface. |
| 84 new BackToBackBeginFrameSource(base::MakeUnique<DelayBasedTimeSource>( | 84 DCHECK(layer_tree_host->settings().use_external_begin_frame_source ^ |
| 85 task_runner_provider_->ImplThreadTaskRunner()))); | 85 layer_tree_host->settings().use_output_surface_begin_frame_source); |
| 86 frame_source = unthrottled_begin_frame_source_.get(); | 86 DCHECK(!layer_tree_host->settings().use_external_begin_frame_source || |
| 87 } | 87 external_begin_frame_source_.get()); |
| 88 if (!frame_source) { | 88 DCHECK(!layer_tree_host->settings().use_output_surface_begin_frame_source || |
| 89 synthetic_begin_frame_source_.reset( | 89 !external_begin_frame_source_.get()); |
| 90 new DelayBasedBeginFrameSource(base::MakeUnique<DelayBasedTimeSource>( | 90 scheduler_ = Scheduler::Create(this, scheduler_settings, layer_tree_host_id_, |
| 91 task_runner_provider_->ImplThreadTaskRunner()))); | 91 task_runner_provider_->ImplThreadTaskRunner(), |
| 92 frame_source = synthetic_begin_frame_source_.get(); | 92 external_begin_frame_source_.get(), |
| 93 } | 93 std::move(compositor_timing_history)); |
| 94 scheduler_ = | |
| 95 Scheduler::Create(this, scheduler_settings, layer_tree_host_id_, | |
| 96 task_runner_provider_->ImplThreadTaskRunner(), | |
| 97 frame_source, std::move(compositor_timing_history)); | |
| 98 | 94 |
| 99 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible()); | 95 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible()); |
| 100 } | 96 } |
| 101 | 97 |
| 102 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly() | 98 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly() |
| 103 : layer_tree_host(nullptr) {} | 99 : layer_tree_host(nullptr) {} |
| 104 | 100 |
| 105 ProxyImpl::BlockedMainCommitOnly::~BlockedMainCommitOnly() {} | 101 ProxyImpl::BlockedMainCommitOnly::~BlockedMainCommitOnly() {} |
| 106 | 102 |
| 107 ProxyImpl::~ProxyImpl() { | 103 ProxyImpl::~ProxyImpl() { |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 bool ProxyImpl::IsMainThreadBlocked() const { | 655 bool ProxyImpl::IsMainThreadBlocked() const { |
| 660 return task_runner_provider_->IsMainThreadBlocked(); | 656 return task_runner_provider_->IsMainThreadBlocked(); |
| 661 } | 657 } |
| 662 | 658 |
| 663 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 659 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 664 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 660 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 665 return main_thread_blocked_commit_vars_unsafe_; | 661 return main_thread_blocked_commit_vars_unsafe_; |
| 666 } | 662 } |
| 667 | 663 |
| 668 } // namespace cc | 664 } // namespace cc |
| OLD | NEW |