| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "base/trace_event/trace_event_argument.h" | 13 #include "base/trace_event/trace_event_argument.h" |
| 14 #include "base/trace_event/trace_event_synthetic_delay.h" | 14 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 15 #include "cc/animation/animation_events.h" | 15 #include "cc/animation/animation_events.h" |
| 16 #include "cc/debug/benchmark_instrumentation.h" | 16 #include "cc/debug/benchmark_instrumentation.h" |
| 17 #include "cc/debug/devtools_instrumentation.h" | 17 #include "cc/debug/devtools_instrumentation.h" |
| 18 #include "cc/input/top_controls_manager.h" | 18 #include "cc/input/top_controls_manager.h" |
| 19 #include "cc/output/context_provider.h" | 19 #include "cc/output/context_provider.h" |
| 20 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
| 21 #include "cc/scheduler/compositor_timing_history.h" | 21 #include "cc/scheduler/compositor_timing_history.h" |
| 22 #include "cc/scheduler/delay_based_time_source.h" | 22 #include "cc/scheduler/delay_based_time_source.h" |
| 23 #include "cc/trees/layer_tree_host.h" | 23 #include "cc/trees/layer_tree_host_in_process.h" |
| 24 #include "cc/trees/layer_tree_impl.h" | 24 #include "cc/trees/layer_tree_impl.h" |
| 25 #include "cc/trees/task_runner_provider.h" | 25 #include "cc/trees/task_runner_provider.h" |
| 26 #include "gpu/command_buffer/client/gles2_interface.h" | 26 #include "gpu/command_buffer/client/gles2_interface.h" |
| 27 | 27 |
| 28 namespace cc { | 28 namespace cc { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 // Measured in seconds. | 32 // Measured in seconds. |
| 33 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; | 33 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; |
| 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 LayerTreeHostInProcess* 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->GetId()), | 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), |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 if (layer_tree_host_impl_->output_surface()) { | 220 if (layer_tree_host_impl_->output_surface()) { |
| 221 *main_frame_will_happen = scheduler_->MainFrameForTestingWillHappen(); | 221 *main_frame_will_happen = scheduler_->MainFrameForTestingWillHappen(); |
| 222 } else { | 222 } else { |
| 223 *main_frame_will_happen = false; | 223 *main_frame_will_happen = false; |
| 224 } | 224 } |
| 225 completion->Signal(); | 225 completion->Signal(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void ProxyImpl::NotifyReadyToCommitOnImpl( | 228 void ProxyImpl::NotifyReadyToCommitOnImpl( |
| 229 CompletionEvent* completion, | 229 CompletionEvent* completion, |
| 230 LayerTreeHost* layer_tree_host, | 230 LayerTreeHostInProcess* layer_tree_host, |
| 231 base::TimeTicks main_thread_start_time, | 231 base::TimeTicks main_thread_start_time, |
| 232 bool hold_commit_for_activation) { | 232 bool hold_commit_for_activation) { |
| 233 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToCommitOnImpl"); | 233 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToCommitOnImpl"); |
| 234 DCHECK(!commit_completion_event_); | 234 DCHECK(!commit_completion_event_); |
| 235 DCHECK(IsImplThread() && IsMainThreadBlocked()); | 235 DCHECK(IsImplThread() && IsMainThreadBlocked()); |
| 236 DCHECK(scheduler_); | 236 DCHECK(scheduler_); |
| 237 DCHECK(scheduler_->CommitPending()); | 237 DCHECK(scheduler_->CommitPending()); |
| 238 | 238 |
| 239 if (!layer_tree_host_impl_) { | 239 if (!layer_tree_host_impl_) { |
| 240 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoLayerTree", | 240 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoLayerTree", |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 bool ProxyImpl::IsMainThreadBlocked() const { | 620 bool ProxyImpl::IsMainThreadBlocked() const { |
| 621 return task_runner_provider_->IsMainThreadBlocked(); | 621 return task_runner_provider_->IsMainThreadBlocked(); |
| 622 } | 622 } |
| 623 | 623 |
| 624 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 624 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 625 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 625 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 626 return main_thread_blocked_commit_vars_unsafe_; | 626 return main_thread_blocked_commit_vars_unsafe_; |
| 627 } | 627 } |
| 628 | 628 |
| 629 } // namespace cc | 629 } // namespace cc |
| OLD | NEW |