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/compositor_frame_sink.h" | 19 #include "cc/output/compositor_frame_sink.h" |
20 #include "cc/output/context_provider.h" | 20 #include "cc/output/context_provider.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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 if (layer_tree_host_impl_->compositor_frame_sink()) { | 221 if (layer_tree_host_impl_->compositor_frame_sink()) { |
222 *main_frame_will_happen = scheduler_->MainFrameForTestingWillHappen(); | 222 *main_frame_will_happen = scheduler_->MainFrameForTestingWillHappen(); |
223 } else { | 223 } else { |
224 *main_frame_will_happen = false; | 224 *main_frame_will_happen = false; |
225 } | 225 } |
226 completion->Signal(); | 226 completion->Signal(); |
227 } | 227 } |
228 | 228 |
229 void ProxyImpl::NotifyReadyToCommitOnImpl( | 229 void ProxyImpl::NotifyReadyToCommitOnImpl( |
230 CompletionEvent* completion, | 230 CompletionEvent* completion, |
231 LayerTreeHost* layer_tree_host, | 231 LayerTreeHostInProcess* layer_tree_host, |
232 base::TimeTicks main_thread_start_time, | 232 base::TimeTicks main_thread_start_time, |
233 bool hold_commit_for_activation) { | 233 bool hold_commit_for_activation) { |
234 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToCommitOnImpl"); | 234 TRACE_EVENT0("cc", "ProxyImpl::NotifyReadyToCommitOnImpl"); |
235 DCHECK(!commit_completion_event_); | 235 DCHECK(!commit_completion_event_); |
236 DCHECK(IsImplThread() && IsMainThreadBlocked()); | 236 DCHECK(IsImplThread() && IsMainThreadBlocked()); |
237 DCHECK(scheduler_); | 237 DCHECK(scheduler_); |
238 DCHECK(scheduler_->CommitPending()); | 238 DCHECK(scheduler_->CommitPending()); |
239 | 239 |
240 if (!layer_tree_host_impl_) { | 240 if (!layer_tree_host_impl_) { |
241 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoLayerTree", | 241 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoLayerTree", |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 bool ProxyImpl::IsMainThreadBlocked() const { | 622 bool ProxyImpl::IsMainThreadBlocked() const { |
623 return task_runner_provider_->IsMainThreadBlocked(); | 623 return task_runner_provider_->IsMainThreadBlocked(); |
624 } | 624 } |
625 | 625 |
626 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 626 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
627 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 627 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
628 return main_thread_blocked_commit_vars_unsafe_; | 628 return main_thread_blocked_commit_vars_unsafe_; |
629 } | 629 } |
630 | 630 |
631 } // namespace cc | 631 } // namespace cc |
OLD | NEW |