| 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/debug/benchmark_instrumentation.h" | 15 #include "cc/debug/benchmark_instrumentation.h" |
| 16 #include "cc/debug/devtools_instrumentation.h" | 16 #include "cc/debug/devtools_instrumentation.h" |
| 17 #include "cc/input/browser_controls_offset_manager.h" | 17 #include "cc/input/browser_controls_offset_manager.h" |
| 18 #include "cc/output/compositor_frame_sink.h" | 18 #include "cc/output/compositor_frame_sink.h" |
| 19 #include "cc/output/context_provider.h" | 19 #include "cc/output/context_provider.h" |
| 20 #include "cc/scheduler/compositor_timing_history.h" | 20 #include "cc/scheduler/compositor_timing_history.h" |
| 21 #include "cc/scheduler/delay_based_time_source.h" | 21 #include "cc/scheduler/delay_based_time_source.h" |
| 22 #include "cc/trees/layer_tree_host_in_process.h" | 22 #include "cc/trees/layer_tree_host.h" |
| 23 #include "cc/trees/layer_tree_impl.h" | 23 #include "cc/trees/layer_tree_impl.h" |
| 24 #include "cc/trees/mutator_host.h" | 24 #include "cc/trees/mutator_host.h" |
| 25 #include "cc/trees/proxy_main.h" | 25 #include "cc/trees/proxy_main.h" |
| 26 #include "cc/trees/task_runner_provider.h" | 26 #include "cc/trees/task_runner_provider.h" |
| 27 #include "gpu/command_buffer/client/gles2_interface.h" | 27 #include "gpu/command_buffer/client/gles2_interface.h" |
| 28 | 28 |
| 29 namespace cc { | 29 namespace cc { |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 // Measured in seconds. | 33 // Measured in seconds. |
| 34 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; | 34 const double kSmoothnessTakesPriorityExpirationDelay = 0.25; |
| 35 | 35 |
| 36 unsigned int nextBeginFrameId = 0; | 36 unsigned int nextBeginFrameId = 0; |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 ProxyImpl::ProxyImpl(base::WeakPtr<ProxyMain> proxy_main_weak_ptr, | 40 ProxyImpl::ProxyImpl(base::WeakPtr<ProxyMain> proxy_main_weak_ptr, |
| 41 LayerTreeHostInProcess* layer_tree_host, | 41 LayerTreeHost* layer_tree_host, |
| 42 TaskRunnerProvider* task_runner_provider) | 42 TaskRunnerProvider* task_runner_provider) |
| 43 : layer_tree_host_id_(layer_tree_host->GetId()), | 43 : layer_tree_host_id_(layer_tree_host->GetId()), |
| 44 commit_completion_waits_for_activation_(false), | 44 commit_completion_waits_for_activation_(false), |
| 45 commit_completion_event_(nullptr), | 45 commit_completion_event_(nullptr), |
| 46 activation_completion_event_(nullptr), | 46 activation_completion_event_(nullptr), |
| 47 next_frame_is_newly_committed_frame_(false), | 47 next_frame_is_newly_committed_frame_(false), |
| 48 inside_draw_(false), | 48 inside_draw_(false), |
| 49 input_throttled_until_commit_(false), | 49 input_throttled_until_commit_(false), |
| 50 task_runner_provider_(task_runner_provider), | 50 task_runner_provider_(task_runner_provider), |
| 51 smoothness_priority_expiration_notifier_( | 51 smoothness_priority_expiration_notifier_( |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 if (layer_tree_host_impl_->compositor_frame_sink()) { | 218 if (layer_tree_host_impl_->compositor_frame_sink()) { |
| 219 *main_frame_will_happen = scheduler_->MainFrameForTestingWillHappen(); | 219 *main_frame_will_happen = scheduler_->MainFrameForTestingWillHappen(); |
| 220 } else { | 220 } else { |
| 221 *main_frame_will_happen = false; | 221 *main_frame_will_happen = false; |
| 222 } | 222 } |
| 223 completion->Signal(); | 223 completion->Signal(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void ProxyImpl::NotifyReadyToCommitOnImpl( | 226 void ProxyImpl::NotifyReadyToCommitOnImpl( |
| 227 CompletionEvent* completion, | 227 CompletionEvent* completion, |
| 228 LayerTreeHostInProcess* layer_tree_host, | 228 LayerTreeHost* layer_tree_host, |
| 229 base::TimeTicks main_thread_start_time, | 229 base::TimeTicks main_thread_start_time, |
| 230 bool hold_commit_for_activation) { | 230 bool hold_commit_for_activation) { |
| 231 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToCommitOnImpl"); | 231 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToCommitOnImpl"); |
| 232 DCHECK(!commit_completion_event_); | 232 DCHECK(!commit_completion_event_); |
| 233 DCHECK(IsImplThread() && IsMainThreadBlocked()); | 233 DCHECK(IsImplThread() && IsMainThreadBlocked()); |
| 234 DCHECK(scheduler_); | 234 DCHECK(scheduler_); |
| 235 DCHECK(scheduler_->CommitPending()); | 235 DCHECK(scheduler_->CommitPending()); |
| 236 | 236 |
| 237 if (!layer_tree_host_impl_) { | 237 if (!layer_tree_host_impl_) { |
| 238 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoLayerTree", | 238 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoLayerTree", |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 628 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 629 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 629 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 630 return main_thread_blocked_commit_vars_unsafe_; | 630 return main_thread_blocked_commit_vars_unsafe_; |
| 631 } | 631 } |
| 632 | 632 |
| 633 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { | 633 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { |
| 634 return task_runner_provider_->MainThreadTaskRunner(); | 634 return task_runner_provider_->MainThreadTaskRunner(); |
| 635 } | 635 } |
| 636 | 636 |
| 637 } // namespace cc | 637 } // namespace cc |
| OLD | NEW |