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

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

Issue 1821863002: Hook up ui::Compositor to Display's BeginFrameSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase; refactor mus output surface Created 4 years, 8 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/profiler/scoped_tracker.h" 8 #include "base/profiler/scoped_tracker.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/animation/animation_events.h" 10 #include "cc/animation/animation_events.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 SchedulerSettings scheduler_settings( 64 SchedulerSettings scheduler_settings(
65 layer_tree_host_->settings().ToSchedulerSettings()); 65 layer_tree_host_->settings().ToSchedulerSettings());
66 scheduler_settings.commit_to_active_tree = CommitToActiveTree(); 66 scheduler_settings.commit_to_active_tree = CommitToActiveTree();
67 67
68 scoped_ptr<CompositorTimingHistory> compositor_timing_history( 68 scoped_ptr<CompositorTimingHistory> compositor_timing_history(
69 new CompositorTimingHistory( 69 new CompositorTimingHistory(
70 scheduler_settings.using_synchronous_renderer_compositor, 70 scheduler_settings.using_synchronous_renderer_compositor,
71 CompositorTimingHistory::BROWSER_UMA, 71 CompositorTimingHistory::BROWSER_UMA,
72 layer_tree_host_->rendering_stats_instrumentation())); 72 layer_tree_host_->rendering_stats_instrumentation()));
73 73
74 BeginFrameSource* frame_source = external_begin_frame_source_.get(); 74 BeginFrameSource* frame_source = nullptr;
75 if (!scheduler_settings.throttle_frame_production) { 75 if (!layer_tree_host_->settings().use_output_surface_begin_frame_source) {
76 // Unthrottled source takes precedence over external sources. 76 frame_source = external_begin_frame_source_.get();
77 unthrottled_begin_frame_source_.reset(new BackToBackBeginFrameSource( 77 if (!scheduler_settings.throttle_frame_production) {
78 task_runner_provider_->MainThreadTaskRunner())); 78 // Unthrottled source takes precedence over external sources.
79 frame_source = unthrottled_begin_frame_source_.get(); 79 unthrottled_begin_frame_source_.reset(new BackToBackBeginFrameSource(
80 } 80 task_runner_provider_->MainThreadTaskRunner()));
81 if (!frame_source) { 81 frame_source = unthrottled_begin_frame_source_.get();
82 synthetic_begin_frame_source_.reset(new SyntheticBeginFrameSource( 82 }
83 task_runner_provider_->MainThreadTaskRunner(), 83 if (!frame_source) {
84 BeginFrameArgs::DefaultInterval())); 84 synthetic_begin_frame_source_.reset(new SyntheticBeginFrameSource(
85 frame_source = synthetic_begin_frame_source_.get(); 85 task_runner_provider_->MainThreadTaskRunner(),
86 BeginFrameArgs::DefaultInterval()));
87 frame_source = synthetic_begin_frame_source_.get();
88 }
86 } 89 }
87 90
88 scheduler_on_impl_thread_ = 91 scheduler_on_impl_thread_ =
89 Scheduler::Create(this, scheduler_settings, layer_tree_host_->id(), 92 Scheduler::Create(this, scheduler_settings, layer_tree_host_->id(),
90 task_runner_provider_->MainThreadTaskRunner(), 93 task_runner_provider_->MainThreadTaskRunner(),
91 frame_source, std::move(compositor_timing_history)); 94 frame_source, std::move(compositor_timing_history));
92 } 95 }
93 96
94 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); 97 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
95 } 98 }
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 // TODO(brianderson): We should not be receiving 0 intervals. 485 // TODO(brianderson): We should not be receiving 0 intervals.
483 interval = BeginFrameArgs::DefaultInterval(); 486 interval = BeginFrameArgs::DefaultInterval();
484 } 487 }
485 488
486 last_vsync_timebase_ = timebase; 489 last_vsync_timebase_ = timebase;
487 490
488 if (synthetic_begin_frame_source_) 491 if (synthetic_begin_frame_source_)
489 synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval); 492 synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval);
490 } 493 }
491 494
495 void SingleThreadProxy::SetBeginFrameSource(BeginFrameSource* source) {
496 DCHECK(layer_tree_host_->settings().single_thread_proxy_scheduler);
497 // TODO(enne): this overrides any preexisting begin frame source. Those
498 // other sources will eventually be removed and this will be the only path.
499 if (!layer_tree_host_->settings().use_output_surface_begin_frame_source)
500 return;
501 if (scheduler_on_impl_thread_)
502 scheduler_on_impl_thread_->SetBeginFrameSource(source);
503 }
504
492 void SingleThreadProxy::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { 505 void SingleThreadProxy::SetEstimatedParentDrawTime(base::TimeDelta draw_time) {
493 if (scheduler_on_impl_thread_) 506 if (scheduler_on_impl_thread_)
494 scheduler_on_impl_thread_->SetEstimatedParentDrawTime(draw_time); 507 scheduler_on_impl_thread_->SetEstimatedParentDrawTime(draw_time);
495 } 508 }
496 509
497 void SingleThreadProxy::DidSwapBuffersOnImplThread() { 510 void SingleThreadProxy::DidSwapBuffersOnImplThread() {
498 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersOnImplThread"); 511 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersOnImplThread");
499 if (scheduler_on_impl_thread_) 512 if (scheduler_on_impl_thread_)
500 scheduler_on_impl_thread_->DidSwapBuffers(); 513 scheduler_on_impl_thread_->DidSwapBuffers();
501 client_->DidPostSwapBuffers(); 514 client_->DidPostSwapBuffers();
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 << "DidFinishImplFrame called while not inside an impl frame!"; 910 << "DidFinishImplFrame called while not inside an impl frame!";
898 inside_impl_frame_ = false; 911 inside_impl_frame_ = false;
899 #endif 912 #endif
900 } 913 }
901 914
902 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { 915 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) {
903 layer_tree_host_->SendBeginFramesToChildren(args); 916 layer_tree_host_->SendBeginFramesToChildren(args);
904 } 917 }
905 918
906 } // namespace cc 919 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698