Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: cc/trees/proxy_impl.cc

Issue 2296353002: Revert of Remove default begin frame sources from the renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/proxy_impl.h ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // BFS must either be external or come from the output surface. If 80 BeginFrameSource* frame_source = external_begin_frame_source_.get();
81 // external, it must be provided. If from the output surface, it must 81 if (!scheduler_settings.throttle_frame_production) {
82 // not be provided. 82 // Unthrottled source takes precedence over external sources.
83 // TODO(enne): Make all BFS come from the output surface. 83 unthrottled_begin_frame_source_.reset(
84 DCHECK(layer_tree_host->settings().use_external_begin_frame_source ^ 84 new BackToBackBeginFrameSource(base::MakeUnique<DelayBasedTimeSource>(
85 layer_tree_host->settings().use_output_surface_begin_frame_source); 85 task_runner_provider_->ImplThreadTaskRunner())));
86 DCHECK(!layer_tree_host->settings().use_external_begin_frame_source || 86 frame_source = unthrottled_begin_frame_source_.get();
87 external_begin_frame_source_); 87 }
88 DCHECK(!layer_tree_host->settings().use_output_surface_begin_frame_source || 88 if (!frame_source) {
89 !external_begin_frame_source_); 89 synthetic_begin_frame_source_.reset(
90 scheduler_ = Scheduler::Create(this, scheduler_settings, layer_tree_host_id_, 90 new DelayBasedBeginFrameSource(base::MakeUnique<DelayBasedTimeSource>(
91 task_runner_provider_->ImplThreadTaskRunner(), 91 task_runner_provider_->ImplThreadTaskRunner())));
92 external_begin_frame_source_.get(), 92 frame_source = synthetic_begin_frame_source_.get();
93 std::move(compositor_timing_history)); 93 }
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));
94 98
95 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible()); 99 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible());
96 } 100 }
97 101
98 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly() 102 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly()
99 : layer_tree_host(nullptr) {} 103 : layer_tree_host(nullptr) {}
100 104
101 ProxyImpl::BlockedMainCommitOnly::~BlockedMainCommitOnly() {} 105 ProxyImpl::BlockedMainCommitOnly::~BlockedMainCommitOnly() {}
102 106
103 ProxyImpl::~ProxyImpl() { 107 ProxyImpl::~ProxyImpl() {
104 TRACE_EVENT0("cc", "ProxyImpl::~ProxyImpl"); 108 TRACE_EVENT0("cc", "ProxyImpl::~ProxyImpl");
105 DCHECK(IsImplThread()); 109 DCHECK(IsImplThread());
106 DCHECK(IsMainThreadBlocked()); 110 DCHECK(IsMainThreadBlocked());
107 111
108 // Take away the OutputSurface before destroying things so it doesn't try 112 // Take away the OutputSurface before destroying things so it doesn't try
109 // to call into its client mid-shutdown. 113 // to call into its client mid-shutdown.
110 scheduler_->DidLoseOutputSurface(); 114 scheduler_->DidLoseOutputSurface();
111 layer_tree_host_impl_->ReleaseOutputSurface(); 115 layer_tree_host_impl_->ReleaseOutputSurface();
112 116
113 scheduler_ = nullptr; 117 scheduler_ = nullptr;
114 external_begin_frame_source_ = nullptr; 118 external_begin_frame_source_ = nullptr;
119 unthrottled_begin_frame_source_ = nullptr;
120 synthetic_begin_frame_source_ = nullptr;
115 layer_tree_host_impl_ = nullptr; 121 layer_tree_host_impl_ = nullptr;
116 // We need to explicitly shutdown the notifier to destroy any weakptrs it is 122 // We need to explicitly shutdown the notifier to destroy any weakptrs it is
117 // holding while still on the compositor thread. This also ensures any 123 // holding while still on the compositor thread. This also ensures any
118 // callbacks holding a ProxyImpl pointer are cancelled. 124 // callbacks holding a ProxyImpl pointer are cancelled.
119 smoothness_priority_expiration_notifier_.Shutdown(); 125 smoothness_priority_expiration_notifier_.Shutdown();
120 } 126 }
121 127
122 void ProxyImpl::InitializeMutatorOnImpl( 128 void ProxyImpl::InitializeMutatorOnImpl(
123 std::unique_ptr<LayerTreeMutator> mutator) { 129 std::unique_ptr<LayerTreeMutator> mutator) {
124 TRACE_EVENT0("cc,compositor-worker", "ProxyImpl::InitializeMutatorOnImpl"); 130 TRACE_EVENT0("cc,compositor-worker", "ProxyImpl::InitializeMutatorOnImpl");
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 scheduler_->NotifyReadyToCommit(); 270 scheduler_->NotifyReadyToCommit();
265 } 271 }
266 272
267 void ProxyImpl::DidLoseOutputSurfaceOnImplThread() { 273 void ProxyImpl::DidLoseOutputSurfaceOnImplThread() {
268 TRACE_EVENT0("cc", "ProxyImpl::DidLoseOutputSurfaceOnImplThread"); 274 TRACE_EVENT0("cc", "ProxyImpl::DidLoseOutputSurfaceOnImplThread");
269 DCHECK(IsImplThread()); 275 DCHECK(IsImplThread());
270 channel_impl_->DidLoseOutputSurface(); 276 channel_impl_->DidLoseOutputSurface();
271 scheduler_->DidLoseOutputSurface(); 277 scheduler_->DidLoseOutputSurface();
272 } 278 }
273 279
280 void ProxyImpl::CommitVSyncParameters(base::TimeTicks timebase,
281 base::TimeDelta interval) {
282 DCHECK(IsImplThread());
283 if (synthetic_begin_frame_source_)
284 synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval);
285 }
286
274 void ProxyImpl::SetBeginFrameSource(BeginFrameSource* source) { 287 void ProxyImpl::SetBeginFrameSource(BeginFrameSource* source) {
275 // During shutdown, destroying the OutputSurface may unset the 288 // During shutdown, destroying the OutputSurface may unset the
276 // BeginFrameSource. 289 // BeginFrameSource.
277 if (scheduler_) { 290 if (scheduler_) {
278 // TODO(enne): this overrides any preexisting begin frame source. Those 291 // TODO(enne): this overrides any preexisting begin frame source. Those
279 // other sources will eventually be removed and this will be the only path. 292 // other sources will eventually be removed and this will be the only path.
280 scheduler_->SetBeginFrameSource(source); 293 scheduler_->SetBeginFrameSource(source);
281 } 294 }
282 } 295 }
283 296
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 bool ProxyImpl::IsMainThreadBlocked() const { 645 bool ProxyImpl::IsMainThreadBlocked() const {
633 return task_runner_provider_->IsMainThreadBlocked(); 646 return task_runner_provider_->IsMainThreadBlocked();
634 } 647 }
635 648
636 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { 649 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() {
637 DCHECK(IsMainThreadBlocked() && commit_completion_event_); 650 DCHECK(IsMainThreadBlocked() && commit_completion_event_);
638 return main_thread_blocked_commit_vars_unsafe_; 651 return main_thread_blocked_commit_vars_unsafe_;
639 } 652 }
640 653
641 } // namespace cc 654 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/proxy_impl.h ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698