| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 unsigned int nextBeginFrameId = 0; | 35 unsigned int nextBeginFrameId = 0; |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 ProxyImpl::ProxyImpl( | 39 ProxyImpl::ProxyImpl( |
| 40 ChannelImpl* channel_impl, | 40 ChannelImpl* channel_impl, |
| 41 LayerTreeHost* layer_tree_host, | 41 LayerTreeHost* layer_tree_host, |
| 42 TaskRunnerProvider* task_runner_provider, | 42 TaskRunnerProvider* task_runner_provider, |
| 43 std::unique_ptr<BeginFrameSource> external_begin_frame_source) | 43 std::unique_ptr<BeginFrameSource> external_begin_frame_source) |
| 44 : layer_tree_host_id_(layer_tree_host->id()), | 44 : layer_tree_host_id_(layer_tree_host->GetId()), |
| 45 commit_completion_waits_for_activation_(false), | 45 commit_completion_waits_for_activation_(false), |
| 46 commit_completion_event_(nullptr), | 46 commit_completion_event_(nullptr), |
| 47 activation_completion_event_(nullptr), | 47 activation_completion_event_(nullptr), |
| 48 next_frame_is_newly_committed_frame_(false), | 48 next_frame_is_newly_committed_frame_(false), |
| 49 inside_draw_(false), | 49 inside_draw_(false), |
| 50 input_throttled_until_commit_(false), | 50 input_throttled_until_commit_(false), |
| 51 task_runner_provider_(task_runner_provider), | 51 task_runner_provider_(task_runner_provider), |
| 52 smoothness_priority_expiration_notifier_( | 52 smoothness_priority_expiration_notifier_( |
| 53 task_runner_provider->ImplThreadTaskRunner(), | 53 task_runner_provider->ImplThreadTaskRunner(), |
| 54 base::Bind(&ProxyImpl::RenewTreePriority, base::Unretained(this)), | 54 base::Bind(&ProxyImpl::RenewTreePriority, base::Unretained(this)), |
| 55 base::TimeDelta::FromSecondsD( | 55 base::TimeDelta::FromSecondsD( |
| 56 kSmoothnessTakesPriorityExpirationDelay)), | 56 kSmoothnessTakesPriorityExpirationDelay)), |
| 57 external_begin_frame_source_(std::move(external_begin_frame_source)), | 57 external_begin_frame_source_(std::move(external_begin_frame_source)), |
| 58 rendering_stats_instrumentation_( | 58 rendering_stats_instrumentation_( |
| 59 layer_tree_host->rendering_stats_instrumentation()), | 59 layer_tree_host->rendering_stats_instrumentation()), |
| 60 channel_impl_(channel_impl) { | 60 channel_impl_(channel_impl) { |
| 61 TRACE_EVENT0("cc", "ProxyImpl::ProxyImpl"); | 61 TRACE_EVENT0("cc", "ProxyImpl::ProxyImpl"); |
| 62 DCHECK(IsImplThread()); | 62 DCHECK(IsImplThread()); |
| 63 DCHECK(IsMainThreadBlocked()); | 63 DCHECK(IsMainThreadBlocked()); |
| 64 | 64 |
| 65 // Double checking we set this correctly since double->int truncations are | 65 // Double checking we set this correctly since double->int truncations are |
| 66 // silent and have been done mistakenly: crbug.com/568120. | 66 // silent and have been done mistakenly: crbug.com/568120. |
| 67 DCHECK(!smoothness_priority_expiration_notifier_.delay().is_zero()); | 67 DCHECK(!smoothness_priority_expiration_notifier_.delay().is_zero()); |
| 68 | 68 |
| 69 layer_tree_host_impl_ = layer_tree_host->CreateLayerTreeHostImpl(this); | 69 layer_tree_host_impl_ = layer_tree_host->CreateLayerTreeHostImpl(this); |
| 70 | 70 |
| 71 SchedulerSettings scheduler_settings( | 71 SchedulerSettings scheduler_settings( |
| 72 layer_tree_host->settings().ToSchedulerSettings()); | 72 layer_tree_host->GetSettings().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 // BFS must either be external or come from the output surface. If | 80 // BFS must either be external or come from the output surface. If |
| 81 // external, it must be provided. If from the output surface, it must | 81 // external, it must be provided. If from the output surface, it must |
| 82 // not be provided. | 82 // not be provided. |
| 83 // TODO(enne): Make all BFS come from the output surface. | 83 // TODO(enne): Make all BFS come from the output surface. |
| 84 DCHECK(layer_tree_host->settings().use_external_begin_frame_source ^ | 84 DCHECK(layer_tree_host->GetSettings().use_external_begin_frame_source ^ |
| 85 layer_tree_host->settings().use_output_surface_begin_frame_source); | 85 layer_tree_host->GetSettings().use_output_surface_begin_frame_source); |
| 86 DCHECK(!layer_tree_host->settings().use_external_begin_frame_source || | 86 DCHECK(!layer_tree_host->GetSettings().use_external_begin_frame_source || |
| 87 external_begin_frame_source_); | 87 external_begin_frame_source_); |
| 88 DCHECK(!layer_tree_host->settings().use_output_surface_begin_frame_source || | 88 DCHECK( |
| 89 !external_begin_frame_source_); | 89 !layer_tree_host->GetSettings().use_output_surface_begin_frame_source || |
| 90 !external_begin_frame_source_); |
| 90 scheduler_ = Scheduler::Create(this, scheduler_settings, layer_tree_host_id_, | 91 scheduler_ = Scheduler::Create(this, scheduler_settings, layer_tree_host_id_, |
| 91 task_runner_provider_->ImplThreadTaskRunner(), | 92 task_runner_provider_->ImplThreadTaskRunner(), |
| 92 external_begin_frame_source_.get(), | 93 external_begin_frame_source_.get(), |
| 93 std::move(compositor_timing_history)); | 94 std::move(compositor_timing_history)); |
| 94 | 95 |
| 95 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible()); | 96 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible()); |
| 96 } | 97 } |
| 97 | 98 |
| 98 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly() | 99 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly() |
| 99 : layer_tree_host(nullptr) {} | 100 : layer_tree_host(nullptr) {} |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 bool ProxyImpl::IsMainThreadBlocked() const { | 633 bool ProxyImpl::IsMainThreadBlocked() const { |
| 633 return task_runner_provider_->IsMainThreadBlocked(); | 634 return task_runner_provider_->IsMainThreadBlocked(); |
| 634 } | 635 } |
| 635 | 636 |
| 636 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 637 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 637 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 638 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 638 return main_thread_blocked_commit_vars_unsafe_; | 639 return main_thread_blocked_commit_vars_unsafe_; |
| 639 } | 640 } |
| 640 | 641 |
| 641 } // namespace cc | 642 } // namespace cc |
| OLD | NEW |