Index: cc/trees/single_thread_proxy.cc |
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc |
index 07b5afa607a72b95240466e413a98e6d880c3ae8..46ca82c04c8baa2b1aa5c81a9d3a2b514b59f048 100644 |
--- a/cc/trees/single_thread_proxy.cc |
+++ b/cc/trees/single_thread_proxy.cc |
@@ -204,12 +204,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 |
@@ -221,6 +216,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. |
@@ -438,6 +442,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()); |