Index: cc/trees/single_thread_proxy.cc |
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc |
index 1769c19fe60d303b082519dcf7c9103d3ad8ea25..7dc16da471575153429cc0c6bef0e46ebff53860 100644 |
--- a/cc/trees/single_thread_proxy.cc |
+++ b/cc/trees/single_thread_proxy.cc |
@@ -207,12 +207,7 @@ void SingleThreadProxy::DoCommit() { |
if (scheduler_on_impl_thread_) |
scheduler_on_impl_thread_->DidCommit(); |
- // Issue decode callbacks. |
- auto completed_decode_callbacks = |
- layer_tree_host_impl_->TakeCompletedImageDecodeCallbacks(); |
- for (auto& callback : completed_decode_callbacks) |
- callback.Run(); |
- |
+ IssueImageDecodeFinishedCallbacks(); |
layer_tree_host_impl_->CommitComplete(); |
// Commit goes directly to the active tree, but we need to synchronously |
@@ -224,6 +219,15 @@ void SingleThreadProxy::DoCommit() { |
} |
} |
+void SingleThreadProxy::IssueImageDecodeFinishedCallbacks() { |
+ DCHECK(task_runner_provider_->IsImplThread()); |
+ |
+ auto completed_decode_callbacks = |
+ layer_tree_host_impl_->TakeCompletedImageDecodeCallbacks(); |
+ for (auto& callback : completed_decode_callbacks) |
+ callback.Run(); |
+} |
+ |
void SingleThreadProxy::CommitComplete() { |
// Commit complete happens on the main side after activate to satisfy any |
// SetNextCommitWaitsForActivation calls. |
@@ -446,6 +450,19 @@ void SingleThreadProxy::NeedsImplSideInvalidation() { |
scheduler_on_impl_thread_->SetNeedsImplSideInvalidation(); |
} |
+void SingleThreadProxy::NotifyImageDecodeRequestFinished() { |
+ // If we don't have a scheduler, then just issue the callbacks here. |
+ // Otherwise, schedule a commit. |
+ if (!scheduler_on_impl_thread_) { |
+ DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); |
+ DebugScopedSetImplThread impl(task_runner_provider_); |
+ |
+ IssueImageDecodeFinishedCallbacks(); |
+ return; |
+ } |
+ SetNeedsCommitOnImplThread(); |
+} |
+ |
void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { |
TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); |
DCHECK(task_runner_provider_->IsMainThread()); |