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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 2150533004: cc: Send all begin frames using a PostTask. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler_unittest_no_deadline
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 37baa50f67b25d9d7faf17c595c3a31cbd40d44f..3aecb9ccee2601ee6246d8596ccd387b51bfbe6e 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -80,14 +80,12 @@ void SingleThreadProxy::Start(
if (!scheduler_settings.throttle_frame_production) {
// Unthrottled source takes precedence over external sources.
unthrottled_begin_frame_source_.reset(new BackToBackBeginFrameSource(
- base::MakeUnique<DelayBasedTimeSource>(
- task_runner_provider_->MainThreadTaskRunner())));
+ task_runner_provider_->MainThreadTaskRunner()));
frame_source = unthrottled_begin_frame_source_.get();
}
if (!frame_source) {
synthetic_begin_frame_source_.reset(new DelayBasedBeginFrameSource(
- base::MakeUnique<DelayBasedTimeSource>(
- task_runner_provider_->MainThreadTaskRunner())));
+ task_runner_provider_->MainThreadTaskRunner()));
frame_source = synthetic_begin_frame_source_.get();
}
}
@@ -377,8 +375,8 @@ void SingleThreadProxy::SetMutator(std::unique_ptr<LayerTreeMutator> mutator) {
}
void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) {
- TRACE_EVENT1(
- "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
+ TRACE_EVENT1("cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw",
+ can_draw);
DCHECK(task_runner_provider_->IsImplThread());
if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->SetCanDraw(can_draw);
@@ -447,7 +445,9 @@ void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread(
layer_tree_host_->SetAnimationEvents(std::move(events));
}
-bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; }
+bool SingleThreadProxy::IsInsideDraw() {
+ return inside_draw_;
+}
void SingleThreadProxy::DidActivateSyncTree() {
// Synchronously call to CommitComplete. Resetting
@@ -600,8 +600,7 @@ bool SingleThreadProxy::SupportsImplScrolling() const {
bool SingleThreadProxy::ShouldComposite() const {
DCHECK(task_runner_provider_->IsImplThread());
- return layer_tree_host_impl_->visible() &&
- layer_tree_host_impl_->CanDraw();
+ return layer_tree_host_impl_->visible() && layer_tree_host_impl_->CanDraw();
}
void SingleThreadProxy::ScheduleRequestNewOutputSurface() {
@@ -737,13 +736,13 @@ void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) {
void SingleThreadProxy::ScheduledActionSendBeginMainFrame(
const BeginFrameArgs& begin_frame_args) {
TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame");
- // Although this proxy is single-threaded, it's problematic to synchronously
- // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This
- // could cause a commit to occur in between a series of SetNeedsCommit calls
- // (i.e. property modifications) causing some to fall on one frame and some to
- // fall on the next. Doing it asynchronously instead matches the semantics of
- // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a
- // synchronous commit.
+// Although this proxy is single-threaded, it's problematic to synchronously
+// have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This
+// could cause a commit to occur in between a series of SetNeedsCommit calls
+// (i.e. property modifications) causing some to fall on one frame and some to
+// fall on the next. Doing it asynchronously instead matches the semantics of
+// ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a
+// synchronous commit.
#if DCHECK_IS_ON()
DCHECK(inside_impl_frame_)
<< "BeginMainFrame should only be sent inside a BeginImplFrame";
@@ -787,8 +786,8 @@ void SingleThreadProxy::BeginMainFrame(const BeginFrameArgs& begin_frame_args) {
}
if (layer_tree_host_->output_surface_lost()) {
- TRACE_EVENT_INSTANT0(
- "cc", "EarlyOut_OutputSurfaceLost", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cc", "EarlyOut_OutputSurfaceLost",
+ TRACE_EVENT_SCOPE_THREAD);
BeginMainFrameAbortedOnImplThread(
CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST);
return;

Powered by Google App Engine
This is Rietveld 408576698