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

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

Issue 2061273002: cc: Make BackToBackBeginFrameSource a SyntheticBeginFrameSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: syntheticbeginframesource: delete-DEBUG_FRAMES Created 4 years, 6 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/test/scheduler_test_common.cc ('k') | cc/trees/single_thread_proxy.cc » ('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"
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/trees/layer_tree_host.h" 23 #include "cc/trees/layer_tree_host.h"
23 #include "cc/trees/layer_tree_impl.h" 24 #include "cc/trees/layer_tree_impl.h"
24 #include "cc/trees/task_runner_provider.h" 25 #include "cc/trees/task_runner_provider.h"
25 #include "gpu/command_buffer/client/gles2_interface.h" 26 #include "gpu/command_buffer/client/gles2_interface.h"
26 27
27 namespace cc { 28 namespace cc {
28 29
29 namespace { 30 namespace {
30 31
31 // Measured in seconds. 32 // Measured in seconds.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 std::unique_ptr<CompositorTimingHistory> compositor_timing_history( 80 std::unique_ptr<CompositorTimingHistory> compositor_timing_history(
80 new CompositorTimingHistory( 81 new CompositorTimingHistory(
81 scheduler_settings.using_synchronous_renderer_compositor, 82 scheduler_settings.using_synchronous_renderer_compositor,
82 CompositorTimingHistory::RENDERER_UMA, 83 CompositorTimingHistory::RENDERER_UMA,
83 rendering_stats_instrumentation_)); 84 rendering_stats_instrumentation_));
84 85
85 BeginFrameSource* frame_source = external_begin_frame_source_.get(); 86 BeginFrameSource* frame_source = external_begin_frame_source_.get();
86 if (!scheduler_settings.throttle_frame_production) { 87 if (!scheduler_settings.throttle_frame_production) {
87 // Unthrottled source takes precedence over external sources. 88 // Unthrottled source takes precedence over external sources.
88 unthrottled_begin_frame_source_.reset(new BackToBackBeginFrameSource( 89 unthrottled_begin_frame_source_.reset(
89 task_runner_provider_->ImplThreadTaskRunner())); 90 new BackToBackBeginFrameSource(base::MakeUnique<DelayBasedTimeSource>(
91 task_runner_provider_->ImplThreadTaskRunner())));
90 frame_source = unthrottled_begin_frame_source_.get(); 92 frame_source = unthrottled_begin_frame_source_.get();
91 } 93 }
92 if (!frame_source) { 94 if (!frame_source) {
93 synthetic_begin_frame_source_.reset(new SyntheticBeginFrameSource( 95 synthetic_begin_frame_source_.reset(
94 task_runner_provider_->ImplThreadTaskRunner(), 96 new DelayBasedBeginFrameSource(base::MakeUnique<DelayBasedTimeSource>(
95 BeginFrameArgs::DefaultInterval())); 97 task_runner_provider_->ImplThreadTaskRunner())));
96 frame_source = synthetic_begin_frame_source_.get(); 98 frame_source = synthetic_begin_frame_source_.get();
97 } 99 }
98 scheduler_ = 100 scheduler_ =
99 Scheduler::Create(this, scheduler_settings, layer_tree_host_id_, 101 Scheduler::Create(this, scheduler_settings, layer_tree_host_id_,
100 task_runner_provider_->ImplThreadTaskRunner(), 102 task_runner_provider_->ImplThreadTaskRunner(),
101 frame_source, std::move(compositor_timing_history)); 103 frame_source, std::move(compositor_timing_history));
102 104
103 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible()); 105 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible());
104 } 106 }
105 107
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 void ProxyImpl::DidLoseOutputSurfaceOnImplThread() { 300 void ProxyImpl::DidLoseOutputSurfaceOnImplThread() {
299 TRACE_EVENT0("cc", "ProxyImpl::DidLoseOutputSurfaceOnImplThread"); 301 TRACE_EVENT0("cc", "ProxyImpl::DidLoseOutputSurfaceOnImplThread");
300 DCHECK(IsImplThread()); 302 DCHECK(IsImplThread());
301 channel_impl_->DidLoseOutputSurface(); 303 channel_impl_->DidLoseOutputSurface();
302 scheduler_->DidLoseOutputSurface(); 304 scheduler_->DidLoseOutputSurface();
303 } 305 }
304 306
305 void ProxyImpl::CommitVSyncParameters(base::TimeTicks timebase, 307 void ProxyImpl::CommitVSyncParameters(base::TimeTicks timebase,
306 base::TimeDelta interval) { 308 base::TimeDelta interval) {
307 DCHECK(IsImplThread()); 309 DCHECK(IsImplThread());
308 if (!synthetic_begin_frame_source_) 310 if (synthetic_begin_frame_source_)
309 return; 311 synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval);
310
311 if (interval.is_zero()) {
312 // TODO(brianderson): We should not be receiving 0 intervals.
313 interval = BeginFrameArgs::DefaultInterval();
314 }
315 synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval);
316 } 312 }
317 313
318 void ProxyImpl::SetBeginFrameSource(BeginFrameSource* source) { 314 void ProxyImpl::SetBeginFrameSource(BeginFrameSource* source) {
319 // During shutdown, destroying the OutputSurface may unset the 315 // During shutdown, destroying the OutputSurface may unset the
320 // BeginFrameSource. 316 // BeginFrameSource.
321 if (scheduler_) { 317 if (scheduler_) {
322 // TODO(enne): this overrides any preexisting begin frame source. Those 318 // TODO(enne): this overrides any preexisting begin frame source. Those
323 // other sources will eventually be removed and this will be the only path. 319 // other sources will eventually be removed and this will be the only path.
324 scheduler_->SetBeginFrameSource(source); 320 scheduler_->SetBeginFrameSource(source);
325 } 321 }
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 bool ProxyImpl::IsMainThreadBlocked() const { 681 bool ProxyImpl::IsMainThreadBlocked() const {
686 return task_runner_provider_->IsMainThreadBlocked(); 682 return task_runner_provider_->IsMainThreadBlocked();
687 } 683 }
688 684
689 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { 685 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() {
690 DCHECK(IsMainThreadBlocked() && commit_completion_event_); 686 DCHECK(IsMainThreadBlocked() && commit_completion_event_);
691 return main_thread_blocked_commit_vars_unsafe_; 687 return main_thread_blocked_commit_vars_unsafe_;
692 } 688 }
693 689
694 } // namespace cc 690 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/scheduler_test_common.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698